source: trunk/OnlinePlayers.pas

Last change on this file was 13, checked in by george, 14 years ago
  • Opraveno: Všechny odkazy na starý web wow.zdechov.net opraveny na aktuální www.heroesoffantasy.cz.
File size: 34.5 KB
Line 
1unit OnlinePlayers;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs,
8// kvůli třídě aby byla jenom 1x
9 Main, ComCtrls, xmldom, XMLIntf, msxmldom, XMLDoc, ImgList, StdCtrls, Registry,
10 ExtCtrls, Menus, CoolTrayIcon;
11
12type
13 TForm5 = class(TForm)
14 ListView1: TListView;
15 XMLDocument1: TXMLDocument;
16 ImageRace: TImageList;
17 ImageClass: TImageList;
18 Panel1: TPanel;
19 Label1: TLabel;
20 Button1: TButton;
21 Button2: TButton;
22 PopupMenu1: TPopupMenu;
23 Label2: TLabel;
24 ListView2: TListView;
25 PopupMenu2: TPopupMenu;
26 Pidatdoseznamuptel1: TMenuItem;
27 Panel2: TPanel;
28 PopupMenu3: TPopupMenu;
29 Smazatzseznamu1: TMenuItem;
30 procedure FormClose(Sender: TObject; var Action: TCloseAction);
31 procedure Button1Click(Sender: TObject);
32 procedure ListView1ColumnClick(Sender: TObject; Column: TListColumn);
33 procedure ListView1Compare(Sender: TObject; Item1, Item2: TListItem;
34 Data: Integer; var Compare: Integer);
35 procedure Button2MouseDown(Sender: TObject; Button: TMouseButton;
36 Shift: TShiftState; X, Y: Integer);
37 procedure ListView1MouseDown(Sender: TObject; Button: TMouseButton;
38 Shift: TShiftState; X, Y: Integer);
39 procedure Pidatdoseznamuptel1Click(Sender: TObject);
40 procedure Panel2MouseDown(Sender: TObject; Button: TMouseButton;
41 Shift: TShiftState; X, Y: Integer);
42 procedure Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
43 Y: Integer);
44 procedure Panel2MouseUp(Sender: TObject; Button: TMouseButton;
45 Shift: TShiftState; X, Y: Integer);
46 procedure FormResize(Sender: TObject);
47 procedure Smazatzseznamu1Click(Sender: TObject);
48 procedure ListView2MouseDown(Sender: TObject; Button: TMouseButton;
49 Shift: TShiftState; X, Y: Integer);
50 procedure FormShow(Sender: TObject);
51 procedure FormCreate(Sender: TObject);
52 private
53 { Private declarations }
54 procedure WMMoving(var Message: TWMMoving); message WM_MOVING;
55 procedure PopupMenuItemsClick(Sender: TObject);
56 function GetNameMap(ID: string): string;
57 function GetNameZone(ID: string): string;
58 function IsStringInArray(Find: string; ArrayOfString: array of string): Boolean;
59 function GetLowerString(Text: string): string;
60 public
61 { Public declarations }
62
63 Friends: array of string;
64
65 procedure DrawForm;
66 //hlavní
67 procedure DownloadPlayers;
68 procedure LoadRegOptions;
69 procedure SaveRegOptions;
70 end;
71
72var
73 Form5: TForm5;
74 OnlinePlayersIndex: integer = 0;
75 //nastavení
76 BeepAfterNewFriend: Boolean = True;
77 ShowBalloonHintAfterNewFriend: Boolean = True;
78 FriendPlaySound: Boolean = False;
79 FriendSoundFile: string;
80 LockOnlineAddres: Boolean = True;
81 LockAddres: string = HoFOnlineListURL;
82
83 ColumnIndexSoft: integer = 0;
84
85implementation
86
87
88{$R *.dfm}
89
90{ TForm5 }
91
92procedure TForm5.WMMoving(var Message: TWMMoving);
93var
94 OriginalWidth, OriginalHeight: integer;
95const
96 SnapPixels = 4;
97begin
98 DockingOnlinePlayers := False;
99 OriginalWidth := Width;
100 OriginalHeight := Height;
101 if (WindowState = wsNormal) and Visible then
102 begin
103 if (Message.Coord.Left < (Form1.Left+Form1.Width + SnapPixels)) and (Message.Coord.Left > (Form1.Left+Form1.Width - SnapPixels)) and
104 (Form1.Top <= Message.Coord.Top) and (Form1.Top+Form1.Height >= Message.Coord.Top) then begin
105 Message.Coord.Left := Form1.Left+Form1.Width; //pravá strana hlavního
106 DockingOnlinePlayers := True;
107 end;
108
109 if (Message.Coord.Top < (Form1.Top+Form1.Height + SnapPixels)) and (Message.Coord.Top > (Form1.Top+Form1.Height - SnapPixels)) and
110 (Form1.Left <= Message.Coord.Right) and (Form1.Left+Form1.Width >= Message.Coord.Left) then begin
111 Message.Coord.Top := Form1.Top+Form1.Height; //spodní strana hlavního
112 DockingOnlinePlayers := True;
113 end;
114
115 if (Message.Coord.Bottom > (Form1.Top - SnapPixels)) and (Message.Coord.Bottom < (Form1.Top + SnapPixels)) and
116 (Form1.Left <= Message.Coord.Right) and (Form1.Left+Form1.Width >= Message.Coord.Left) then begin
117 Message.Coord.Top := Form1.Top - Height; //horní strana hlavního
118 DockingOnlinePlayers := True;
119 end;
120
121 if (Message.Coord.Right > (Form1.Left - SnapPixels)) and (Message.Coord.Right < (Form1.Left + SnapPixels)) and
122 (Form1.Top <= Message.Coord.Top) and (Form1.Top+Form1.Height >= Message.Coord.Top) then begin
123 Message.Coord.Left := Form1.Left - Width; // levá strana dolního
124 DockingOnlinePlayers := True;
125 end;
126
127 end;
128 Message.Coord.Right := Message.Coord.Left + OriginalWidth;
129 Message.Coord.Bottom := Message.Coord.Top + OriginalHeight;
130end;
131
132procedure TForm5.FormClose(Sender: TObject; var Action: TCloseAction);
133begin
134 Form1.OnlineHri1.Checked := False;
135end;
136
137procedure TForm5.FormCreate(Sender: TObject);
138begin
139 LoadRegOptions;
140end;
141
142procedure TForm5.DownloadPlayers;
143var
144 StartItemNode : IXMLNode;
145 ANode : IXMLNode;
146 sName, sLevel, sRace, sClass, sZone, sMap: WideString;
147 i: integer;
148 OldOnlineFriend: array of string;
149 FirstDownload: Boolean;
150begin
151 if ListView1.Items.Count = 0 then FirstDownload := True else FirstDownload := False;
152 // zálohování dřívějších online přátel
153 SetLength(OldOnlineFriend,ListView2.Items.Count);
154 for i:= 0 to Length(OldOnlineFriend)-1 do begin
155 OldOnlineFriend[i] := ListView2.Items[i].Caption;
156 end;
157
158 // mazání
159 ListView1.Clear;
160 ListView2.Clear;
161 // načítání z serveru
162 try
163 if LockOnlineAddres then
164 XMLDocument1.FileName := LockAddres
165 else
166 XMLDocument1.FileName := Form1.Servers[OnlinePlayersIndex].OnlinePlayersAddress;
167 XMLDocument1.Active := True;
168
169 StartItemNode := XMLDocument1.DocumentElement.ChildNodes['players'].ChildNodes.FindNode('player');
170
171 ANode := StartItemNode;
172 repeat
173 sName := ANode.ChildNodes['name'].Text;
174 sLevel := ANode.ChildNodes['level'].Text;
175 sRace := ANode.ChildNodes['race'].Text;
176 sClass := ANode.ChildNodes['class'].Text;
177 sZone := ANode.ChildNodes['zone'].Text;
178 sMap := ANode.ChildNodes['map'].Text;
179
180 with ListView1.Items.Add do begin
181 Caption := sName;
182 SubItems.Add(sLevel);
183 SubItems.Add(GetNameMap(sMap));
184 SubItems.Add(GetNameZone(sZone));
185 ImageIndex := StrToInt(sClass) - 1;
186 StateIndex := StrToInt(sRace) - 1;
187 end;
188 // Zjišťování přátel a zobrazení
189 for i:=0 to length(Friends) - 1 do begin
190 if GetLowerString(sName) = GetLowerString(Friends[i]) then begin
191 with ListView2.Items.Add do begin
192 Caption := sName;
193 SubItems.Add(sLevel);
194 SubItems.Add(GetNameMap(sMap));
195 SubItems.Add(GetNameZone(sZone));
196 ImageIndex := StrToInt(sClass) - 1;
197 StateIndex := StrToInt(sRace) - 1;
198 end;
199 end;
200 end;
201
202 ANode := ANode.NextSibling;
203 until ANode = nil;
204
205 Label1.Caption := IntToStr(ListView1.Items.Count + 1);
206 if LockOnlineAddres then begin
207 Form1.CoolTrayIcon1.Hint := IntToStr(ListView1.Items.Count + 1)+' hráčů';
208 // Form1.StatusBar1.SimpleText := 'Online hráči aktualizováni';
209 end else begin
210 Form1.CoolTrayIcon1.Hint := Form1.Servers[OnlinePlayersIndex].Name + ': ' + IntToStr(ListView1.Items.Count + 1) + ' hráčů';
211 // Form1.StatusBar1.SimpleText := 'O.H. aktualizováni: '+Form1.Servers[OnlinePlayersIndex].Name;
212 end;
213
214 except
215 On E : Exception do begin
216 Form1.StatusBar1.SimpleText := 'Chyba zjištění online hráčů';
217 ListView1.Clear;
218 Label1.Caption := '';
219 end;
220 end;
221 if LockOnlineAddres = False then
222 if Form1.Servers[OnlinePlayersIndex].OnlinePlayersAddress = '' then
223 Form1.StatusBar1.SimpleText := 'Adresa online hráčů nenalezena';
224
225 if LockOnlineAddres then
226 Caption := 'Online Hráči'
227 else
228 Caption := 'OnlineHráči-' + Form1.Servers[OnlinePlayersIndex].Name;
229
230
231 // Zjišťování, zda se připojil nový přítel
232 if FirstDownload = False then begin
233 if ListView2.Items.Count > length(OldOnlineFriend) then begin
234 if BeepAfterNewFriend then
235 Beep;
236 if FriendPlaySound then
237 Form1.MediaPlay(FriendSoundFile);
238 for i := 0 to ListView2.Items.Count - 1 do begin
239 if IsStringInArray(ListView2.Items[i].Caption,OldOnlineFriend) then
240 Form1.CoolTrayIcon1.ShowBalloonHint(Form1.Caption + ' - Připojil se kamarád',ListView2.Items[i].Caption + ' se připojil', bitInfo, 10);
241 end;
242 end;
243 end;
244
245 Form5.ListView1.AlphaSort;
246 XMLDocument1.Active := False;
247end;
248
249procedure TForm5.Button1Click(Sender: TObject);
250begin
251 DownloadPlayers;
252end;
253
254procedure TForm5.LoadRegOptions;
255var
256 reg: TRegistry;
257 i, Count: integer;
258begin
259 Reg := TRegistry.Create;
260 try
261 // Načítání pozice formuláře
262 if Reg.OpenKey(R + 'FormOnlinePlayers', False) then begin
263 Top := Reg.ReadInteger('Top');
264 Left := Reg.ReadInteger('Left');
265 Height := Reg.ReadInteger('Height');
266 Width := Reg.ReadInteger('Width');
267 if Reg.ReadBool('Maximized') then
268 WindowState := wsMaximized
269 else
270 WindowState := wsNormal;
271 end;
272
273 if Reg.OpenKey(R+'OnlinePlayersOptions', False) then begin
274 ListView1.Columns[0].Width := Reg.ReadInteger('Columns0Width');
275 ListView1.Columns[1].Width := Reg.ReadInteger('Columns1Width');
276 ListView1.Columns[2].Width := Reg.ReadInteger('Columns2Width');
277 ListView1.Columns[3].Width := Reg.ReadInteger('Columns3Width');
278
279 ListView2.Columns[0].Width := Reg.ReadInteger('Columns0Width');
280 ListView2.Columns[1].Width := Reg.ReadInteger('Columns1Width');
281 ListView2.Columns[2].Width := Reg.ReadInteger('Columns2Width');
282 ListView2.Columns[3].Width := Reg.ReadInteger('Columns3Width');
283
284 if reg.ValueExists('PanelTop') then Panel2.Top := Reg.ReadInteger('PanelTop');
285
286 if reg.ValueExists('Beep') then BeepAfterNewFriend := Reg.ReadBool('Beep');
287 if reg.ValueExists('ShowBalloon') then ShowBalloonHintAfterNewFriend := Reg.ReadBool('ShowBalloon');
288 if reg.ValueExists('FriendSoundFile') then FriendSoundFile := Reg.ReadString('FriendSoundFile');
289 if reg.ValueExists('FriendPlaySound') then FriendPlaySound := Reg.ReadBool('FriendPlaySound');
290 if reg.ValueExists('LockAddres') then LockAddres := Reg.ReadString('LockAddres');
291 if reg.ValueExists('LockOnlineAddres') then LockOnlineAddres := Reg.ReadBool('LockOnlineAddres');
292 end;
293
294 if Reg.OpenKey(R + 'Friends', False) then begin
295 Count := Reg.ReadInteger('Count');
296 SetLength(Friends, Count);
297 for i:=0 to Count - 1 do begin
298 Friends[i] := Reg.ReadString('Friend' + IntToStr(i));
299 end;
300 end;
301
302 finally
303 Reg.Free;
304 end;
305end;
306
307procedure TForm5.SaveRegOptions;
308var
309 reg: TRegistry;
310 i: integer;
311begin
312 Reg := TRegistry.Create(KEY_WRITE);
313 try
314 Reg.RootKey := HKEY_CURRENT_USER;
315 // uložení pozice formuláře
316 if Reg.OpenKey(R+'FormOnlinePlayers', True) then begin
317 Reg.WriteInteger('Top', Top);
318 Reg.WriteInteger('Left', Left);
319 Reg.WriteInteger('Height', Height);
320 Reg.WriteInteger('Width', Width);
321 Reg.WriteBool('Maximized', WindowState = wsMaximized);
322 end;
323
324
325 if Reg.OpenKey(R+'OnlinePlayersOptions', True) then begin
326 Reg.WriteInteger('Columns0Width',ListView1.Columns[0].Width);
327 Reg.WriteInteger('Columns1Width',ListView1.Columns[1].Width);
328 Reg.WriteInteger('Columns2Width',ListView1.Columns[2].Width);
329 Reg.WriteInteger('Columns3Width',ListView1.Columns[3].Width);
330 Reg.WriteBool('Beep',BeepAfterNewFriend);
331 Reg.WriteBool('ShowBalloon',ShowBalloonHintAfterNewFriend);
332 Reg.WriteInteger('PanelTop',Panel2.Top);
333 Reg.WriteString('FriendSoundFile',FriendSoundFile);
334 Reg.WriteBool('FriendPlaySound',FriendPlaySound);
335 Reg.WriteString('LockAddres',LockAddres);
336 Reg.WriteBool('LockOnlineAddres',LockOnlineAddres);
337 end;
338
339 if Reg.OpenKey(R+'Friends', True) then begin
340 Reg.WriteInteger('Count',Length(Friends));
341 for i:=0 to Length(Friends)-1 do begin
342 Reg.WriteString('Friend'+IntToStr(i),Friends[i]);
343 end;
344 end;
345
346 finally
347 Reg.Free;
348 end;
349end;
350
351procedure TForm5.ListView1ColumnClick(Sender: TObject;
352 Column: TListColumn);
353begin
354 ColumnIndexSoft := Column.Index;
355 ListView1.AlphaSort;
356end;
357
358function Order(Item1, Item2: TListItem;
359 ParamSort: integer): integer; stdcall;
360begin
361 Result := -AnsiCompareText(TListItem(Item1).Caption, TListItem(Item2).Caption);
362end;
363
364function OrderMap(Item1, Item2: TListItem;
365 ParamSort: integer): integer; stdcall;
366begin
367 Result := -AnsiCompareText(TListItem(Item1).SubItems[1], TListItem(Item2).SubItems[1]);
368end;
369
370function OrderZone(Item1, Item2: TListItem;
371 ParamSort: integer): integer; stdcall;
372begin
373 Result := -AnsiCompareText(TListItem(Item1).SubItems[2], TListItem(Item2).SubItems[2]);
374end;
375
376function OrderNumber(Item1, Item2: TListItem;
377 ParamSort: integer): integer; stdcall;
378begin
379 if StrToInt(Item1.SubItems[0]) > StrToInt(Item2.SubItems[0]) then
380 result := -1
381 else
382 if StrToInt(Item1.SubItems[0]) < StrToInt(Item2.SubItems[0]) then
383 result := 1
384 else // intItem1 = intItem2
385 result := 0;
386end;
387
388procedure TForm5.ListView1Compare(Sender: TObject; Item1, Item2: TListItem;
389 Data: Integer; var Compare: Integer);
390begin
391 case ColumnIndexSoft of
392 1:begin
393 if StrToInt(ListView1.Items[0].SubItems[0]) > StrToInt(ListView1.Items[ListView1.Items.count - 1].SubItems[0]) then
394 Compare := -OrderNumber(Item1, Item2, Compare)
395 else
396 Compare := OrderNumber(Item1, Item2, Compare);
397 end;
398 2:begin
399 if AnsiCompareText(ListView1.Items[0].SubItems[1], ListView1.Items[ListView1.Items.count - 1].SubItems[1]) = -1 then
400 Compare := OrderMap(Item1, Item2, Compare)
401 else
402 Compare := -OrderMap(Item1, Item2, Compare);
403 end;
404 3:begin
405 if AnsiCompareText(ListView1.Items[0].SubItems[2], ListView1.Items[ListView1.Items.count - 1].SubItems[2]) = -1 then
406 Compare := OrderZone(Item1, Item2, Compare)
407 else
408 Compare := -OrderZone(Item1, Item2, Compare);
409 end;
410 else
411 if AnsiCompareText(ListView1.Items[0].Caption, ListView1.Items[ListView1.Items.count-1].Caption) = -1 then
412 Compare := Order(Item1, Item2, Compare)
413 else
414 Compare := -Order(Item1, Item2, Compare);
415 end;
416end;
417
418procedure TForm5.PopupMenuItemsClick(Sender: TObject);
419begin
420 with Sender as TMenuItem do
421 begin
422 OnlinePlayersIndex := Tag;
423 Form5.DownloadPlayers;
424 end;
425end;
426
427function TForm5.GetNameMap(ID: string): string;
428begin
429 Result := ID;
430 if ID = '0' then Result := 'Azeroth';
431 if ID = '1' then Result := 'Kalimdor';
432 if ID = '13' then Result := 'test';
433 if ID = '25' then Result := 'Scott Test';
434 if ID = '29' then Result := 'Cash Test';
435 if ID = '30' then Result := 'PVP Zone 01';
436 if ID = '33' then Result := 'Shadowfang';
437 if ID = '34' then Result := 'Stormwind Jail';
438 if ID = '35' then Result := 'Stormwind Prizon';
439 if ID = '36' then Result := 'Deadmines Instance';
440 if ID = '37' then Result := 'PVP Zone 02';
441 if ID = '42' then Result := 'Collin s Test';
442 if ID = '43' then Result := 'Wailing Caverns Instance';
443 if ID = '44' then Result := 'Monastery Interior';
444 if ID = '47' then Result := 'Razorfen Kraul Instance';
445 if ID = '48' then Result := 'Blackfathom Instance';
446 if ID = '70' then Result := 'Uldaman Instance';
447 if ID = '90' then Result := 'Gnomeragon Instance';
448 if ID = '109' then Result := 'Sunken Temple Instance';
449 if ID = '129' then Result := 'Razorfen Downs Instance';
450 if ID = '169' then Result := 'Emerald Dream';
451 if ID = '189' then Result := 'Monastery Instances';
452 if ID = '209' then Result := 'Zul'+chr(39)+'farrak';
453 if ID = '229' then Result := 'Blackrock Upper Instance';
454 if ID = '230' then Result := 'Blackrock Lower Instance';
455 if ID = '249' then Result := 'Onyxias Lair Instance';
456 if ID = '269' then Result := 'Caverns of Time';
457 if ID = '289' then Result := 'School of Necromancy';
458 if ID = '309' then Result := 'Zul'+chr(39)+'gurub';
459 if ID = '329' then Result := 'Stratholme';
460 if ID = '369' then Result := 'Deeprun Tram';
461 if ID = '389' then Result := 'Orgrimmar Instance';
462 if ID = '349' then Result := 'Mauradon';
463 if ID = '409' then Result := 'Molten Core';
464 if ID = '429' then Result := 'Dire Maul';
465 if ID = '449' then Result := 'Alliance PVP Barracks';
466 if ID = '450' then Result := 'Horde PVP Barracks';
467 if ID = '451' then Result := 'Development Land';
468 if ID = '469' then Result := 'Blackwing Lair';
469
470 if ID = '489' then Result := 'Warsongská rokle';
471 if ID = '509' then Result := 'Ruiny Ahn'+chr(39)+'Qiraj';
472 if ID = '529' then Result := 'Arathitská baľina';
473 if ID = '530' then Result := 'Outland';
474 if ID = '531' then Result := 'Chrám Ahn'+chr(39)+'Qiraj';
475 if ID = '532' then Result := 'Karazahn';
476 if ID = '533' then Result := 'Naxxramas';
477 if ID = '534' then Result := 'Hyjal Past';
478 if ID = '540' then Result := 'The Shattered síně';
479 if ID = '542' then Result := 'The Blood Furnace';
480 if ID = '543' then Result := 'Hellfire Ramparts';
481 if ID = '544' then Result := 'Magtheridon'+chr(39)+'s doupě';
482 if ID = '545' then Result := 'The Steamvault';
483 if ID = '546' then Result := 'The Underbog';
484 if ID = '547' then Result := 'The Slave Pens';
485 if ID = '548' then Result := 'Serpentshrine jeskyně';
486 if ID = '550' then Result := 'Eye of the Storm';
487 if ID = '552' then Result := 'The Arcatraz';
488 if ID = '553' then Result := 'The Botanica';
489 if ID = '554' then Result := 'The Mechanar';
490 if ID = '555' then Result := 'Shadow Labyrinth';
491 if ID = '556' then Result := 'Sethekk Halls';
492 if ID = '557' then Result := 'Mana-Tombs';
493 if ID = '558' then Result := 'Krypta Auchenai';
494 if ID = '559' then Result := 'Aréna Nagrand';
495 if ID = '560' then Result := 'Old Hillsbrad Foothills';
496 if ID = '562' then Result := 'Blade'+chr(39)+'s Edge Arena';
497 if ID = '564' then Result := 'Černý chrám';
498 if ID = '565' then Result := 'Gruul'+chr(39)+'s doupě';
499 if ID = '566' then Result := 'Netherstormská Arena';
500 if ID = '568' then Result := 'Zul'+chr(39)+'Aman';
501
502{ <xsl:when test="map = 0">Azeroth</xsl:when>
503 <xsl:when test="map = 1">Kalimdor</xsl:when>
504 <xsl:when test="map = 13">test</xsl:when>
505 <xsl:when test="map = 25">Scott Test</xsl:when>
506 <xsl:when test="map = 29">Cash Test</xsl:when>
507 <xsl:when test="map = 30">PVP Zone 01</xsl:when>
508 <xsl:when test="map = 33">Shadowfang</xsl:when>
509 <xsl:when test="map = 34">Stormwind Jail</xsl:when>
510 <xsl:when test="map = 35">Stormwind Prizon</xsl:when>
511 <xsl:when test="map = 36">Deadmines Instance</xsl:when>
512 <xsl:when test="map = 37">PVP Zone 02</xsl:when>
513 <xsl:when test="map = 42">Collin's Test</xsl:when>
514 <xsl:when test="map = 43">Wailing Caverns Instance</xsl:when>
515 <xsl:when test="map = 44">Monastery Interior</xsl:when>
516 <xsl:when test="map = 47">Razorfen Kraul Instance</xsl:when>
517 <xsl:when test="map = 48">Blackfathom Instance</xsl:when>
518 <xsl:when test="map = 70">Uldaman Instance</xsl:when>
519 <xsl:when test="map = 90">Gnomeragon Instance</xsl:when>
520 <xsl:when test="map = 109">Sunken Temple Instance</xsl:when>
521 <xsl:when test="map = 129">Razorfen Downs Instance</xsl:when>
522 <xsl:when test="map = 169">Emerald Dream</xsl:when>
523 <xsl:when test="map = 189">Monastery Instances</xsl:when>
524 <xsl:when test="map = 209">Zul'farrak</xsl:when>
525 <xsl:when test="map = 229">Blackrock Upper Instance</xsl:when>
526 <xsl:when test="map = 230">Blackrock Lower Instance</xsl:when>
527 <xsl:when test="map = 249">Onyxias Lair Instance</xsl:when>
528 <xsl:when test="map = 269">Caverns of Time</xsl:when>
529 <xsl:when test="map = 289">School of Necromancy</xsl:when>
530 <xsl:when test="map = 309">Zul'gurub</xsl:when>
531 <xsl:when test="map = 329">Stratholme</xsl:when>
532 <xsl:when test="map = 369">Deeprun Tram</xsl:when>
533 <xsl:when test="map = 389">Orgrimmar Instance</xsl:when>
534 <xsl:when test="map = 349">Mauradon</xsl:when>
535 <xsl:when test="map = 409">Molten Core</xsl:when>
536 <xsl:when test="map = 429">Dire Maul</xsl:when>
537 <xsl:when test="map = 449">Alliance PVP Barracks</xsl:when>
538 <xsl:when test="map = 450">Horde PVP Barracks</xsl:when>
539 <xsl:when test="map = 451">Development Land</xsl:when>
540 <xsl:when test="map = 469">Blackwing Lair</xsl:when>
541
542 0 => array(0,$lang_id_tab['azeroths']),
543 1 => array(1,$lang_id_tab['kalimdor']),
544 13 => array(13,$lang_id_tab['test_zone']),
545 17 => array(17,$lang_id_tab['kalidar']),
546 30 => array(30,$lang_id_tab['alterac_valley']),
547 33 => array(33,$lang_id_tab['shadowfang_keep_instance']),
548 34 => array(34,$lang_id_tab['the_stockade_instance']),
549 35 => array(35,$lang_id_tab['stormwind_prison']),
550 36 => array(36,$lang_id_tab['deadmines_instance']),
551 37 => array(37,$lang_id_tab['plains_of_snow']),
552 43 => array(43,$lang_id_tab['wailing_caverns_instance']),
553 44 => array(44,$lang_id_tab['monastery_interior']),
554 47 => array(47,$lang_id_tab['razorfen_kraul_instance']),
555 48 => array(48,$lang_id_tab['blackfathom_deeps_instance']),
556 70 => array(70,$lang_id_tab['uldaman_instance']),
557 90 => array(90,$lang_id_tab['gnomeregan_instance']),
558 109 => array(109,$lang_id_tab['sunken_temple_instance']),
559 129 => array(129,$lang_id_tab['razorfen_downs_instance']),
560 150 => array(150,$lang_id_tab['outland']),
561 169 => array(169,$lang_id_tab['emerald_forest']),
562 189 => array(189,$lang_id_tab['scarlet_monastery_instance']),
563 209 => array(209,$lang_id_tab['zul_farrak_instance']),
564 229 => array(229,$lang_id_tab['blackrock_spire_instance']),
565 230 => array(230,$lang_id_tab['blackrock_depths_instance']),
566 249 => array(249,$lang_id_tab['onyxia_s_lair_instance']),
567 269 => array(269,$lang_id_tab['cot_black_morass']),
568 289 => array(289,$lang_id_tab['scholomance_instance']),
569 309 => array(309,$lang_id_tab['zul_gurub_instance']),
570 329 => array(329,$lang_id_tab['stratholme_instance']),
571 349 => array(349,$lang_id_tab['maraudon_instance']),
572 369 => array(369,$lang_id_tab['deeprun_tram']),
573 389 => array(389,$lang_id_tab['ragefire_chasm_instance']),
574 409 => array(409,$lang_id_tab['the_molten_core_instance']),
575 429 => array(429,$lang_id_tab['dire_maul_instance']),
576 449 => array(449,$lang_id_tab['alliance_pvp_barracks']),
577 450 => array(450,$lang_id_tab['horde_pvp_barracks']),
578 451 => array(451,$lang_id_tab['development_land']),
579 469 => array(469,$lang_id_tab['blackwing_lair_instance']),
580 489 => array(489,$lang_id_tab['warsong_gulch']),
581 509 => array(509,$lang_id_tab['ruins_of_ahn_qiraj_instance']),
582 529 => array(529,$lang_id_tab['arathi_basin']),
583 530 => array(530,$lang_id_tab['outland']),
584 531 => array(531,$lang_id_tab['temple_of_ahn_qiraj_instance']),
585 532 => array(532,$lang_id_tab['karazahn']),
586 533 => array(533,$lang_id_tab['naxxramas_instance']),
587 534 => array(534,$lang_id_tab['cot_hyjal_past']),
588 540 => array(540,$lang_id_tab['hellfire_military']),
589 542 => array(542,$lang_id_tab['hellfire_demon']),
590 543 => array(543,$lang_id_tab['hellfire_rampart']),
591 544 => array(544,$lang_id_tab['hellfire_raid']),
592 545 => array(545,$lang_id_tab['coilfang_pumping']),
593 546 => array(546,$lang_id_tab['coilfang_marsh']),
594 547 => array(547,$lang_id_tab['coilfang_draenei']),
595 548 => array(548,$lang_id_tab['coilfang_raid']),
596 550 => array(550,$lang_id_tab['tempest_keep_raid']),
597 552 => array(552,$lang_id_tab['tempest_keep_arcane']),
598 553 => array(553,$lang_id_tab['tempest_keep_atrium']),
599 554 => array(554,$lang_id_tab['tempest_keep_factory']),
600 555 => array(555,$lang_id_tab['auchindoun_shadow']),
601 556 => array(556,$lang_id_tab['auchindoun_arakkoa']),
602 557 => array(557,$lang_id_tab['auchindoun_ethereal']),
603 558 => array(558,$lang_id_tab['auchindoun_draenei']),
604 559 => array(559,$lang_id_tab['nagrand_arena']),
605 560 => array(560,$lang_id_tab['cot_hillsbrad_past']),
606 562 => array(562,$lang_id_tab['blades_edge_arena']),
607 564 => array(564,$lang_id_tab['black_temple']),
608 565 => array(565,$lang_id_tab['gruuls_lair']),
609 566 => array(566,$lang_id_tab['netherstorm_arena']),
610 568 => array(568,$lang_id_tab['zulaman'])
611
612 'cot_black_morass' => 'The Black Morass',
613 'karazahn' => 'Karazahn',
614 'cot_hyjal_past' => 'Hyjal Past',
615 'hellfire_military' => 'The Shattered síně',
616 'hellfire_demon' => 'The Blood Furnace',
617 'hellfire_rampart' => 'Hellfire Ramparts',
618 'hellfire_raid' => 'Magtheridon\'s doupě',
619 'coilfang_pumping' => 'The Steamvault',
620 'coilfang_marsh' => 'The Underbog',
621 'coilfang_draenei' => 'The Slave Pens',
622 'coilfang_raid' => 'Serpentshrine jeskyně',
623 'tempest_keep_raid' => 'Eye of the Storm',
624 'tempest_keep_arcane' => 'The Arcatraz',
625 'tempest_keep_atrium' => 'The Botanica',
626 'tempest_keep_factory' => 'The Mechanar',
627 'auchindoun_shadow' => 'Shadow Labyrinth',
628 'auchindoun_arakkoa' => 'Sethekk Halls',
629 'auchindoun_ethereal' => 'Mana-Tombs',
630 'auchindoun_draenei' => 'Krypta Auchenai',
631 'nagrand_arena' => 'Aréna Nagrand',
632 'cot_hillsbrad_past' => 'Old Hillsbrad Foothills',
633 'blades_edge_arena' => 'Blade\'s Edge Arena',
634 'black_temple' => 'Černý chrám',
635 'gruuls_lair' => 'Gruul\'s doupě',
636 'netherstorm_arena' => 'Netherstormská Arena',
637 'zulaman' => 'Zul\'Aman',
638
639 }
640end;
641
642function TForm5.GetNameZone(ID: string): string;
643begin
644 if ID <> '0' then Result := ID else Result := '';
645
646 if ID = '406' then Result := 'Stonetalon Mountains';
647 if ID = '15' then Result := 'Dustwallow';
648 if ID = '1377' then Result := 'Silithus';
649 if ID = '1519' then Result := 'Stormwind';
650 if ID = '1637' then Result := 'Ogrimmar';
651 if ID = '1497' then Result := 'Undercity';
652 if ID = '2597' then Result := 'Alterac Valley';
653 if ID = '357' then Result := 'Feralas';
654 if ID = '440' then Result := 'Tanaris';
655 if ID = '14' then Result := 'Durotar';
656 if ID = '215' then Result := 'Mulgore';
657 if ID = '17' then Result := 'Barrens';
658 if ID = '36' then Result := 'Alterac Mountains';
659 if ID = '45' then Result := 'Arathi';
660 if ID = '3' then Result := 'Badlands';
661 if ID = '4' then Result := 'Blasted Lands';
662 if ID = '85' then Result := 'Tirisfal';
663 if ID = '130' then Result := 'Silverpine';
664 if ID = '28' then Result := 'Western Plaguelands';
665 if ID = '139' then Result := 'Eastern Plaguelands';
666 if ID = '267' then Result := 'Hilsbrad';
667 if ID = '47' then Result := 'Hinterlands';
668 if ID = '1' then Result := 'Dun Morogh';
669 if ID = '51' then Result := 'Searing Gorge';
670 if ID = '46' then Result := 'Burning Steppes';
671 if ID = '12' then Result := 'Elwynn Forest';
672 if ID = '41' then Result := 'Deadwind Pass';
673 if ID = '10' then Result := 'Duskwood';
674 if ID = '38' then Result := 'Loch Modan';
675 if ID = '44' then Result := 'Redridge';
676 if ID = '33' then Result := 'Stranglethorn';
677 if ID = '8' then Result := 'Swamp Of Sorrows';
678 if ID = '40' then Result := 'Westfall';
679 if ID = '11' then Result := 'Wetlands';
680 if ID = '141' then Result := 'Teldrassil';
681 if ID = '148' then Result := 'Darkshore';
682 if ID = '331' then Result := 'Ashenvale';
683 if ID = '405' then Result := 'Desolace';
684 if ID = '400' then Result := 'Thousand Needles';
685 if ID = '16' then Result := 'Aszhara';
686 if ID = '361' then Result := 'Felwood';
687 if ID = '618' then Result := 'Winterspring';
688 if ID = '1537' then Result := 'Ironforge';
689 if ID = '1657' then Result := 'Darnassus';
690 if ID = '490' then Result := 'Ungoro Crater';
691 if ID = '493' then Result := 'Moonglade';
692 if ID = '719' then Result := 'Dungeon';
693 if ID = '1638' then Result := 'Thunder Bluff';
694 if ID = '2100' then Result := 'The Wicked Grotto';
695
696{ <xsl:when test="zone = 406">Stonetalon Mountains</xsl:when>
697 <xsl:when test="zone = 15">Dustwallow</xsl:when>
698 <xsl:when test="zone = 1377">Silithus</xsl:when>
699 <xsl:when test="zone = 1519">Stormwind</xsl:when>
700 <xsl:when test="zone = 1637">Ogrimmar</xsl:when>
701 <xsl:when test="zone = 1497">Undercity</xsl:when>
702 <xsl:when test="zone = 2597">Alterac Valley</xsl:when>
703 <xsl:when test="zone = 357">Feralas</xsl:when>
704 <xsl:when test="zone = 440">Tanaris</xsl:when>
705 <xsl:when test="zone = 14">Durotar</xsl:when>
706 <xsl:when test="zone = 215">Mulgore</xsl:when>
707 <xsl:when test="zone = 17">Barrens</xsl:when>
708 <xsl:when test="zone = 36">Alterac Mountains</xsl:when>
709 <xsl:when test="zone = 45">Arathi</xsl:when>
710 <xsl:when test="zone = 3">Badlands</xsl:when>
711 <xsl:when test="zone = 4">Blasted Lands</xsl:when>
712 <xsl:when test="zone = 85">Tirisfal</xsl:when>
713 <xsl:when test="zone = 130">Silverpine</xsl:when>
714 <xsl:when test="zone = 28">Western Plaguelands</xsl:when>
715 <xsl:when test="zone = 139">Eastern Plaguelands</xsl:when>
716 <xsl:when test="zone = 267">Hilsbrad</xsl:when>
717 <xsl:when test="zone = 47">Hinterlands</xsl:when>
718 <xsl:when test="zone = 1">Dun Morogh</xsl:when>
719 <xsl:when test="zone = 51">Searing Gorge</xsl:when>
720 <xsl:when test="zone = 46">Burning Steppes</xsl:when>
721 <xsl:when test="zone = 12">Elwynn Forest</xsl:when>
722 <xsl:when test="zone = 41">Deadwind Pass</xsl:when>
723 <xsl:when test="zone = 10">Duskwood</xsl:when>
724 <xsl:when test="zone = 38">Loch Modan</xsl:when>
725 <xsl:when test="zone = 44">Redridge</xsl:when>
726 <xsl:when test="zone = 33">Stranglethorn</xsl:when>
727 <xsl:when test="zone = 8">Swamp Of Sorrows</xsl:when>
728 <xsl:when test="zone = 40">Westfall</xsl:when>
729 <xsl:when test="zone = 11">Wetlands</xsl:when>
730 <xsl:when test="zone = 141">Teldrassil</xsl:when>
731 <xsl:when test="zone = 148">Darkshore</xsl:when>
732 <xsl:when test="zone = 331">Ashenvale</xsl:when>
733 <xsl:when test="zone = 405">Desolace</xsl:when>
734 <xsl:when test="zone = 400">Thousand Needles</xsl:when>
735 <xsl:when test="zone = 16">Aszhara</xsl:when>
736 <xsl:when test="zone = 361">Felwood</xsl:when>
737 <xsl:when test="zone = 618">Winterspring</xsl:when>
738 <xsl:when test="zone = 1537">Ironforge</xsl:when>
739 <xsl:when test="zone = 1657">Darnassus</xsl:when>
740 <xsl:when test="zone = 490">Ungoro Crater</xsl:when>
741 <xsl:when test="zone = 493">Moonglade</xsl:when>
742 <xsl:when test="zone = 719">Dungeon</xsl:when>
743 <xsl:when test="zone = 1638">Thunder Bluff</xsl:when>
744 <xsl:when test="zone = 2100">The Wicked Grotto</xsl:when>
745
746 }
747end;
748
749procedure TForm5.Button2MouseDown(Sender: TObject; Button: TMouseButton;
750 Shift: TShiftState; X, Y: Integer);
751var
752 i: integer;
753 NewMenuItem: TMenuItem;
754 MousePos: TPoint;
755begin
756 PopupMenu1.Items.Clear;
757 for I:= 0 to HIGh(Form1.servers) do begin
758 if Form1.servers[i].OnlinePlayersAddress <> '' then begin
759 NewMenuItem := TMenuItem.Create(PopupMenu1); // create the new item
760 PopupMenu1.Items.Insert(0, NewMenuItem);// add it to the Popupmenu
761 NewMenuItem.Caption := Form1.servers[i].Name;
762 NewMenuItem.Tag := I;
763 NewMenuItem.OnClick := PopupMenuItemsClick;// assign it an event handler
764 NewMenuItem.ImageIndex := i;
765 end;
766 end;
767 GetCursorPos(MousePos);
768 PopupMenu1.Popup(MousePos.X,MousePos.y);
769end;
770
771procedure TForm5.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
772 Shift: TShiftState; X, Y: Integer);
773var
774 MousePos: TPoint;
775begin
776 if Assigned(ListView1.GetItemAt(x,y)) and (Button = mbRight) then begin
777 GetCursorPos(MousePos);
778 PopupMenu2.Popup(MousePos.X,MousePos.y);
779 end;
780end;
781
782procedure TForm5.Pidatdoseznamuptel1Click(Sender: TObject);
783begin
784 if Assigned(ListView1.Selected) then begin
785 if IsStringInArray(ListView1.Selected.Caption,Friends) then begin
786 SetLength(Friends,length(Friends) + 1);
787 Friends[length(Friends) - 1] := ListView1.Selected.Caption;
788 with ListView2.Items.Add do begin
789 Caption := ListView1.Selected.Caption;
790 SubItems.Add(ListView1.Selected.SubItems[0]);
791 SubItems.Add(ListView1.Selected.SubItems[1]);
792 SubItems.Add(ListView1.Selected.SubItems[2]);
793 ImageIndex := ListView1.Selected.ImageIndex;
794 StateIndex := ListView1.Selected.StateIndex;
795 end;
796 end;
797 end;
798end;
799
800procedure TForm5.Panel2MouseDown(Sender: TObject; Button: TMouseButton;
801 Shift: TShiftState; X, Y: Integer);
802begin
803 DragDown := true;
804 GetCursorPos(StartPosition);
805end;
806
807procedure TForm5.Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
808 Y: Integer);
809var
810 Position: TPoint;
811begin
812 if DragDown then begin
813 GetCursorPos(Position);
814 if Position.Y - Top - Panel2.Height < Height - 38 then
815 Panel2.Top := Position.Y - Top - Panel2.Height - 16
816 else
817 Panel2.Top := Height - 35;
818 DrawForm;
819 end;
820end;
821
822procedure TForm5.Panel2MouseUp(Sender: TObject; Button: TMouseButton;
823 Shift: TShiftState; X, Y: Integer);
824begin
825 DragDown := false;
826end;
827
828procedure TForm5.DrawForm;
829begin
830 ListView1.Height := Panel2.Top - 20;
831 ListView2.Top := Panel2.Top + Panel2.Height;
832 ListView2.Height := Height - Panel2.Top - Panel2.Height - 20;
833
834end;
835
836function TForm5.IsStringInArray(Find: string;
837 ArrayOfString: array of string): Boolean;
838var
839 i: integer;
840 NewFriend: Boolean;
841begin
842 NewFriend := True;
843 for i := 0 to length(ArrayOfString) - 1 do begin
844 if (GetLowerString(Find) = GetLowerString(ArrayOfString[i])) then
845 NewFriend := False;
846 end;
847
848 if NewFriend then
849 Result := True
850 else
851 Result := False;
852end;
853
854procedure TForm5.FormResize(Sender: TObject);
855begin
856// DrawForm;
857
858end;
859
860procedure TForm5.FormShow(Sender: TObject);
861begin
862 if Form1.Timer2.Enabled then
863 DownloadPlayers;
864 if Form1.OnlineHri1.Checked and (StartMinimalize = false) then
865 Form5.Show;
866 // zablokování tlačítka při nastavení pevné adresy
867 if LockOnlineAddres then
868 Form5.Button2.Enabled := False
869 else Form5.Button2.Enabled := True;
870
871 DrawForm;
872end;
873
874function TForm5.GetLowerString(Text: string): string;
875begin
876 Result := StrLower(Pchar(Text));
877end;
878
879procedure TForm5.Smazatzseznamu1Click(Sender: TObject);
880var
881 i: integer;
882 YetWas: Boolean;
883begin
884 YetWas := False;
885 if Assigned(ListView2.Selected) then begin
886 for i := 0 to High(Friends) do begin
887 if YetWas then
888 Friends[i - 1] := Friends[i];
889
890 if (GetLowerString(Friends[i]) = GetLowerString(ListView2.Selected.Caption)) then
891 YetWas := true;
892 end;
893 SetLength(Friends, Length(Friends) - 1);
894 ListView2.Selected.Delete;
895 end;
896end;
897
898procedure TForm5.ListView2MouseDown(Sender: TObject; Button: TMouseButton;
899 Shift: TShiftState; X, Y: Integer);
900var
901 MousePos: TPoint;
902begin
903 if Assigned(ListView2.GetItemAt(x, y)) and (Button = mbRight) then begin
904 GetCursorPos(MousePos);
905 PopupMenu3.Popup(MousePos.X, MousePos.y);
906 end;
907end;
908
909end.
Note: See TracBrowser for help on using the repository browser.