vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Minimap Button Handling |
2 | |||
3 | FishingBuddy.UseButtonHole = function() |
||
4 | if ( ButtonHole and FishingBuddy.GetSetting("UseButtonHole") == 1 ) then |
||
5 | return true; |
||
6 | else |
||
7 | return false; |
||
8 | end |
||
9 | end |
||
10 | |||
11 | FishingBuddy.Minimap = {}; |
||
12 | |||
13 | FishingBuddy.Minimap.OnLoad = function() |
||
14 | this:RegisterEvent("VARIABLES_LOADED"); |
||
15 | end |
||
16 | |||
17 | FishingBuddy.Minimap.OnEvent = function() |
||
18 | if ( FishingBuddy.UseButtonHole() ) then |
||
19 | local info = {}; |
||
20 | info.id=FishingBuddy.ID; |
||
21 | info.name=FishingBuddy.NAME; |
||
22 | info.tooltip=FishingBuddy.DESCRIPTION; |
||
23 | info.buttonFrame="FishingBuddyMinimapFrame"; |
||
24 | info.updateFunction="FishingBuddyMinimapButton_MoveButton"; |
||
25 | ButtonHole.application.RegisterMod(info); |
||
26 | elseif ( ButtonHole ) then |
||
27 | -- hack, hack, hack |
||
28 | local playerName = UnitName("player"); |
||
29 | if ( ButtonHoleConfig[playerName] and |
||
30 | ButtonHoleConfig[playerName].visibleMod == FishingBuddy.ID ) then |
||
31 | ButtonHoleConfig[playerName].visibleMod = nil; |
||
32 | end |
||
33 | end |
||
34 | end |
||
35 | |||
36 | FishingBuddy.Minimap.Button_OnLoad = function() |
||
37 | this:SetFrameLevel(this:GetFrameLevel()+1) |
||
38 | this:RegisterForClicks("LeftButtonDown", "RightButtonDown"); |
||
39 | this:RegisterEvent("VARIABLES_LOADED"); |
||
40 | end |
||
41 | |||
42 | FishingBuddy.Minimap.Button_OnClick = function(button) |
||
43 | if ( button == "RightButton" ) then |
||
44 | -- Toggle menu |
||
45 | local menu = getglobal("FishingBuddyMinimapMenu"); |
||
46 | menu.point = "TOPRIGHT"; |
||
47 | menu.relativePoint = "CENTER"; |
||
48 | local level = 1; |
||
49 | ToggleDropDownMenu(level, nil, menu, "FishingBuddyMinimapButton", 0, 0); |
||
50 | elseif ( FishingBuddy.GetSetting("MinimapClickToSwitch") == 1 ) then |
||
51 | FishingBuddy.Command(FishingBuddy.SWITCH); |
||
52 | else |
||
53 | FishingBuddy.Command(""); |
||
54 | end |
||
55 | end |
||
56 | |||
57 | FishingBuddyMinimapButton_MoveButton = function() |
||
58 | if ( FishingBuddy.IsLoaded() ) then |
||
59 | local where = FishingBuddy.GetSetting("MinimapButtonPosition"); |
||
60 | FishingBuddyMinimapFrame:ClearAllPoints(); |
||
61 | FishingBuddyMinimapFrame:SetPoint("TOPLEFT", "Minimap", "TOPLEFT", |
||
62 | 52 - (80 * cos(where)), |
||
63 | (80 * sin(where)) - 52); |
||
64 | end |
||
65 | end |
||
66 | |||
67 | FishingBuddy.UpdateMinimap = function() |
||
68 | FishingBuddyMinimapButton_MoveButton(); |
||
69 | if ( FishingBuddy.GetSetting("MinimapButtonVisible") == 1 and |
||
70 | Minimap:IsVisible() ) then |
||
71 | FishingBuddyMinimapButton:EnableMouse(true); |
||
72 | FishingBuddyMinimapButton:Show(); |
||
73 | FishingBuddyMinimapFrame:Show(); |
||
74 | else |
||
75 | FishingBuddyMinimapButton:EnableMouse(false); |
||
76 | FishingBuddyMinimapButton:Hide(); |
||
77 | FishingBuddyMinimapFrame:Hide(); |
||
78 | end |
||
79 | end |
||
80 | |||
81 | FishingBuddy.Minimap.Button_OnEvent = function() |
||
82 | FishingBuddy.UpdateMinimap(); |
||
83 | end |
||
84 | |||
85 | FishingBuddy.Minimap.Button_OnEnter = function() |
||
86 | if ( GameTooltip.finished ) then |
||
87 | return; |
||
88 | end |
||
89 | if ( FishingBuddy.GetSetting("UseButtonHole") == 0 ) then |
||
90 | GameTooltip.finished = 1; |
||
91 | GameTooltip:SetOwner(FishingBuddyMinimapFrame, "ANCHOR_LEFT"); |
||
92 | GameTooltip:AddLine(FishingBuddy.NAME); |
||
93 | GameTooltip:AddLine(FishingBuddy.DESCRIPTION,.8,.8,.8,1); |
||
94 | GameTooltip:Show(); |
||
95 | end |
||
96 | end |
||
97 | |||
98 | FishingBuddy.Minimap.Button_OnLeave = function() |
||
99 | GameTooltip:Hide(); |
||
100 | GameTooltip.finished = nil; |
||
101 | end |
||
102 | |||
103 | function FishingBuddy_ToggleMinimap() |
||
104 | FishingBuddy.SavedToggleMinimap(); |
||
105 | FishingBuddy.UpdateMinimap(); |
||
106 | end |
||
107 | |||
108 | FishingBuddy.Minimap.Menu_Initialize = function() |
||
109 | FishingBuddy.MakeDropDown(FishingBuddy.TITAN_CLICKTOSWITCH_ONOFF, |
||
110 | "MinimapClickToSwitch"); |
||
111 | end |
||
112 |