vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 IMBA_SetRaidMarker=false;
2 IMBA_UseRaidMarker=1;
3  
4 IMBA_Minimap_Pings={};
5 IMBA_Minimap_BossMarkerNum=1;
6  
7 IMBA_Minimap_PingWaiting=false;
8  
9 --{PingType, dX, dY, Num, Icon}
10 IMBA_Minimap_PingQueue={}
11 IMBA_Minimap_PingWait=0;
12 IMBA_Minimap_OldSetPing=nil;
13 IMBA_Minimap_OldPingFunction=nil;
14  
15 function IMBA_Minimap_PrintList()
16 for k,v in IMBA_Minimap_Pings do
17 DEFAULT_CHAT_FRAME:AddMessage(k.." pinged at "..v.dx..", "..v.dy);
18 end
19 end
20  
21 --Removed the Ping Sound
22 function IMBA_Minimap_SetPing(x, y, playSound)
23 IMBA_Minimap_OldSetPing(x,y,false);
24 end
25  
26 --
27 function IMBA_Minimap_PingLocation(unknown, x, y)
28 if IMBA_Minimap_PingWaiting then
29 local zoom = IMBA_Minimap_Zoom[IMBA_isMinimapInsideWMO()][Minimap:GetZoom()];
30 local pX,pY = Minimap:GetPingPosition();
31 local dX,dY;
32  
33 dX=x-pX;
34 dY=y-pY;
35 getglobal("IMBA_Minimap_RaidMarker"..IMBA_UseRaidMarker):Show();
36 getglobal("IMBA_Minimap_RaidMarker"..IMBA_UseRaidMarker):SetRaidMarker(dX,dY,tonumber(IMBA_UseRaidMarker));
37  
38 dX=dX*zoom;
39 dY=dY*zoom;
40 if IMBA_SetRaidMarker then
41 tinsert(IMBA_Minimap_PingQueue,{1,dX,dY,IMBA_UseRaidMarker,nil});
42 else
43 tinsert(IMBA_Minimap_PingQueue,{0,dX,dY,nil,nil});
44 end
45 else
46 IMBA_Minimap_OldPingFunction(unknown,x,y)
47 if IMBA_SetRaidMarker then
48 IMBA_SetRaidMarker=false;
49 if GetNumRaidMembers()>0 and (IsRaidLeader() or IsRaidOfficer()) then
50 SendAddonMessage("IMBA_MINIMAP", "RAIDMARKER "..IMBA_UseRaidMarker,"RAID");
51 IMBA_Minimap_PingWaiting=true;
52 elseif GetNumPartyMembers()>0 then
53 SendAddonMessage("IMBA_MINIMAP", "RAIDMARKER "..IMBA_UseRaidMarker,"PARTY");
54 IMBA_Minimap_PingWaiting=true;
55 end
56 getglobal("IMBA_Minimap_RaidMarker"..IMBA_UseRaidMarker):Show();
57 getglobal("IMBA_Minimap_RaidMarker"..IMBA_UseRaidMarker):SetRaidMarker(0,0,tonumber(IMBA_UseRaidMarker));
58 end
59 end
60 end
61  
62 function IMBA_Minimap_ProcessPingQueue()
63 local numEntries = getn(IMBA_Minimap_PingQueue);
64  
65 if (numEntries>0) and (IMBA_Minimap_PingWaiting==false) then
66 local zoom = IMBA_Minimap_Zoom[IMBA_isMinimapInsideWMO()][Minimap:GetZoom()];
67 local pX,pY = Minimap:GetPingPosition();
68  
69 if IMBA_Minimap_PingQueue[1][1]==0 then
70 IMBA_Minimap_OldPingFunction((IMBA_Minimap_PingQueue[1][2]+pX)/zoom, (IMBA_Minimap_PingQueue[1][3]+pY)/zoom);
71 tremove(IMBA_Minimap_PingQueue,1);
72 IMBA_Minimap_ProcessPingQueue();
73 elseif IMBA_Minimap_PingQueue[1][1]==1 then
74 IMBA_Minimap_OldPingFunction((IMBA_Minimap_PingQueue[1][2]+pX)/zoom, (IMBA_Minimap_PingQueue[1][3]+pY)/zoom);
75 if GetNumRaidMembers()>0 and (IsRaidLeader() or IsRaidOfficer()) then
76 SendAddonMessage("IMBA_MINIMAP", "RAIDMARKER "..IMBA_Minimap_PingQueue[1][4],"RAID");
77 IMBA_Minimap_PingWaiting=true;
78 elseif GetNumPartyMembers()>0 then
79 SendAddonMessage("IMBA_MINIMAP", "RAIDMARKER "..IMBA_Minimap_PingQueue[1][4],"PARTY");
80 IMBA_Minimap_PingWaiting=true;
81 end
82 tremove(IMBA_Minimap_PingQueue,1);
83 elseif IMBA_Minimap_PingQueue[1][1]==2 then
84 IMBA_Minimap_OldPingFunction((IMBA_Minimap_PingQueue[1][2]+pX)/zoom, (IMBA_Minimap_PingQueue[1][3]+pY)/zoom);
85 if GetNumRaidMembers()>0 then
86 SendAddonMessage("IMBA_MINIMAP", "BOSSMARKER","RAID");
87 IMBA_Minimap_PingWaiting=true;
88 elseif GetNumPartyMembers()>0 then
89 SendAddonMessage("IMBA_MINIMAP", "BOSSMARKER","PARTY");
90 IMBA_Minimap_PingWaiting=true;
91 end
92 tremove(IMBA_Minimap_PingQueue,1);
93 end
94  
95 end
96 end
97  
98 function IMBA_Minimap_ClearMarkers()
99 IMBA_SetRaidMarker=false;
100 if GetNumRaidMembers()>0 and (IsRaidLeader() or IsRaidOfficer()) then
101 SendAddonMessage("IMBA_MINIMAP", "CLEARRAIDMARKERS","RAID");
102 elseif GetNumPartyMembers()>0 then
103 SendAddonMessage("IMBA_MINIMAP", "CLEARRAIDMARKERS","PARTY");
104 end
105 arg1="IMBA_MINIMAP";
106 arg2="CLEARRAIDMARKERS";
107 IMBA_Minimap_OnEvent("CHAT_MSG_ADDON");
108 end
109  
110 function IMBA_Minimap_SetBossMarker()
111 if IMBA_Minimap_PingWaiting then
112 local zoom = IMBA_Minimap_Zoom[IMBA_isMinimapInsideWMO()][Minimap:GetZoom()];
113 local pX,pY = Minimap:GetPingPosition();
114 local dX,dY;
115  
116 dX=CURSOR_OFFSET_X-pX;
117 dY=CURSOR_OFFSET_Y-pY;
118 getglobal("IMBA_Minimap_BossMarker"..IMBA_Minimap_BossMarkerNum):Show();
119 getglobal("IMBA_Minimap_BossMarker"..IMBA_Minimap_BossMarkerNum):SetMarker(dX,dY);
120  
121 dX=dX*zoom;
122 dY=dY*zoom;
123 tinsert(IMBA_Minimap_PingQueue,{2,dX,dY,nil,nil});
124  
125 else
126 Minimap:PingLocation(CURSOR_OFFSET_X, CURSOR_OFFSET_Y);
127 getglobal("IMBA_Minimap_BossMarker"..IMBA_Minimap_BossMarkerNum):Show();
128 getglobal("IMBA_Minimap_BossMarker"..IMBA_Minimap_BossMarkerNum):SetMarker(0,0);
129  
130 if GetNumRaidMembers()>0 then
131 SendAddonMessage("IMBA_MINIMAP", "BOSSMARKER","RAID");
132 IMBA_Minimap_PingWaiting=true;
133 elseif GetNumPartyMembers()>0 then
134 SendAddonMessage("IMBA_MINIMAP", "BOSSMARKER","PARTY");
135 IMBA_Minimap_PingWaiting=true;
136 else
137 IMBA_Minimap_BossMarkerNum=IMBA_Minimap_BossMarkerNum+1;
138 if IMBA_Minimap_BossMarkerNum==9 then
139 IMBA_Minimap_BossMarkerNum=1;
140 end
141 end
142 end
143  
144  
145 end
146  
147 function IMBA_Minimap_ClearBossMarkers()
148 if GetNumRaidMembers()>0 and (IsRaidLeader() or IsRaidOfficer()) then
149 SendAddonMessage("IMBA_MINIMAP", "CLEARBOSSMARKERS","RAID");
150 elseif GetNumPartyMembers()>0 then
151 SendAddonMessage("IMBA_MINIMAP", "CLEARBOSSMARKERS","PARTY");
152 end
153 arg1="IMBA_MINIMAP";
154 arg2="CLEARBOSSMARKERS";
155 IMBA_Minimap_OnEvent("CHAT_MSG_ADDON");
156 end
157  
158 function IMBA_Minimap_OnLoad()
159  
160 this:RegisterEvent("CHAT_MSG_ADDON");
161 this:RegisterEvent("MINIMAP_PING");
162 this:RegisterEvent("PLAYER_LOGIN");
163  
164 IMBA_MC_Locations=false;
165 end
166  
167 function IMBA_Minimap_OnEvent(event)
168 if event=="CHAT_MSG_ADDON" then
169 if arg1=="IMBA_MINIMAP" then
170 local commandName, params = IMBA_ExtractNextParam(arg2);
171 if commandName=="RAIDMARKER" then
172 local number;
173 number, params = IMBA_ExtractNextParam(params);
174 if IMBA_Minimap_Pings[arg4] then
175 local zoom = IMBA_Minimap_Zoom[IMBA_isMinimapInsideWMO()][Minimap:GetZoom()];
176 getglobal("IMBA_Minimap_RaidMarker"..number):Show();
177 getglobal("IMBA_Minimap_RaidMarker"..number):SetRaidMarker(IMBA_Minimap_Pings[arg4].dx/zoom,IMBA_Minimap_Pings[arg4].dy/zoom,tonumber(number));
178 else
179 getglobal("IMBA_Minimap_RaidMarker"..number):Show();
180 getglobal("IMBA_Minimap_RaidMarker"..number):SetRaidMarker(0,0,tonumber(number));
181 end
182  
183 if arg4 == UnitName("player") then
184 IMBA_Minimap_PingWaiting=false;
185 IMBA_Minimap_ProcessPingQueue();
186 end
187 elseif commandName=="CLEARRAIDMARKERS" then
188 for i=1,8,1 do
189 getglobal("IMBA_Minimap_RaidMarker"..i):HideMarker();
190 getglobal("IMBA_Minimap_RaidMarker"..i):Hide();
191 end
192 elseif commandName=="BOSSMARKER" then
193 local number;
194 number = IMBA_Minimap_BossMarkerNum;
195 if IMBA_Minimap_Pings[arg4] then
196 local zoom = IMBA_Minimap_Zoom[IMBA_isMinimapInsideWMO()][Minimap:GetZoom()];
197 getglobal("IMBA_Minimap_BossMarker"..number):Show();
198 getglobal("IMBA_Minimap_BossMarker"..number):SetMarker(IMBA_Minimap_Pings[arg4].dx/zoom,IMBA_Minimap_Pings[arg4].dy/zoom);
199 else
200 getglobal("IMBA_Minimap_BossMarker"..number):Show();
201 getglobal("IMBA_Minimap_BossMarker"..number):SetMarker(0,0);
202 end
203  
204 IMBA_Minimap_BossMarkerNum=IMBA_Minimap_BossMarkerNum+1;
205 if IMBA_Minimap_BossMarkerNum==9 then
206 IMBA_Minimap_BossMarkerNum=1;
207 end
208  
209 if arg4 == UnitName("player") then
210 IMBA_Minimap_PingWaiting=false;
211 IMBA_Minimap_ProcessPingQueue();
212 end
213 elseif commandName=="CLEARBOSSMARKERS" then
214 for i=1,8,1 do
215 getglobal("IMBA_Minimap_BossMarker"..i):HideMarker();
216 getglobal("IMBA_Minimap_BossMarker"..i):Hide();
217 end
218 end
219 end
220 elseif event=="MINIMAP_PING" then
221 local zoom = IMBA_Minimap_Zoom[IMBA_isMinimapInsideWMO()][Minimap:GetZoom()];
222 local PlayerName=UnitName(arg1);
223 for k, v in IMBA_Minimap_Pings do
224 v.dx=v.dx-arg2*zoom;
225 v.dy=v.dy-arg3*zoom;
226 end
227  
228 if IMBA_Minimap_Pings[PlayerName]==nil then
229 IMBA_Minimap_Pings[PlayerName]={};
230 end
231  
232 IMBA_Minimap_Pings[PlayerName].dx=0;
233 IMBA_Minimap_Pings[PlayerName].dy=0;
234 elseif event=="PLAYER_LOGIN" then
235 IMBA_Minimap_OldSetPing=Minimap_SetPing;
236 Minimap_SetPing=IMBA_Minimap_SetPing;
237 IMBA_Minimap_OldPingFunction=Minimap.PingLocation
238 Minimap.PingLocation=IMBA_Minimap_PingLocation;
239 end
240 end