vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | BRollBar |
||
3 | A movable frame for rolling on items |
||
4 | --]] |
||
5 | |||
6 | local function RollFrame_OnShow() |
||
7 | local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(this.rollID); |
||
8 | |||
9 | if bindOnPickUp then |
||
10 | this:SetBackdrop({bgFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border", tile = true, tileSize = 32, edgeSize = 32, insets = { left = 11, right = 12, top = 12, bottom = 11 } } ); |
||
11 | getglobal(this:GetName().."Corner"):SetTexture("Interface\\DialogFrame\\UI-DialogBox-Gold-Corner"); |
||
12 | getglobal(this:GetName().."Decoration"):Show(); |
||
13 | else |
||
14 | this:SetBackdrop({bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 32, edgeSize = 32, insets = { left = 11, right = 12, top = 12, bottom = 11 } } ); |
||
15 | getglobal(this:GetName().."Corner"):SetTexture("Interface\\DialogFrame\\UI-DialogBox-Corner"); |
||
16 | getglobal(this:GetName().."Decoration"):Hide(); |
||
17 | end |
||
18 | |||
19 | getglobal("BRollBarFrame"..this:GetID().."IconFrameIcon"):SetTexture(texture); |
||
20 | getglobal("BRollBarFrame"..this:GetID().."Name"):SetText(name); |
||
21 | |||
22 | local color = ITEM_QUALITY_COLORS[quality]; |
||
23 | getglobal("BRollBarFrame"..this:GetID().."Name"):SetVertexColor(color.r, color.g, color.b); |
||
24 | end |
||
25 | |||
26 | local function RollFrame_OpenNewFrame(id, rollTime) |
||
27 | local frame; |
||
28 | for i=1, NUM_GROUP_LOOT_FRAMES do |
||
29 | frame = getglobal("BRollBarFrame"..i); |
||
30 | if ( not frame:IsVisible() ) then |
||
31 | frame.rollID = id; |
||
32 | frame.rollTime = rollTime; |
||
33 | getglobal("BRollBarFrame"..i.."Timer"):SetMinMaxValues(0, rollTime); |
||
34 | frame:Show(); |
||
35 | return; |
||
36 | end |
||
37 | end |
||
38 | end |
||
39 | |||
40 | --[[ Config Functions ]]-- |
||
41 | |||
42 | local function CreateConfigMenu(name) |
||
43 | local menu = CreateFrame("Button", name, UIParent, "BongosRightClickMenu"); |
||
44 | menu:SetWidth(220); |
||
45 | menu:SetHeight(150); |
||
46 | menu:SetText("Roll Bar"); |
||
47 | |||
48 | local cantHide = menu:CreateFontString(); |
||
49 | cantHide:SetFontObject("GameFontNormal"); |
||
50 | cantHide:SetPoint("TOPLEFT", menu, "TOPLEFT", 12, -32); |
||
51 | cantHide:SetText("Will Be Hidden When Locked"); |
||
52 | |||
53 | local scaleSlider = CreateFrame("Slider", name .. "Scale", menu, "BongosScaleSlider"); |
||
54 | scaleSlider:SetPoint("TOPLEFT", cantHide, "BOTTOMLEFT", -2, -24); |
||
55 | |||
56 | local opacitySlider = CreateFrame("Slider", name .. "Opacity", menu, "BongosOpacitySlider"); |
||
57 | opacitySlider:SetPoint("TOP", scaleSlider, "BOTTOM", 0, -24); |
||
58 | end |
||
59 | |||
60 | local function ShowMenu(bar) |
||
61 | if(not BongosRollBarMenu) then |
||
62 | CreateConfigMenu("BongosRollBarMenu"); |
||
63 | end |
||
64 | |||
65 | BongosRollBarMenu.onShow = 1; |
||
66 | BongosRollBarMenu.frame = bar; |
||
67 | |||
68 | BongosRollBarMenuScale:SetValue( bar:GetScale() * 100 ); |
||
69 | BongosRollBarMenuOpacity:SetValue( bar:GetAlpha() * 100 ); |
||
70 | |||
71 | BMenu.ShowMenuForBar(BongosRollBarMenu, bar); |
||
72 | BongosRollBarMenu.onShow = nil; |
||
73 | end |
||
74 | |||
75 | --[[ Startup ]]-- |
||
76 | BScript.AddStartupAction(function() |
||
77 | local bar = BBar.Create("roll", "BRollBar", "BRollBarSets", ShowMenu, 1); |
||
78 | bar:SetWidth(340); |
||
79 | bar:SetHeight(472); |
||
80 | if not bar:IsUserPlaced() then |
||
81 | bar:SetPoint("LEFT", UIParent, "LEFT"); |
||
82 | end |
||
83 | |||
84 | if not getglobal("BRollBarFrame1") then |
||
85 | for i=1, NUM_GROUP_LOOT_FRAMES do |
||
86 | getglobal("GroupLootFrame"..i):UnregisterAllEvents(); |
||
87 | end |
||
88 | GroupLootFrame_OpenNewFrame = RollFrame_OpenNewFrame; |
||
89 | |||
90 | local rollFrame1 = CreateFrame("Frame", "BRollBarFrame1", bar, "GroupLootFrameTemplate"); |
||
91 | rollFrame1:SetPoint("BOTTOMLEFT", BRollBar, "BOTTOMLEFT", 4, 2); |
||
92 | rollFrame1:SetScript("OnShow", RollFrame_OnShow); |
||
93 | rollFrame1:SetID(1); |
||
94 | |||
95 | for i=2, NUM_GROUP_LOOT_FRAMES do |
||
96 | local rollFrame = CreateFrame("Frame", "BRollBarFrame" .. i, bar, "GroupLootFrameTemplate"); |
||
97 | rollFrame:SetPoint("BOTTOM", "BRollBarFrame" .. (i-1), "TOP", 0, 3); |
||
98 | rollFrame:SetScript("OnShow", RollFrame_OnShow); |
||
99 | rollFrame:SetID(i); |
||
100 | end |
||
101 | end |
||
102 | end) |