vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | simpleMinimap_Pings = simpleMinimap:NewModule("pings") |
2 | local L = AceLibrary("AceLocale-2.1"):GetInstance("simpleMinimap_Pings", true) |
||
3 | -- |
||
4 | function simpleMinimap_Pings:OnInitialize() |
||
5 | self.db = simpleMinimap:AcquireDBNamespace("pings") |
||
6 | self.positions = { |
||
7 | { "BOTTOM", "BOTTOM" }, |
||
8 | { "TOP", "BOTTOM" }, |
||
9 | { "TOP", "TOP" }, |
||
10 | { "BOTTOM", "TOP" } |
||
11 | } |
||
12 | self.defaults = { enabled=true, position=3, alpha=0.9, scale=0.85 } |
||
13 | self.options = { |
||
14 | type="group", name=L.pings, desc=L.pings_desc, |
||
15 | args={ |
||
16 | title = { |
||
17 | type="header", order=1, name="simpleMinimap |cFFFFFFCC"..L.pings |
||
18 | }, |
||
19 | spacer1={ |
||
20 | type="header", order=2 |
||
21 | }, |
||
22 | enabled={ |
||
23 | type="toggle", order=3, name= L.enabled, desc=L.enabled_desc, |
||
24 | get=function() return(self.db.profile.enabled) end, |
||
25 | set=function(x) self.db.profile.enabled=x simpleMinimap:ToggleModuleActive(self, x) end |
||
26 | }, |
||
27 | spacer2={ |
||
28 | type="header", order=4, name="---" |
||
29 | }, |
||
30 | alpha={ |
||
31 | type="range", order=10, name=L.alpha, desc=L.alpha_desc, |
||
32 | min=0, max=1, step=0.05, isPercent=true, |
||
33 | get=function() return(self.db.profile.alpha) end, |
||
34 | set=function(x) self.db.profile.alpha=x smmPingFrame:SetAlpha(x) end |
||
35 | }, |
||
36 | position = { |
||
37 | type="group", order=11, name=L.position, desc=L.position_desc, |
||
38 | args = { |
||
39 | ["1"]={ |
||
40 | type= "toggle", order=1, name=L.position1, desc=L.position1_desc, |
||
41 | get=function() return(self.db.profile.position==1) end, |
||
42 | set=function() self.db.profile.position=1 self:UpdateScreen() end |
||
43 | }, |
||
44 | ["2"]={ |
||
45 | type="toggle", order=2, name=L.position2, desc=L.position2_desc, |
||
46 | get=function() return(self.db.profile.position==2) end, |
||
47 | set=function() self.db.profile.position=2 self:UpdateScreen() end |
||
48 | }, |
||
49 | ["3"]={ |
||
50 | type= "toggle", order=3, name=L.position3, desc=L.position3_desc, |
||
51 | get=function() return(self.db.profile.position==3) end, |
||
52 | set=function() self.db.profile.position=3 self:UpdateScreen() end |
||
53 | }, |
||
54 | ["4"]={ |
||
55 | type="toggle", order=4, name=L.position4, desc=L.position4_desc, |
||
56 | get=function() return(self.db.profile.position==4) end, |
||
57 | set=function() self.db.profile.position=4 self:UpdateScreen() end |
||
58 | } |
||
59 | } |
||
60 | }, |
||
61 | scale={ |
||
62 | type= "range", order=12, name=L.scale, desc=L.scale_desc, |
||
63 | min=0.5, max=2, step=0.05, |
||
64 | get=function() return(self.db.profile.scale) end, |
||
65 | set=function(x) self.db.profile.scale=x smmPingFrame:SetScale(x) end |
||
66 | } |
||
67 | } |
||
68 | } |
||
69 | simpleMinimap.options.args.modules.args.pings = self.options |
||
70 | simpleMinimap:RegisterDefaults("pings", "profile", self.defaults) |
||
71 | smmPingFrame:SetScale(self.db.profile.scale) |
||
72 | smmPingFrame:SetAlpha(self.db.profile.alpha) |
||
73 | self:UpdateScreen() |
||
74 | end |
||
75 | -- |
||
76 | function simpleMinimap_Pings:OnEnable() |
||
77 | if(self.db.profile.enabled) then |
||
78 | self:RegisterEvent("MINIMAP_PING") |
||
79 | else |
||
80 | simpleMinimap:ToggleModuleActive(self, false) |
||
81 | end |
||
82 | end |
||
83 | -- |
||
84 | function simpleMinimap_Pings:OnDisable() |
||
85 | end |
||
86 | -- |
||
87 | function simpleMinimap_Pings:UpdateScreen() |
||
88 | smmPingFrame:ClearAllPoints() |
||
89 | smmPingFrame:SetPoint(self.positions[self.db.profile.position][1], "Minimap", self.positions[self.db.profile.position][2]) |
||
90 | end |
||
91 | -- |
||
92 | function simpleMinimap_Pings:MINIMAP_PING() |
||
93 | if(not UnitIsUnit(arg1, "player")) then |
||
94 | smmPingFrameText:SetText(L.ping_by.." |cFFFFFFCC"..UnitName(arg1)) |
||
95 | smmPingFrame:SetWidth(smmPingFrameText:GetWidth() + 16) |
||
96 | smmPingFrame:SetHeight(smmPingFrameText:GetHeight() + 12) |
||
97 | smmPingFrame:Show() |
||
98 | else |
||
99 | smmPingFrame:Hide() |
||
100 | end |
||
101 | end |