1
1
-- --------------------------------------------------------------------------------
2
2
-- Moncai Compare
3
- -- Copyright (C) 2009-2013 Moncai
3
+ -- Copyright (C) 2009-2014 Moncai
4
4
-- Module for Encounter (Dungeon) Journal
5
5
-- --------------------------------------------------------------------------------
6
6
7
7
local fEncounterJournal_Loot_OnUpdate ;
8
8
9
9
local function JournalHook ()
10
+ -- ~ print("Journalhook");
10
11
11
12
fEncounterJournal_Loot_OnUpdate = EncounterJournal_Loot_OnUpdate ;
12
13
EncounterJournal_Loot_OnUpdate = function (self , elapsed )
13
14
if GameTooltip :IsOwned (self ) then
15
+ -- ~ print("LootOnUpdate");
14
16
-- Show tooltips left always
15
17
GameTooltip :ClearAllPoints ()
16
18
GameTooltip :SetPoint (" BOTTOMRIGHT" , self , " TOPLEFT" )
@@ -24,7 +26,7 @@ local function JournalHook()
24
26
-- ~ self.comparing = nil
25
27
ShoppingTooltip1 :Hide ();
26
28
ShoppingTooltip2 :Hide ();
27
- ShoppingTooltip3 :Hide ();
29
+ -- ShoppingTooltip3:Hide(); --602 removed?
28
30
end
29
31
30
32
if IsModifiedClick (" DRESSUP" ) then
@@ -38,15 +40,22 @@ local function JournalHook()
38
40
for i = 1 , 8 , 1 do
39
41
local eb = _G [" EncounterJournalEncounterFrameInfoLootScrollFrameButton" .. i ]
40
42
if eb then
41
- eb :SetScript (" OnEnter" , function (self ) -- EncounterItemTemplate Blizzard_EncounterJournal.xml:1094
42
- -- ~ print("enter button "..i);
43
+ eb :SetScript (" OnEnter" , function (self ) -- EncounterItemTemplate Blizzard_EncounterJournal.xml: old: 1094 -> 6.0.2: 1136
44
+ -- ~ print("enter button "..i); --MOD
43
45
-- Show tooltips left always
44
- GameTooltip .overrideside = " left"
45
-
46
+ GameTooltip .overrideside = " left" -- EMOD
47
+
46
48
GameTooltip :SetOwner (self , " ANCHOR_LEFT" );
47
- GameTooltip : SetHyperlink (self .link );
49
+ EncounterJournal_SetTooltip (self .link );
48
50
self .showingTooltip = true ;
49
- self :SetScript (" OnUpdate" , EncounterJournal_Loot_OnUpdate );
51
+
52
+ -- ~ if self.itemID then
53
+ -- ~ GameTooltip:SetOwner(self, "ANCHOR_LEFT");
54
+ -- ~ GameTooltip:SetItemByID(self.itemID);
55
+ -- ~ self.showingTooltip = true;
56
+ -- ~ end
57
+
58
+ self :SetScript (" OnUpdate" , EncounterJournal_Loot_OnUpdate ); -- MOD 602 still needed
50
59
end )
51
60
eb :HookScript (" OnLeave" , function (self ) GameTooltip .overrideside = " " end )
52
61
end
55
64
56
65
-- local fGameTooltip_ShowCompareItem = GameTooltip_ShowCompareItem
57
66
function Journal_GameTooltip_ShowCompareItem (self , shift )
67
+ -- ~ print("Journal Compare");
68
+
58
69
if ( not self ) then
59
70
self = GameTooltip ;
60
71
end
61
- local item , link = self :GetItem ();
62
- if ( not link ) then
63
- return ;
72
+
73
+ if ( self .needsReset ) then
74
+ self :ResetSecondaryCompareItem ();
75
+ GameTooltip_AdvanceSecondaryCompareItem (self );
76
+ self .needsReset = false ;
64
77
end
65
78
66
- local shoppingTooltip1 , shoppingTooltip2 , shoppingTooltip3 = unpack (self .shoppingTooltips );
79
+ local shoppingTooltip1 , shoppingTooltip2 = unpack (self .shoppingTooltips );
67
80
68
- local item1 = nil ;
69
- local item2 = nil ;
70
- local item3 = nil ;
71
- local side = " left" ;
72
- if ( shoppingTooltip1 :SetHyperlinkCompareItem (link , 1 , shift , self ) ) then
73
- item1 = true ;
74
- end
75
- if ( shoppingTooltip2 :SetHyperlinkCompareItem (link , 2 , shift , self ) ) then
76
- item2 = true ;
77
- end
78
- if ( shoppingTooltip3 :SetHyperlinkCompareItem (link , 3 , shift , self ) ) then
79
- item3 = true ;
80
- end
81
+ local primaryItemShown , secondaryItemShown = shoppingTooltip1 :SetCompareItem (shoppingTooltip2 , self );
81
82
83
+ local side = " left" ;
84
+
82
85
-- find correct side
83
86
local rightDist = 0 ;
84
87
local leftPos = self :GetLeft ();
@@ -98,30 +101,21 @@ function Journal_GameTooltip_ShowCompareItem(self, shift)
98
101
side = " right" ;
99
102
end
100
103
101
- if self .overrideside then
104
+ if self .overrideside then -- MOD
102
105
-- ~ print("force side " .. self.overrideside)
103
106
side = self .overrideside
104
107
-- ~ else
105
108
-- ~ print("standard side")
106
- end
109
+ end -- EMOD
107
110
108
111
-- see if we should slide the tooltip
109
112
if ( self :GetAnchorType () and self :GetAnchorType () ~= " ANCHOR_PRESERVE" ) then
110
113
local totalWidth = 0 ;
111
- if ( item1 ) then
112
- shoppingTooltip1 :Show () -- need to show to get correct width...
114
+ if ( primaryItemShown ) then
113
115
totalWidth = totalWidth + shoppingTooltip1 :GetWidth ();
114
- -- ~ print("tip 1 width " .. shoppingTooltip1:GetWidth())
115
116
end
116
- if ( item2 ) then
117
- shoppingTooltip2 :Show ()
117
+ if ( secondaryItemShown ) then
118
118
totalWidth = totalWidth + shoppingTooltip2 :GetWidth ();
119
- -- ~ print("tip 2 width " .. shoppingTooltip2:GetWidth())
120
- end
121
- if ( item3 ) then
122
- shoppingTooltip3 :Show ()
123
- totalWidth = totalWidth + shoppingTooltip3 :GetWidth ();
124
- -- ~ print("tip 3 width " .. shoppingTooltip3:GetWidth())
125
119
end
126
120
127
121
if ( (side == " left" ) and (totalWidth > leftPos ) ) then
@@ -130,55 +124,40 @@ function Journal_GameTooltip_ShowCompareItem(self, shift)
130
124
self :SetAnchorType (self :GetAnchorType (), - ((rightPos + totalWidth ) - GetScreenWidth ()), 0 );
131
125
end
132
126
end
133
-
134
- -- anchor the compare tooltips
135
- if ( item3 ) then
136
- shoppingTooltip3 :SetOwner (self , " ANCHOR_NONE" );
137
- shoppingTooltip3 :ClearAllPoints ();
127
+
128
+ if ( secondaryItemShown ) then
129
+ shoppingTooltip2 :SetOwner (self , " ANCHOR_NONE" );
130
+ shoppingTooltip2 :ClearAllPoints ();
138
131
if ( side and side == " left" ) then
139
- shoppingTooltip3 :SetPoint (" TOPRIGHT" , self , " TOPLEFT" , 0 , - 10 );
132
+ shoppingTooltip2 :SetPoint (" TOPRIGHT" , self , " TOPLEFT" , 0 , - 10 );
140
133
else
141
- shoppingTooltip3 :SetPoint (" TOPLEFT" , self , " TOPRIGHT" , 0 , - 10 );
134
+ shoppingTooltip2 :SetPoint (" TOPLEFT" , self , " TOPRIGHT" , 0 , - 10 );
142
135
end
143
- shoppingTooltip3 :SetHyperlinkCompareItem (link , 3 , shift , self );
144
- shoppingTooltip3 :Show ();
145
- end
146
-
147
- if ( item1 ) then
148
- if ( item3 ) then
149
- shoppingTooltip1 :SetOwner (shoppingTooltip3 , " ANCHOR_NONE" );
136
+
137
+ shoppingTooltip1 :SetOwner (self , " ANCHOR_NONE" );
138
+ shoppingTooltip1 :ClearAllPoints ();
139
+
140
+ if ( side and side == " left" ) then
141
+ shoppingTooltip1 :SetPoint (" TOPRIGHT" , shoppingTooltip2 , " TOPLEFT" );
150
142
else
151
- shoppingTooltip1 :SetOwner ( self , " ANCHOR_NONE " );
143
+ shoppingTooltip1 :SetPoint ( " TOPLEFT " , shoppingTooltip2 , " TOPRIGHT " );
152
144
end
145
+ else
146
+ shoppingTooltip1 :SetOwner (self , " ANCHOR_NONE" );
153
147
shoppingTooltip1 :ClearAllPoints ();
148
+
154
149
if ( side and side == " left" ) then
155
- if ( item3 ) then
156
- shoppingTooltip1 :SetPoint (" TOPRIGHT" , shoppingTooltip3 , " TOPLEFT" , 0 , 0 );
157
- else
158
- shoppingTooltip1 :SetPoint (" TOPRIGHT" , self , " TOPLEFT" , 0 , - 10 );
159
- end
150
+ shoppingTooltip1 :SetPoint (" TOPRIGHT" , self , " TOPLEFT" , 0 , - 10 );
160
151
else
161
- if ( item3 ) then
162
- shoppingTooltip1 :SetPoint (" TOPLEFT" , shoppingTooltip3 , " TOPRIGHT" , 0 , 0 );
163
- else
164
- shoppingTooltip1 :SetPoint (" TOPLEFT" , self , " TOPRIGHT" , 0 , - 10 );
165
- end
152
+ shoppingTooltip1 :SetPoint (" TOPLEFT" , self , " TOPRIGHT" , 0 , - 10 );
166
153
end
167
- shoppingTooltip1 :SetHyperlinkCompareItem (link , 1 , shift , self );
168
- shoppingTooltip1 :Show ();
169
154
170
- if ( item2 ) then
171
- shoppingTooltip2 :SetOwner (shoppingTooltip1 , " ANCHOR_NONE" );
172
- shoppingTooltip2 :ClearAllPoints ();
173
- if ( side and side == " left" ) then
174
- shoppingTooltip2 :SetPoint (" TOPRIGHT" , shoppingTooltip1 , " TOPLEFT" , 0 , 0 );
175
- else
176
- shoppingTooltip2 :SetPoint (" TOPLEFT" , shoppingTooltip1 , " TOPRIGHT" , 0 , 0 );
177
- end
178
- shoppingTooltip2 :SetHyperlinkCompareItem (link , 2 , shift , self );
179
- shoppingTooltip2 :Show ();
180
- end
155
+ shoppingTooltip2 :Hide ();
181
156
end
157
+
158
+ -- We have to call this again because :SetOwner clears the tooltip.
159
+ shoppingTooltip1 :SetCompareItem (shoppingTooltip2 , self );
160
+ shoppingTooltip1 :Show ();
182
161
end
183
162
184
163
hooksecurefunc (" EncounterJournal_LoadUI" , JournalHook )
0 commit comments