vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[--------------------------------------------------------------------------------
2 ItemSyncCore Parse Framework
3  
4 Author: Derkyle
5 Website: http://www.manaflux.com
6 -----------------------------------------------------------------------------------]]
7  
8  
9 ---------------------------------------------------
10 -- ISync:Do_Parse()
11 ---------------------------------------------------
12 function ISync:Do_Parse(sFrame, sToolTip, sID, sLinkID)
13  
14 if(not ISyncDB) then return nil; end
15 if(not ISyncDB[ISYNC_REALM_NUM]) then return nil; end
16 if(not ISyncDB[ISYNC_REALM_NUM][sID]) then return nil; end
17  
18 sFrame.TooltipButton = 1;
19 sToolTip:ClearLines();
20 sToolTip:SetOwner(UIParent, "ANCHOR_BOTTOMRIGHT");
21 sToolTip:SetHyperlink(sLinkID);
22 ISync:ParseTooltip(sID, sLinkID);
23 sToolTip:Hide();
24  
25 end
26  
27  
28 ---------------------------------------------------
29 -- ISync:ParseTooltip()
30 ---------------------------------------------------
31 function ISync:ParseTooltip(sID, sLinkID)
32  
33 if(not sID) then return nil; end
34 if(not tonumber(sID)) then return nil; end
35 if(not ISync:FetchDB(tonumber(sID), "chk")) then return nil; end
36  
37 sID = tonumber(sID); --convert
38  
39 local sTipLeft;
40 local sTipRight;
41 local sParseLink;
42  
43 sTipLeft = "ISyncTooltipTextLeft";
44 sTipRight = "ISyncTooltipTextRight";
45  
46 --make sure we have tooltip info to work with
47 if(not sTipLeft or not sTipRight) then return; end
48  
49  
50 --begin the loop with the amount of lines in the tooltip
51 for index = 1, ISyncTooltip:NumLines(), 1 do
52  
53 --get the tooltip left information
54 field = getglobal(sTipLeft..index);
55 if( field and field:IsVisible() ) then
56 left = field:GetText();
57 else
58 left = nil;
59 end
60  
61 --get the tooltip right information
62 field = getglobal(sTipRight..index);
63 if( field and field:IsVisible() ) then
64 right = field:GetText();
65 else
66 right = nil;
67 end
68  
69 --do item locations / weapon locations
70 if(left and ISYNC_WeaponLocation[left] ~= nil) then
71  
72 --when the weapon occasionally shows on the right
73 --we need to compensate for this
74 if(left == ISYNC_CROSSBOW_TEXT) then
75  
76 --store the special weapon type
77 if(not ISync:FetchDB(sID, "wt")) then
78  
79 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
80  
81 --if it doesn't match the one stored then update it
82 elseif(not ISync:FetchDB(sID, "wt", ISYNC_WeaponTypes[left])) then
83  
84 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
85 end
86  
87  
88 elseif(left == ISYNC_GUN_TEXT) then
89  
90  
91 --store the special weapon type
92 if(not ISync:FetchDB(sID, "wt")) then
93  
94 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
95  
96 --if it doesn't match the one stored then update it
97 elseif(not ISync:FetchDB(sID, "wt", ISYNC_WeaponTypes[left])) then
98  
99 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
100 end
101  
102  
103 elseif(left == ISYNC_THROWN_TEXT) then
104  
105  
106 --store the special weapon type
107 if(not ISync:FetchDB(sID, "wt")) then
108  
109 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
110  
111 --if it doesn't match the one stored then update it
112 elseif(not ISync:FetchDB(sID, "wt", ISYNC_WeaponTypes[left])) then
113  
114 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
115 end
116  
117  
118 elseif(left == ISYNC_WAND_TEXT) then
119  
120  
121 --store the special weapon type
122 if(not ISync:FetchDB(sID, "wt")) then
123  
124 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
125  
126 --if it doesn't match the one stored then update it
127 elseif(not ISync:FetchDB(sID, "wt", ISYNC_WeaponTypes[left])) then
128  
129 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[left]);
130 end
131  
132  
133 else --it's not a special case
134  
135  
136 --THIS IS WEAPON LOCATION NOT WEAPON TYPE!
137 if(not ISync:FetchDB(sID, "wl")) then
138  
139 ISync:SetDB(sID, "wl", ISYNC_WeaponLocation[left]);
140  
141 --if it doesn't match the one stored then update it
142 elseif(not ISync:FetchDB(sID, "wl", ISYNC_WeaponLocation[left])) then
143  
144 ISync:SetDB(sID, "wl", ISYNC_WeaponLocation[left]);
145 end
146  
147  
148 end
149  
150  
151  
152 end
153  
154 --do weapon types
155 if(right and ISYNC_WeaponTypes[right] ~= nil) then
156  
157  
158 if(not ISync:FetchDB(sID, "wt")) then
159  
160 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[right]);
161  
162 --if it doesn't match the one stored then update it
163 elseif(not ISync:FetchDB(sID, "wt", ISYNC_WeaponTypes[right])) then
164  
165 ISync:SetDB(sID, "wt", ISYNC_WeaponTypes[right]);
166 end
167  
168 end
169  
170  
171 --grab the level requirement for items or tradeskills
172 if(left) then
173 _, _, sVariable1 = string.find(left, ISYNC_REQUIRE_FIND);
174  
175 if( sVariable1 and sLinkID) then
176  
177 local _, _, _, minLevel_X = GetItemInfo(sLinkID);
178  
179 _, _, sLVLVariable1 = string.find(sVariable1, ISYNC_REQUIRE_FIND2); --check for level requirement
180  
181  
182 if( sLVLVariable1 ) then
183  
184 --NEW LVL GRAB (MAKE SURE IT ISN'T A PATTERN (we want to be able to find craftable items using lvlrange)
185 if(minLevel_X and not ISync:FetchDB(sID, "level")) then
186  
187 ISync:SetDB(sID, "level", minLevel_X);
188  
189 --it doesn't match so store new one
190 elseif(minLevel_X and not ISync:FetchDB(sID, "level", minLevel_X)) then
191  
192 ISync:SetDB(sID, "level", minLevel_X);
193  
194 elseif(minLevel_X and ISync:FetchDB(sID, "level", minLevel_X)) then
195  
196 --do nothing otherwise it will loop over and over again cause the bottom two elseif's will check
197 --what we parsed, rather what we grabbed with getiteminfo
198  
199 --store the grabbed one
200 elseif(sLVLVariable1 and not ISync:FetchDB(sID, "level")) then
201  
202 ISync:SetDB(sID, "level", sLVLVariable1);
203  
204 --if it doesn't match the one stored then update it
205 elseif(sLVLVariable1 and not ISync:FetchDB(sID, "level", sLVLVariable1)) then
206  
207 ISync:SetDB(sID, "level", sLVLVariable1);
208 end
209  
210  
211  
212 else
213  
214 --this is for tradeskill and number required
215  
216 _, _, sVariable2, sVariable3 = string.find(sVariable1, ISYNC_REQUIRE_FIND3);
217  
218 if( sVariable2 and sVariable3 and ISYNC_TradeSkills[sVariable2] ~= nil ) then
219  
220  
221 if(not ISync:FetchDB(sID, "ts")) then
222  
223 ISync:SetDB(sID, "ts", ISYNC_TradeSkills[sVariable2]);
224  
225 --if it doesn't match the one stored then update it
226 elseif(not ISync:FetchDB(sID, "ts", ISYNC_TradeSkills[sVariable2])) then
227  
228 ISync:SetDB(sID, "ts", ISYNC_TradeSkills[sVariable2]);
229 end
230  
231 end
232  
233  
234  
235 end--end check for level requirement
236  
237  
238 end--end variable 1 check
239  
240  
241 end
242  
243  
244  
245 --do armor types
246 if(right and ISYNC_ArmorTypes[right] ~= nil) then
247  
248  
249 if(not ISync:FetchDB(sID, "at")) then
250  
251 ISync:SetDB(sID, "at", ISYNC_ArmorTypes[right]);
252  
253 --if it doesn't match the one stored then update it
254 elseif(not ISync:FetchDB(sID, "at", ISYNC_ArmorTypes[right])) then
255  
256 ISync:SetDB(sID, "at", ISYNC_ArmorTypes[right]);
257 end
258  
259  
260 end
261  
262  
263 --do shield types
264 if(right and ISYNC_ShieldTypes[right] ~= nil) then
265  
266  
267 if(not ISync:FetchDB(sID, "st")) then
268  
269 ISync:SetDB(sID, "st", ISYNC_ShieldTypes[right]);
270  
271 --if it doesn't match the one stored then update it
272 elseif(not ISync:FetchDB(sID, "st", ISYNC_ShieldTypes[right])) then
273  
274 ISync:SetDB(sID, "st", ISYNC_ShieldTypes[right]);
275 end
276  
277  
278 end
279  
280  
281  
282 --------------------------------------------------------
283 --------------------------------------------------------
284 end --end for
285 --------------------------------------------------------
286 --------------------------------------------------------
287  
288  
289 end