vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Various functions both Group and Monitor share |
2 | |||
3 | local _G = getfenv(0) |
||
4 | |||
5 | function XLoot:QualityColorRow(row, quality) |
||
6 | if quality == "coin" then |
||
7 | row.border:Hide() |
||
8 | row.button.border:Hide() |
||
9 | row:SetBackdropBorderColor(unpack(XLoot.db.profile.lootbordercolor)) |
||
10 | row.button:SetBackdropBorderColor(unpack(XLoot.db.profile.lootbordercolor)) |
||
11 | row.button.wrapper:SetBackdropBorderColor(unpack(XLoot.db.profile.lootbordercolor)) |
||
12 | else |
||
13 | local r, g, b, hex = GetItemQualityColor(quality) |
||
14 | if quality >= XLoot.db.profile.loothighlightthreshold then |
||
15 | if XLoot.db.profile.texcolor then |
||
16 | row.button.border:SetVertexColor(r, g, b, .5) |
||
17 | row.button.border:Show() |
||
18 | else button.border:Hide() end |
||
19 | if XLoot.db.profile.loothighlightframe and not row.status then |
||
20 | row.border:SetVertexColor(r, g, b, .3) |
||
21 | row.border:Show() |
||
22 | else row.border:Hide() end |
||
23 | else |
||
24 | row.button.border:Hide() |
||
25 | row.border:Hide() |
||
26 | end |
||
27 | if XLoot.db.profile.lootqualityborder then |
||
28 | row:SetBackdropBorderColor(r, g, b, 1) |
||
29 | row.button:SetBackdropBorderColor(r, g, b, 1) |
||
30 | row.button.wrapper:SetBackdropBorderColor(r, g, b, 1) |
||
31 | else |
||
32 | row:SetBackdropBorderColor(unpack(XLoot.db.profile.lootbordercolor)) |
||
33 | row.button:SetBackdropBorderColor(unpack(XLoot.db.profile.lootbordercolor)) |
||
34 | row.button.wrapper:SetBackdropBorderColor(unpack(XLoot.db.profile.lootbordercolor)) |
||
35 | end |
||
36 | if row.status then |
||
37 | row.status:SetStatusBarColor(r, g, b, .7) |
||
38 | end |
||
39 | end |
||
40 | end |
||
41 | |||
42 | function XLoot:OnRowClick(button, stack, row, AA) |
||
43 | if button == "LeftButton" then |
||
44 | if ( IsControlKeyDown() ) then |
||
45 | DressUpItemLink(row.link); |
||
46 | elseif ( IsShiftKeyDown() ) then |
||
47 | if ( ChatFrameEditBox:IsVisible() ) then |
||
48 | ChatFrameEditBox:Insert(row.link); |
||
49 | end |
||
50 | end |
||
51 | elseif button == "RightButton" and not IsControlKeyDown() and not IsShiftKeyDown() and row.candismiss then |
||
52 | AA:PopRow(stack, row.id, nil, nil, 0.3, function() AA:Restack(stack) end) |
||
53 | end |
||
54 | end |
||
55 | |||
56 | function XLoot:SizeRow(stack, row) |
||
57 | local row = row |
||
58 | local playerwidth, lootwidth, rollswidth = row.fsplayer:GetStringWidth(), row.fsloot:GetStringWidth(), (row.bgreed and XLootGroup.db.profile.buttonscale or 0) |
||
59 | local framewidth = playerwidth+lootwidth+rollswidth |
||
60 | row:SetWidth(framewidth+38+(row.sizeoffset or 0)) |
||
61 | XLoot:QualityBorderResize(row, 1.76, 1.34, 2, 1) |
||
62 | end |
||
63 | |||
64 | |||
65 | function XLoot:GenericItemRow(stack, id, AA) |
||
66 | local row = CreateFrame("Frame", "XLRow"..stack.name..id, UIParent) |
||
67 | local button = CreateFrame("Button", "XLRowButton"..stack.name..id, row, "ItemButtonTemplate") |
||
68 | button:EnableMouse(false) |
||
69 | _G[button:GetName().."NormalTexture"]:SetWidth(66) |
||
70 | _G[button:GetName().."NormalTexture"]:SetHeight(66) |
||
71 | local overlay = CreateFrame("Button", "XLMonitorRowOverlay"..stack.name..id, row) |
||
72 | row.overlay = overlay |
||
73 | |||
74 | row.fsplayer = row:CreateFontString("XLRow"..stack.name..id.."Player", "ARTWORK", "GameFontNormalSmall") |
||
75 | row.fsloot = row:CreateFontString("XLRow"..stack.name..id.."Loot", "ARTWORK", "GameFontNormalSmall") |
||
76 | row.fsextra = row:CreateFontString("XLRow"..stack.name..id.."Extra", "ARTWORK", "GameFontNormalSmall") |
||
77 | |||
78 | row:SetWidth(316) |
||
79 | row:SetHeight(22) |
||
80 | button:SetScale(.55) |
||
81 | button:ClearAllPoints() |
||
82 | button:SetPoint("LEFT", row, "LEFT", 5, 0) |
||
83 | button:Disable() |
||
84 | overlay:ClearAllPoints() |
||
85 | overlay:SetAllPoints(row) |
||
86 | row.fsplayer:SetHeight(16) |
||
87 | row.fsloot:SetHeight(16) |
||
88 | row.fsplayer:ClearAllPoints() |
||
89 | row.fsplayer:SetPoint("LEFT", button, "RIGHT", 3, 0) |
||
90 | row.fsloot:ClearAllPoints() |
||
91 | row.fsloot:SetPoint("LEFT", row.fsplayer, "RIGHT", 2, 0) |
||
92 | row.fsplayer:SetJustifyH("LEFT") |
||
93 | row.fsloot:SetJustifyH("LEFT") |
||
94 | row.fsextra:SetHeight(16) |
||
95 | row.fsextra:ClearAllPoints() |
||
96 | row.fsextra:SetPoint("RIGHT", button, "LEFT") |
||
97 | row.fsextra:SetJustifyH("RIGHT") |
||
98 | |||
99 | overlay:RegisterForDrag("LeftButton") |
||
100 | overlay:RegisterForClicks("LeftButtonUp", "RightButtonUp") |
||
101 | overlay:SetScript("OnDragStart", function() AA:DragStart(stack, row) end) |
||
102 | overlay:SetScript("OnDragStop", function() AA:DragStop(stack, row) end) |
||
103 | overlay:SetScript("OnClick", function(button) XLoot:OnRowClick(arg1, stack, row, AA) end) |
||
104 | overlay:SetScript("OnEnter", function() if row.itemid then GameTooltip:SetOwner(row.fsloot, "ANCHOR_TOPLEFT"); GameTooltip:SetHyperlink(row.itemid); CursorUpdate(); end end ) |
||
105 | overlay:SetScript("OnHide", function() AA:OnRowHide(stack, row) end) |
||
106 | overlay:SetScript("OnLeave", function() GameTooltip:Hide(); ResetCursor(); end) |
||
107 | overlay:SetScript("OnUpdate", function() CursorOnUpdate(); end) |
||
108 | |||
109 | button.wrapper = XLoot:ItemButtonWrapper(button, 9, 9, 20) |
||
110 | row.border = XLoot:QualityBorder(row) |
||
111 | button.border = XLoot:QualityBorder(button.wrapper) |
||
112 | XLoot:QualityBorderResize(button.wrapper, 1.6, 1.6, 0, 1) |
||
113 | button:Show() |
||
114 | button:SetAlpha(1) |
||
115 | |||
116 | XLoot:Skin(row) |
||
117 | |||
118 | row.candismiss = true |
||
119 | row.sizeoffset = 0 |
||
120 | |||
121 | row.button = button |
||
122 | row.id = id |
||
123 | |||
124 | row:Hide() |
||
125 | stack.rows[id] = row |
||
126 | |||
127 | stack.built = table.getn(stack.rows) |
||
128 | return row |
||
129 | end |