vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2  
3 local overlayers = {};
4  
5 local current_locx;
6 local current_locy;
7 local current_locx_xact;
8 local current_locy_xact;
9 local current_frame;
10 local current_lm;
11 local current_viewframe;
12 local known_frames = {};
13  
14 function YAOverlay_Register(...)
15 overlayers[arg[1]] = arg;
16 end
17  
18 function YAOverlay_ForceUpdate(self)
19 if( not self) then
20 for h,v in pairs(known_frames) do
21 YAOverlay_OnMapChange(getglobal(h));
22 YAOverlay_OnMove(getglobal(h), unpack(YatlasOptions.Frames[h].Location));
23 end
24 else
25 YAOverlay_OnMapChange(self);
26 YAOverlay_OnMove(self, unpack(YatlasOptions.Frames[self:GetName()].Location));
27 end
28 end
29  
30 function YAOverlay_OnMapChange(self)
31 local lm = self:GetName();
32 self.overlays = {};
33  
34 known_frames[lm] = 1;
35 current_frame = self;
36  
37 local h = 1;
38 while h > 0 do
39 local kid = getglobal(lm.."OBGTexture"..h);
40 local pa = getglobal(lm.."OTexture"..h);
41 if(pa and kid) then
42 kid:ClearAllPoints();
43 kid:SetPoint("TOPLEFT", pa);
44 kid:Hide();
45 h = h + 1;
46 else
47 h = 0;
48 end
49 end
50  
51 local map = self:GetMap();
52 YA_PD_ResetList()
53  
54 for h,v in pairs(overlayers) do
55 local gpf = v[2];
56 if(gpf) then
57 gpf(v[1], map);
58 end
59 end
60  
61 YAOverlay_UpdateP(self)
62 end
63  
64 function YAOverlay_OnMove(self, x,y)
65 local sx, sy;
66  
67 current_locx_xact = x;
68 current_locy_xact = y;
69  
70 YAOverlay_Update(self);
71 YAOverlay_UpdateP(self);
72 end
73  
74 local keys = function(k)
75 local r = {};
76  
77 for h,v in pairs(k) do
78 tinsert(r,h);
79 end
80 return r;
81 end
82  
83  
84 function YAOverlay_Update(self)
85 local i = 0;
86 local x = current_locx_xact;
87 local y = current_locy_xact;
88 local z = self:GetZoom();
89 local tex, bgtex;
90 local plist = {};
91 local num2 = 0;
92 local lm = self:GetName();
93 local common_pd = {};
94 current_lm = lm;
95 current_frame = self;
96 current_viewframe = getglobal(lm.."ViewFrame");
97  
98 if(self.overlays == nil) then
99 return YAOverlay_OnMapChange(self);
100 end
101  
102 if(self.plist == nil) then
103 self.plist = {};
104 end
105  
106 known_frames[lm] = 1;
107  
108 -- hide everything
109 for h = 1,self.overlays_allocd do
110 getglobal(lm.."OTexture"..h):Hide();
111 getglobal(lm.."OBGTexture"..h):Hide();
112 getglobal(lm.."OTexture"..h):SetTexCoord(0, 1, 0, 1);
113 getglobal(lm.."OBGTexture"..h):SetTexCoord(0, 1, 0, 1);
114 end
115 YA_PD_ResetList()
116  
117 for xv = math.floor(x),math.ceil(x+current_viewframe:GetWidth()/z),1 do
118 if(self.overlays[xv] ~= nil) then
119 for yv = math.floor(y),math.ceil(y+current_viewframe:GetHeight()/z),1 do
120 if(self.overlays[xv][yv] ~= nil) then
121 for k,vv in pairs(self.overlays[xv][yv]) do
122 if(vv[2] > x and vv[3] > y and
123 vv[2] < x+current_viewframe:GetWidth()/z and
124 vv[3] < y+current_viewframe:GetHeight()/z) then
125 plist[vv[4]..vv[2]..vv[3]] = vv;
126 end
127 end
128 end
129 end
130 end
131 end
132  
133 local sorted = keys(plist);
134 local pd_allocfunc = getglobal(self.YA_PD_allocText);
135 if(not pd_allocfunc) then pd_allocfunc = function () end end
136  
137 table.sort(sorted)
138 common_pd = {};
139 self.overlays_allocd = 1;
140 for hi,h in ipairs(sorted) do
141 local v = plist[h];
142 local modi = 0;
143 local showornotfunc = overlayers[v[1]][5];
144  
145 if(YatlasOptions.Frames[lm].Overlays[v[1]] or (showornotfunc and not showornotfunc(v))) then
146 tex = nil;
147 else
148 tex = getglobal(lm.."OTexture"..self.overlays_allocd);
149 bgtex = getglobal(lm.."OBGTexture"..self.overlays_allocd);
150 end
151  
152 if(tex ~= nil and bgtex ~= nil) then
153 tex:Show();
154  
155 local otextures;
156 if((not v[6]) or (not v[6].commonpd)) then
157 i = i + 1;
158 num2 = num2 + 1;
159 otextures = {pd_allocfunc()};
160 else
161 if(not common_pd[v[6].commonpd]) then
162 common_pd[v[6].commonpd] = {pd_allocfunc()};
163 i = i + 1;
164 else
165 modi = -1;
166 end
167 otextures = common_pd[v[6].commonpd];
168 end
169 if(otextures[1]) then
170 tinsert(otextures[1].myOTextures, self.overlays_allocd);
171 end
172  
173 local func = overlayers[v[1]][3];
174 if(func ~= nil) then
175 func({tex, bgtex}, otextures, {v[2], v[3]}, v[4], num2, v[5]);
176 end
177  
178 self.overlays_allocd = self.overlays_allocd + 1;
179 end
180 end
181 -- count correctly!
182 self.overlays_allocd = self.overlays_allocd - 1;
183 end
184  
185 function YAOverlay_showmeornot(framename, v)
186 local showornotfunc = overlayers[v[1]][5];
187  
188 if(YatlasOptions.Frames[framename].Overlays[v[1]] or (showornotfunc and not showornotfunc(v))) then
189 return false;
190 else
191 return true;
192 end
193 end
194  
195 function YAOverlay_UpdateP(self)
196 local z = self:GetZoom();
197 local lm = self:GetName();
198 local vf = getglobal(lm.."ViewFrame");
199 local iconsize = YatlasOptions.Frames[lm].IconSize;
200  
201 if(self.unitlocations.player and self.unitlocations.player[1] == YatlasOptions.Frames[lm].Map) then
202 local x,y = Yatlas_Big2Mini_Coord(self.unitlocations.player[2],
203 self.unitlocations.player[3]);
204  
205 if(x > current_locx_xact and y > current_locy_xact and
206 x < current_locx_xact+vf:GetWidth()/z and y < current_locy_xact+vf:GetHeight()/z) then
207  
208 getglobal(lm.."PTexture1"):SetTexture("Interface\\WorldMap\\WorldMapPlayerIcon");
209 YAOverly_position_texture(getglobal(lm.."PTexture1"), {x, y}, {iconsize/2, iconsize/2} );
210 getglobal(lm.."PTexture1"):Show();
211 getglobal(lm.."PTexture1"):SetHeight(iconsize);
212 getglobal(lm.."PTexture1"):SetWidth(iconsize);
213 else
214 getglobal(lm.."PTexture1"):Hide();
215 end
216 else
217 getglobal(lm.."PTexture1"):Hide();
218 end
219 end
220  
221 function YAOverly_position_texture(tx, coord, off)
222 local z = current_frame:GetZoom();
223 tx:ClearAllPoints();
224 tx:SetPoint("TOPLEFT", current_viewframe, "TOPLEFT",
225 -(current_locx_xact - coord[1])*z - off[1],
226 (current_locy_xact - coord[2])*z + off[2]);
227 end
228  
229 --
230  
231 function YFOO_Init(frame)
232 if(not frame) then
233 frame = this;
234 end
235  
236 UIDropDownMenu_Initialize(frame, YFOODropDown_Initialize, "MENU");
237 UIDropDownMenu_SetButtonWidth(50,frame);
238 UIDropDownMenu_SetWidth(50,frame);
239 end
240  
241 function YFOODropDown_Initialize()
242 if(UIDROPDOWNMENU_MENU_LEVEL == 1) then
243 local info = {};
244 info.text = YATLAS_OVERLAY_SHOWPOINTS_TITLE;
245 info.notClickable = 1;
246 info.isTitle = 1;
247 info.notCheckable = 1;
248 UIDropDownMenu_AddButton(info);
249 end
250  
251 if(YatlasOptions.Frames and YatlasOptions.Frames[current_lm]) then
252 for h,v in pairs(overlayers) do
253 local ddf = v[4];
254 if(ddf) then
255 ddf(v[1], map);
256 end
257 end
258 end
259 end
260  
261 function YFOO_OnClick()
262 current_lm = this;
263 while(current_lm and not current_lm.SetLocation) do
264 current_lm = current_lm:GetParent()
265 end
266 current_lm = current_lm:GetName();
267  
268 if(current_lm == "BigYatlasFrame") then
269 BigYatlasTooltip:Hide();
270 end
271  
272 ToggleDropDownMenu(1, nil, getglobal(this:GetName().."DropDown"), this:GetName(), 0, 0);
273 end
274  
275 function YFOODropDown_do_toggle_normal()
276 YatlasOptions.Frames[current_lm].Overlays[this.value] = UIDropDownMenuButton_GetChecked()
277 YAOverlay_ForceUpdate(getglobal(current_lm))
278 end
279  
280 function YAOverlay_addpoint(frame, x, y, dat)
281 if(type(frame) ~= "table") then
282 frame = current_frame;
283 end
284  
285 local fx = math.floor(x);
286 local fy = math.floor(y);
287  
288 if(frame.overlays[fx] == nil) then frame.overlays[fx] = {}; end
289 if(frame.overlays[fx][fy] == nil) then frame.overlays[fx][fy] = {}; end
290  
291 tinsert(frame.overlays[fx][fy],dat);
292 end
293  
294 ---
295 ---
296 ---
297  
298 function YAOverlay_getpoints_landmarks(name, map)
299 -- we got these from map api. don't use if we see Megellan
300 if(type(Yatlas_Landmarks[map]) == "table" and Magellan_Init == nil) then
301 for h,v in ipairs(Yatlas_Landmarks[map]) do
302 local x,y = Yatlas_Big2Mini_Coord(v[1],v[2]);
303  
304 YAOverlay_addpoint(nil, x, y, {"landmarks",x,y,v[3],Yatlas_Landmarks[map][h]});
305 end
306 end
307  
308 -- we got these...from OURSELVES!
309 if(type(Yatlas_instances[map]) == "table") then
310 for h,v in ipairs(Yatlas_instances[map]) do
311 local x,y = Yatlas_Big2Mini_Coord(v[2],v[3]);
312  
313 YAOverlay_addpoint(nil, x, y,{"landmarks",x,y,v[1],{nil,nil,nil,nil,-1}});
314 end
315 end
316  
317 -- 'other towns' ...we got these...from OURSELVES!
318 if(type(Yatlas_towns2[map]) == "table") then
319 for h,v in ipairs(Yatlas_towns2[map]) do
320 local x,y = Yatlas_Big2Mini_Coord(v[2],v[3]);
321  
322 YAOverlay_addpoint(nil, x, y,{"landmarks",x,y,v[1],{nil,nil,nil,nil,-4}});
323 end
324 end
325 end
326  
327 function YAOverlay_setupicon_landmarks(maptextures, otextures, coord, name, id, dat)
328 local texture, bg = unpack(maptextures);
329 local x1, x2, y1, y2;
330 local r, g, b;
331 local bgtextname;
332  
333 if(dat[5] == 4 or dat[5] == 5 or dat[5] < 0) then
334 x1 = 0; y1 = 0;
335 x2 = 1; y2 = 1;
336  
337 r = 0.2;
338 g = 0.6;
339 b = 1;
340 bgtextname = "Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Circle";
341 if(dat[5] == 5) then
342 bgtextname = "Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Circle2";
343 elseif(dat[5] == -1) then
344 r = 0.9;
345 g = 0.1;
346 b = 0.9;
347 elseif(dat[5] == -4) then
348 r = 0.3;
349 g = 0.8;
350 b = 1;
351 end
352 else
353 x1, x2, y1, y2 = WorldMap_GetPOITextureCoords(dat[5]);
354 r,g,b = 1,1,1;
355 bgtextname = "Interface\\Minimap\\POIIcons"
356 end
357  
358 texture:Show();
359 YAOverly_position_texture(texture, coord, {YatlasOptions.Frames[current_lm].IconSize/2, YatlasOptions.Frames[current_lm].IconSize/2});
360 if(id > 32) then
361 texture:Hide();
362 else
363 texture:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-N"..id);
364 texture:SetHeight(YatlasOptions.Frames[current_lm].IconSize+1);
365 texture:SetWidth(YatlasOptions.Frames[current_lm].IconSize+1);
366 end
367  
368 bg:Show();
369 bg:SetHeight(YatlasOptions.Frames[current_lm].IconSize);
370 bg:SetWidth(YatlasOptions.Frames[current_lm].IconSize);
371 bg:SetTexture(bgtextname);
372 bg:SetTexCoord(x1, x2, y1, y2);
373 bg:SetVertexColor(r, g, b, 1);
374  
375 local txt, icon, bgicon = unpack(otextures);
376  
377 if(icon) then
378 icon:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-N"..id);
379 icon:SetHeight(14);
380 icon:SetWidth(14);
381 icon:Show();
382  
383 bgicon:SetTexture(bgtextname);
384 bgicon:SetTexCoord(x1, x2, y1, y2);
385 bgicon:SetVertexColor(r, g, b, 1);
386 bgicon:SetHeight(14);
387 bgicon:SetWidth(14);
388 bgicon:Show();
389  
390 txt:SetText(name);
391 txt:Show();
392 end
393 end
394  
395 function YAOverlay_config_landmarks(name)
396 if(UIDROPDOWNMENU_MENU_LEVEL == 1) then
397 local info = {};
398 info.text = YATLAS_OVERLAY_LANDMARKS;
399 info.func = YFOODropDown_do_toggle_normal;
400 info.checked = YatlasOptions.Frames[current_lm].Overlays and not YatlasOptions.Frames[current_lm].Overlays[name];
401 info.value = name;
402 info.keepShownOnClick = 1;
403 UIDropDownMenu_AddButton(info);
404 end
405 end
406  
407 YAOverlay_Register("landmarks",YAOverlay_getpoints_landmarks,YAOverlay_setupicon_landmarks,
408 YAOverlay_config_landmarks);
409  
410 ---
411  
412 function YAOverlay_getpoints_graveyards(name, map)
413 if(type(Yatlas_graveyards[map]) == "table") then
414 for h,v in ipairs(Yatlas_graveyards[map]) do
415 local x,y = Yatlas_Big2Mini_Coord(v[2],v[1]);
416  
417 YAOverlay_addpoint(nil, x, y, {"graveyards",x,y,"Graveyard",0,{commonpd="Gy"}});
418 end
419 end
420 end
421  
422 function YAOverlay_setupicon_graveyards(maptextures, otextures, coord, name, id)
423 local texture, bg = unpack(maptextures);
424  
425 texture:Hide();
426 YAOverly_position_texture(texture, coord, {YatlasOptions.Frames[current_lm].IconSize/2, YatlasOptions.Frames[current_lm].IconSize/2});
427  
428 bg:Show();
429 bg:SetHeight(YatlasOptions.Frames[current_lm].IconSize);
430 bg:SetWidth(YatlasOptions.Frames[current_lm].IconSize);
431 bg:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Graveyard");
432 bg:SetVertexColor(1, 1, 1, 1);
433  
434 local txt, icon, bgicon = unpack(otextures);
435  
436 if(icon) then
437 icon:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Blank");
438 icon:SetHeight(16);
439 icon:SetWidth(16);
440 icon:Show()
441  
442 bgicon:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Graveyard");
443 bgicon:SetVertexColor(1, 1, 1, 1);
444 bgicon:SetHeight(16);
445 bgicon:SetWidth(16);
446 bgicon:Show();
447  
448 txt:SetText(name);
449 txt:Show();
450 end
451 end
452  
453 function YAOverlay_config_graveyards(name)
454 if(UIDROPDOWNMENU_MENU_LEVEL == 1) then
455 local info = {};
456 info.text = YATLAS_OVERLAY_GRAVEYARDS;
457 info.func = YFOODropDown_do_toggle_normal;
458 info.checked = YatlasOptions.Frames[current_lm].Overlays and not YatlasOptions.Frames[current_lm].Overlays[name];
459 info.value = name;
460 info.keepShownOnClick = 1;
461 UIDropDownMenu_AddButton(info);
462 end
463 end
464  
465 YAOverlay_Register("graveyards",YAOverlay_getpoints_graveyards,
466 YAOverlay_setupicon_graveyards,YAOverlay_config_graveyards);
467  
468 ---
469  
470 function YAOverlay_getpoints_mapnotes(name, map)
471 if(MapNotes_Data and MapNotes_Data[Yatlas_WorldMapIds[map]]) then
472 for zid,zdat in ipairs(MapNotes_Data[Yatlas_WorldMapIds[map]]) do
473 local zname = Yatlas_PaperZoneNames[map][zid];
474 if(zname ~= nil) then
475 local real_zid;
476 for h,v in pairs(Yatlas_areadb) do
477 if(v[2] == zname) then
478 real_zid = h;
479 break;
480 end
481 end
482  
483 if(real_zid ~= nil) then
484 local x1,x2,y1,y2,x,y;
485 x1 = Yatlas_mapareas[map][real_zid][1];
486 x2 = Yatlas_mapareas[map][real_zid][2];
487 y1 = Yatlas_mapareas[map][real_zid][3];
488 y2 = Yatlas_mapareas[map][real_zid][4];
489  
490 for i,notes in ipairs(zdat) do
491 x,y = Yatlas_Big2Mini_Coord(-notes.xPos*(x1-x2) + x1, -notes.yPos*(y1-y2) + y1);
492  
493 YAOverlay_addpoint(nil, x, y, {"mapnotes",x,y,notes.name,notes.icon});
494 end
495 end
496 end
497 end
498 end
499 end
500  
501 function YAOverlay_setupicon_mapnotes(maptextures, otextures, coord, name, id, dat)
502 local texture, bg = unpack(maptextures);
503  
504 local color = {1,1,1,1};
505 local iconname = "Icon-Square";
506 if(dat) then
507 if(dat >= 5) then
508 iconname = "Icon-Diamond";
509 dat = dat - 5;
510 end
511 if(dat == 0) then
512 color = {1,1,0,1};
513 elseif(dat == 1) then
514 color = {1,0.1,0.1,1};
515 elseif(dat == 2) then
516 color = {0.4,0.2,0.95,1};
517 elseif(dat == 3) then
518 color = {0.1, 1, 0.2,1};
519 elseif(dat == 4) then
520 color = {1,0.4,0.8,1};
521 end
522 end
523  
524 texture:Show();
525 YAOverly_position_texture(texture, coord, {YatlasOptions.Frames[current_lm].IconSize/2, YatlasOptions.Frames[current_lm].IconSize/2});
526 if(id > 32) then
527 texture:Hide();
528 else
529 texture:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-N"..id);
530 texture:SetHeight(YatlasOptions.Frames[current_lm].IconSize);
531 texture:SetWidth(YatlasOptions.Frames[current_lm].IconSize);
532 end
533  
534 bg:Show();
535 bg:SetHeight(YatlasOptions.Frames[current_lm].IconSize);
536 bg:SetWidth(YatlasOptions.Frames[current_lm].IconSize);
537 bg:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\"..iconname);
538 bg:SetVertexColor(unpack(color));
539  
540 local txt, icon, bgicon = unpack(otextures);
541  
542 if(icon) then
543 icon:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-N"..id);
544 icon:SetHeight(16);
545 icon:SetWidth(16);
546 icon:Show();
547  
548 bgicon:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\"..iconname);
549 bgicon:SetVertexColor(unpack(color));
550 bgicon:SetHeight(16);
551 bgicon:SetWidth(16);
552 bgicon:Show();
553  
554 txt:SetText(name);
555 txt:Show();
556 end
557 end
558  
559 function YAOverlay_config_mapnotes(name)
560 if(MapNotes_DeleteNote and UIDROPDOWNMENU_MENU_LEVEL == 1) then
561 local info = {};
562 info.text = YATLAS_OVERLAY_MAPNOTES;
563 info.func = YFOODropDown_do_toggle_normal;
564 info.checked = YatlasOptions.Frames[current_lm].Overlays
565 and not YatlasOptions.Frames[current_lm].Overlays[name];
566 info.value = name;
567 info.keepShownOnClick = 1;
568 UIDropDownMenu_AddButton(info);
569 end
570 end
571  
572 YAOverlay_Register("mapnotes",YAOverlay_getpoints_mapnotes,YAOverlay_setupicon_mapnotes,
573 YAOverlay_config_mapnotes);
574  
575 ---
576 function YAOverlay_getpoints_gatherer(name, map)
577 if(GatherItems and GatherItems[Yatlas_WorldMapIds[map]]) then
578 for zid,zdat in pairs(GatherItems[Yatlas_WorldMapIds[map]]) do
579 local zname = Yatlas_PaperZoneNames[map][zid];
580 if(zname ~= nil) then
581 local real_zid;
582 for h,v in pairs(Yatlas_areadb) do
583 if(v[2] == zname) then
584 real_zid = h;
585 break;
586 end
587 end
588  
589 local x1,x2,y1,y2,x,y;
590 x1 = Yatlas_mapareas[map][real_zid][1];
591 x2 = Yatlas_mapareas[map][real_zid][2];
592 y1 = Yatlas_mapareas[map][real_zid][3];
593 y2 = Yatlas_mapareas[map][real_zid][4];
594  
595 for typ,datz in pairs(zdat) do
596  
597 for i,notes in ipairs(datz) do
598 x,y = Yatlas_Big2Mini_Coord(-notes.x*(x1-x2)/100 + x1, -notes.y*(y1-y2)/100 + y1);
599  
600 local utyp = string.gsub(typ, ".", string.upper, 1)
601 YAOverlay_addpoint(nil, x, y, {"gatherer",x,y,utyp,notes,{commonpd="g"..typ}});
602 end
603 end
604 end
605 end
606 end
607 end
608  
609 function YAOverlay_setupicon_gatherer(maptextures, otextures, coord, name, id, dat)
610 local texture, bg = unpack(maptextures);
611  
612 local iconname = "Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Square";
613 if(Gather_IconSet) then
614 local gtype = dat.gtype;
615 local gtype_str = gtype;
616 if (type(gtype) == "number") then
617 gtype_str = Gather_DB_TypeIndex[gtype];
618 end
619  
620 -- map
621 local namei = "default";
622 if(type(Gather_DB_IconIndex[gtype]) == "table") then
623 for h,v in pairs(Gather_DB_IconIndex[gtype]) do
624 if(v == dat.icon) then namei = h; break; end
625 end
626 elseif(type(dat.icon) == "string") then
627 namei = dat.icon;
628 end
629  
630 local icons = Gather_IconSet["iconic"][gtype_str];
631 if(icons[namei]) then
632 iconname = icons[namei];
633 elseif(icons["default"]) then
634 iconname = icons["default"];
635 end
636 end
637  
638 texture:Hide();
639 YAOverly_position_texture(texture, coord, {YatlasOptions.Frames[current_lm].IconSize/2, YatlasOptions.Frames[current_lm].IconSize/2});
640  
641 bg:Show();
642 bg:SetHeight(YatlasOptions.Frames[current_lm].IconSize);
643 bg:SetWidth(YatlasOptions.Frames[current_lm].IconSize);
644 bg:SetTexture(iconname);
645 bg:SetVertexColor(1,1,1,1);
646  
647 local txt, icon, bgicon = unpack(otextures);
648  
649 if(icon) then
650 icon:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Blank");
651 icon:SetHeight(16);
652 icon:SetWidth(16);
653 icon:Show()
654  
655 bgicon:SetTexture(iconname);
656 bgicon:SetVertexColor(1,1,1,1);
657 bgicon:SetHeight(16);
658 bgicon:SetWidth(16);
659 bgicon:Show();
660  
661 txt:SetText(name);
662 txt:Show();
663 end
664 end
665  
666 function YAOverlay_config_gatherer(name)
667 if(Gatherer_AddGatherHere) then
668 local info = {};
669 if(UIDROPDOWNMENU_MENU_LEVEL == 1) then
670 info.text = YATLAS_OVERLAY_GATHERER;
671 info.func = YFOODropDown_do_toggle_normal;
672 info.checked = YatlasOptions.Frames[current_lm].Overlays and not YatlasOptions.Frames[current_lm].Overlays[name];
673 info.value = name;
674 info.keepShownOnClick = 1;
675 info.hasArrow = 1;
676 UIDropDownMenu_AddButton(info);
677 elseif(UIDROPDOWNMENU_MENU_LEVEL == 2) then
678 info.text = YATLAS_OVERLAY_GATHERER_TREASURE;
679 info.func = YFOODropDown_do_toggle_normal;
680 info.checked = YatlasOptions.Frames[current_lm].Overlays and not YatlasOptions.Frames[current_lm].Overlays[name.."_Treasure"];
681 info.value = name.."_Treasure";
682 info.keepShownOnClick = 1;
683 UIDropDownMenu_AddButton(info, 2);
684  
685 info = {};
686 info.text = YATLAS_OVERLAY_GATHERER_ORES;
687 info.func = YFOODropDown_do_toggle_normal;
688 info.checked = YatlasOptions.Frames[current_lm].Overlays and not YatlasOptions.Frames[current_lm].Overlays[name.."_Ore"];
689 info.value = name.."_Ore";
690 info.keepShownOnClick = 1;
691 UIDropDownMenu_AddButton(info, 2);
692  
693 info = {};
694 info.text = YATLAS_OVERLAY_GATHERER_HERBS;
695 info.func = YFOODropDown_do_toggle_normal;
696 info.checked = YatlasOptions.Frames[current_lm].Overlays and not YatlasOptions.Frames[current_lm].Overlays[name.."_Herb"];
697 info.value = name.."_Herb";
698 info.keepShownOnClick = 1;
699 UIDropDownMenu_AddButton(info, 2);
700 end
701 end
702 end
703  
704 function YAOverlay_showme_gatherer(v)
705 local gtype = v[5].gtype;
706 if (type(gtype) == "number") then
707 gtype = Gather_DB_TypeIndex[gtype];
708 end
709  
710 return not YatlasOptions.Frames[current_lm].Overlays["gatherer_"..gtype];
711 end
712  
713 YAOverlay_Register("gatherer",YAOverlay_getpoints_gatherer,
714 YAOverlay_setupicon_gatherer, YAOverlay_config_gatherer,
715 YAOverlay_showme_gatherer);
716  
717 ---
718 function YAOverlay_getpoints_ctmapmod(name, map)
719 if(CT_UserMap_Notes) then
720 for zid,zonename in pairs(Yatlas_PaperZoneNames[map]) do
721 if(CT_UserMap_Notes[zonename]) then
722 local real_zid;
723 for h,v in pairs(Yatlas_areadb) do
724 if(v[2] == zonename) then
725 real_zid = h;
726 break;
727 end
728 end
729  
730 local x1,x2,y1,y2,x,y,ops;
731 x1 = Yatlas_mapareas[map][real_zid][1];
732 x2 = Yatlas_mapareas[map][real_zid][2];
733 y1 = Yatlas_mapareas[map][real_zid][3];
734 y2 = Yatlas_mapareas[map][real_zid][4];
735  
736 for id,dat in ipairs(CT_UserMap_Notes[zonename]) do
737 ops = {};
738  
739 x,y = Yatlas_Big2Mini_Coord(-dat.x*(x1-x2) + x1, -dat.y*(y1-y2) + y1);
740  
741 if(dat.set ~= 1 and dat.set ~= 6) then
742 ops = {commonpd="g"..dat.name};
743 end
744  
745 YAOverlay_addpoint(nil, x, y, {"ctmapmod",x,y,dat.name,dat,ops});
746 end
747 end
748 end
749 end
750 end
751  
752 function YAOverlay_setupicon_ctmapmod(maptextures, otextures, coord, name, id, var)
753 local texture, bg = unpack(maptextures);
754  
755 local iconname = "Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Square";
756 local iconszw = YatlasOptions.Frames[current_lm].IconSize/2+2;
757  
758 -- ctmapmod knows best...
759 if ( var.set == 7 or var.set == 8 ) then
760 local offset = 0;
761 if ( var.set == 8 ) then
762 offset = 29;
763 end
764 if ( CT_UserMap_HerbIcons[var.icon+offset] ) then
765 iconname = "Interface\\AddOns\\CT_MapMod\\Resource\\" .. CT_UserMap_HerbIcons[var.icon+offset];
766 else
767 iconname = "Interface\\AddOns\\CT_MapMod\\Resource\\Herb_Bruiseweed";
768 end
769 else
770 iconname = "Interface\\AddOns\\CT_MapMod\\Skin\\" .. CT_UserMap_Icons[var.set];
771 end
772  
773 texture:Hide();
774 YAOverly_position_texture(texture, coord, {iconszw, iconszw});
775  
776 bg:Show();
777 bg:SetHeight(iconszw*2);
778 bg:SetWidth(iconszw*2);
779 bg:SetTexture(iconname);
780 bg:SetVertexColor(1,1,1,1);
781  
782 local txt, icon, bgicon = unpack(otextures);
783  
784 if(icon) then
785 icon:SetTexture("Interface\\AddOns\\Yatlas\\images\\Icons\\Icon-Blank");
786 icon:SetHeight(16);
787 icon:SetWidth(16);
788 icon:Show()
789  
790 bgicon:SetTexture(iconname);
791 bgicon:SetVertexColor(1,1,1,1);
792 bgicon:SetHeight(16);
793 bgicon:SetWidth(16);
794 bgicon:Show();
795  
796 txt:SetText(name);
797 txt:Show();
798 end
799 end
800  
801 function YAOverlay_config_ctmapmod(name)
802 if(CT_MapMod_AddNote) then
803 local info = {};
804 if(UIDROPDOWNMENU_MENU_LEVEL == 1) then
805 info.text = YATLAS_OVERLAY_CTMAPMOD;
806 info.func = YFOODropDown_do_toggle_normal;
807 info.checked = YatlasOptions.Frames[current_lm].Overlays and not YatlasOptions.Frames[current_lm].Overlays[name];
808 info.value = name;
809 info.keepShownOnClick = 1;
810 UIDropDownMenu_AddButton(info);
811 end
812 end
813 end
814  
815 YAOverlay_Register("ctmapmod",YAOverlay_getpoints_ctmapmod,
816 YAOverlay_setupicon_ctmapmod, YAOverlay_config_ctmapmod);