vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 local GREY = "|cff999999";
2 local RED = "|cffff0000";
3 local WHITE = "|cffFFFFFF";
4 local GREEN = "|cff1eff00";
5 local PURPLE = "|cff9F3FFF";
6 local BLUE = "|cff0070dd";
7 local ORANGE = "|cffFF8400";
8  
9 --------------------------------------------------------------------------------
10 -- Item OnEnter
11 -- Called when a loot item is moused over
12 --------------------------------------------------------------------------------
13 function AtlasLootItem_OnEnter()
14 local yOffset;
15 if(this.itemID ~= 0 and this.itemID ~= "" and this.itemID ~= nil) then
16 Identifier = "Item"..this.itemID;
17 DKP = AtlasLootDKPValues[Identifier];
18 priority = AtlasLootClassPriority[Identifier];
19 else
20 DKP = nil;
21 priority = nil;
22 end
23 --Lootlink tooltips
24 if( AtlasLootOptions.LootlinkTT ) then
25 --If we have seen the item, use the game tooltip to minimise same name item problems
26 if(GetItemInfo(this.itemID) ~= nil) then
27 AtlasLootTooltip:SetOwner(this, "ANCHOR_RIGHT", -(this:GetWidth() / 2), 24);
28 AtlasLootTooltip:SetHyperlink("item:"..this.itemID..":0:0:0");
29 if( this.droprate ~= nil) then
30 AtlasLootTooltip:AddLine(ATLASLOOT_DROP_RATE..this.droprate, 1, 1, 0);
31 end
32 if( DKP ~= nil and DKP ~= "" ) then
33 AtlasLootTooltip:AddLine(RED..DKP.." "..ATLASLOOT_DKP, 1, 1, 0);
34 end
35 if( priority ~= nil and priority ~= "" ) then
36 AtlasLootTooltip:AddLine(GREEN..ATLASLOOT_PRIORITY.." "..priority, 1, 1, 0);
37 end
38 AtlasLootTooltip:Show();
39 else
40 AtlasLootTooltip:SetOwner(this, "ANCHOR_RIGHT", -(this:GetWidth() / 2), 24);
41 LootLink_SetTooltip(AtlasLootTooltip, strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 11), 1);
42 if( this.droprate ~= nil) then
43 AtlasLootTooltip:AddLine(ATLASLOOT_DROP_RATE..this.droprate, 1, 1, 0);
44 end
45 if( DKP ~= nil and DKP ~= "" ) then
46 AtlasLootTooltip:AddLine(RED..DKP.." "..ATLASLOOT_DKP, 1, 1, 0);
47 end
48 if( priority ~= nil and priority ~= "" ) then
49 AtlasLootTooltip:AddLine(GREEN..ATLASLOOT_PRIORITY.." "..priority, 1, 1, 0);
50 end
51 AtlasLootTooltip:Show();
52 end
53 --Item Sync tooltips
54 elseif( AtlasLootOptions.ItemSyncTT ) then
55 ISync:ButtonEnter();
56 if( this.droprate ~= nil) then
57 GameTooltip:AddLine(ATLASLOOT_DROP_RATE..this.droprate, 1, 1, 0);
58 GameTooltip:Show();
59 end
60 if( DKP ~= nil and DKP ~= "" ) then
61 AtlasLootTooltip:AddLine(RED..DKP.." "..ATLASLOOT_DKP, 1, 1, 0);
62 end
63 if( priority ~= nil and priority ~= "" ) then
64 AtlasLootTooltip:AddLine(GREEN..ATLASLOOT_PRIORITY.." "..priority, 1, 1, 0);
65 end
66 --Default game tooltips
67 else
68 if(this.itemID ~= nil) then
69 if(GetItemInfo(this.itemID) ~= nil) then
70 AtlasLootTooltip:SetOwner(this, "ANCHOR_RIGHT", -(this:GetWidth() / 2), 24);
71 AtlasLootTooltip:SetHyperlink("item:"..this.itemID..":0:0:0");
72 if( this.droprate ~= nil) then
73 AtlasLootTooltip:AddLine(ATLASLOOT_DROP_RATE..this.droprate, 1, 1, 0);
74 end
75 if( DKP ~= nil and DKP ~= "" ) then
76 AtlasLootTooltip:AddLine(RED..DKP.." "..ATLASLOOT_DKP, 1, 1, 0);
77 end
78 if( priority ~= nil and priority ~= "" ) then
79 AtlasLootTooltip:AddLine(GREEN..ATLASLOOT_PRIORITY.." "..priority, 1, 1, 0);
80 end
81 AtlasLootTooltip:Show();
82 else
83 AtlasLootTooltip:SetOwner(this, "ANCHOR_RIGHT", -(this:GetWidth() / 2), 24);
84 AtlasLootTooltip:ClearLines();
85 AtlasLootTooltip:AddLine(RED..ATLASLOOT_ERRORTOOLTIP_L1);
86 AtlasLootTooltip:AddLine(BLUE..ATLASLOOT_ERRORTOOLTIP_L2.." "..this.itemID);
87 AtlasLootTooltip:AddLine(ATLASLOOT_ERRORTOOLTIP_L3);
88 AtlasLootTooltip:Show();
89 end
90 end
91 end
92 end
93  
94 --------------------------------------------------------------------------------
95 -- Item OnLeave
96 -- Called when the mouse cursor leaves a loot item
97 --------------------------------------------------------------------------------
98 function AtlasLootItem_OnLeave()
99 --Hide the necessary tooltips
100 if( AtlasLootOptions.LootlinkTT ) then
101 AtlasLootTooltip:Hide();
102 elseif( AtlasLootOptions.ItemSyncTT ) then
103 if(GameTooltip:IsVisible()) then
104 GameTooltip:Hide();
105 end
106 else
107 if(this.itemID ~= nil) then
108 AtlasLootTooltip:Hide();
109 GameTooltip:Hide();
110 end
111 end
112 end
113  
114 --------------------------------------------------------------------------------
115 -- Item OnClick
116 -- Called when a loot item is clicked on
117 --------------------------------------------------------------------------------
118 function AtlasLootItem_OnClick()
119 local color = strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 1, 10);
120 local id = this:GetID();
121 local name = strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 11);
122 local iteminfo = GetItemInfo(this.itemID);
123 --If shift-clicked, link in the chat window
124 if(ChatFrameEditBox:IsVisible() and IsShiftKeyDown() and iteminfo and (AtlasLootOptions.SafeLinks or AtlasLootOptions.AllLinks)) then
125 ChatFrameEditBox:Insert(color.."|Hitem:"..this.itemID..":0:0:0|h["..name.."]|h|r");
126 elseif(ChatFrameEditBox:IsVisible() and IsShiftKeyDown() and AtlasLootOptions.AllLinks) then
127 ChatFrameEditBox:Insert(color.."|Hitem:"..this.itemID..":0:0:0|h["..name.."]|h|r");
128 elseif(ChatFrameEditBox:IsVisible()) then
129 ChatFrameEditBox:Insert(name);
130 --If control-clicked, use the dressing room
131 elseif(IsControlKeyDown() and iteminfo) then
132 DressUpItemLink(this.itemID);
133 end
134 end