Требование: PHP => 5.3, часть 2
[cswow.git] / include / map_data.php
blobdc4d66934ae28c6ba2faa0e17dc2bd3dfc3d5f63
1 <?php
2 include_once("include/functions.php");
3 // Áàçû äàííûõ
5 //******************************************************************************
6 // Òàáëèöà ïðåîáðàçîâàíèÿ ãëîáàëüíûõ êîîðäèíàò â êîîðäèíàòû íà êàðòèíêå êàðòû
7 // ôîðìàò id=> Map, areaID, Y1, Y2, X1, X2, filename
8 $gAreaImagesCoord =array(
9 //******************************************************************************
10 //************************ Azeroth Areas ***************************************
11 //******************************************************************************
12 14=>array( 0, 0, 18171.971, -22569.211, 11176.344, -15973.344, "azeroth/0".$lang['maplang'].".jpg"),
13 15=>array( 0, 36, 783.333313, -2016.666626, 1500, -366.6666565, "azeroth/36".$lang['maplang'].".jpg"),
14 16=>array( 0, 45, -866.666626, -4466.666504, -133.3333282, -2533.333252, "azeroth/45".$lang['maplang'].".jpg"),
15 17=>array( 0, 3, -2079.166504, -4566.666504, -5889.583008, -7547.916504, "azeroth/3".$lang['maplang'].".jpg"),
16 19=>array( 0, 4, -1241.666626, -4591.666504, -10566.66602, -12800, "azeroth/4".$lang['maplang'].".jpg"),
17 20=>array( 0, 85, 3033.333252, -1485.416626, 3837.499756, 824.999939, "azeroth/85".$lang['maplang'].".jpg"),
18 21=>array( 0, 130, 3449.999756, -750, 1666.666626, -1133.333252, "azeroth/130".$lang['maplang'].".jpg"),
19 22=>array( 0, 28, 416.6666565, -3883.333252, 3366.666504, 499.9999695, "azeroth/28".$lang['maplang'].".jpg"),
20 23=>array( 0, 139, -2185.416504, -6056.25, 3799.999756, 1218.75, "azeroth/139".$lang['maplang'].".jpg"),
21 24=>array( 0, 267, 1066.666626, -2133.333252, 400, -1733.333252, "azeroth/267".$lang['maplang'].".jpg"),
22 26=>array( 0, 47, -1575, -5425, 1466.666626, -1100, "azeroth/47".$lang['maplang'].".jpg"),
23 27=>array( 0, 1, 1802.083252, -3122.916504, -3877.083252, -7160.416504, "azeroth/1".$lang['maplang'].".jpg"),
24 28=>array( 0, 51, -322.9166565, -2554.166504, -6100, -7587.499512, "azeroth/51".$lang['maplang'].".jpg"),
25 29=>array( 0, 46, -266.6666565, -3195.833252, -7031.249512, -8983.333008, "azeroth/46".$lang['maplang'].".jpg"),
26 30=>array( 0, 12, 1535.416626, -1935.416626, -7939.583008, -10254.16602, "azeroth/12".$lang['maplang'].".jpg"),
27 32=>array( 0, 41, -833.333313, -3333.333252, -9866.666016, -11533.33301, "azeroth/41".$lang['maplang'].".jpg"),
28 34=>array( 0, 10, 833.333313, -1866.666626, -9716.666016, -11516.66602, "azeroth/10".$lang['maplang'].".jpg"),
29 35=>array( 0, 38, -1993.749878, -4752.083008, -4487.5, -6327.083008, "azeroth/38".$lang['maplang'].".jpg"),
30 36=>array( 0, 44, -1570.833252, -3741.666504, -8575, -10022.91602, "azeroth/44".$lang['maplang'].".jpg"),
31 37=>array( 0, 33, 2220.833252, -4160.416504, -11168.75, -15422.91602, "azeroth/33".$lang['maplang'].".jpg"),
32 38=>array( 0, 8, -2222.916504, -4516.666504, -9620.833008, -11150, "azeroth/8".$lang['maplang'].".jpg"),
33 39=>array( 0, 40, 3016.666504, -483.333313, -9400, -11733.33301, "azeroth/40".$lang['maplang'].".jpg"),
34 40=>array( 0, 11, -389.583313, -4525, -2147.916504, -4904.166504, "azeroth/11".$lang['maplang'].".jpg"),
35 301=>array( 0, 1519, 1722.917, -14.583, -7995.833, -9154.166, "azeroth/1519".$lang['maplang'].".jpg"),
36 341=>array( 0, 1537, -713.5913696, -1504.216431, -4569.241211, -5096.845703, "azeroth/1537".$lang['maplang'].".jpg"),
37 382=>array( 0, 1497, 873.192627, -86.18240356, 1877.945313, 1237.841187, "azeroth/1497".$lang['maplang'].".jpg"),
38 //******************************************************************************
39 //************************ Kalimdor Areas **************************************
40 //******************************************************************************
41 13=>array( 1, 0, 17066.59961, -19733.21094, 12799.90039, -11733.2998, "kalimdor/1".$lang['maplang'].".jpg"),
42 4=>array( 1, 14, -1962.499878, -7249.999512, 1808.333252, -1716.666626, "kalimdor/14".$lang['maplang'].".jpg"),
43 9=>array( 1, 215, 2047.916626, -3089.583252, -272.9166565, -3697.916504, "kalimdor/215".$lang['maplang'].".jpg"),
44 11=>array( 1, 17, 2622.916504, -7510.416504, 1612.499878, -5143.75, "kalimdor/17".$lang['maplang'].".jpg"),
45 41=>array( 1, 141, 3814.583252, -1277.083252, 11831.25, 8437.5, "kalimdor/141".$lang['maplang'].".jpg"),
46 42=>array( 1, 148, 2941.666504, -3608.333252, 8333.333008, 3966.666504, "kalimdor/148".$lang['maplang'].".jpg"),
47 43=>array( 1, 331, 1699.999878, -4066.666504, 4672.916504, 829.166626, "kalimdor/331".$lang['maplang'].".jpg"),
48 61=>array( 1, 400, -433.333313, -4833.333008, -3966.666504, -6899.999512, "kalimdor/400".$lang['maplang'].".jpg"),
49 81=>array( 1, 406, 3245.833252, -1637.499878, 2916.666504, -339.583313, "kalimdor/406".$lang['maplang'].".jpg"),
50 101=>array( 1, 405, 4233.333008, -262.5, 452.083313, -2545.833252, "kalimdor/405".$lang['maplang'].".jpg"),
51 121=>array( 1, 357, 5441.666504, -1508.333252, -2366.666504, -6999.999512, "kalimdor/357".$lang['maplang'].".jpg"),
52 141=>array( 1, 15, -974.999939, -6225, -2033.333252, -5533.333008, "kalimdor/15".$lang['maplang'].".jpg"),
53 161=>array( 1, 440, -218.7499847, -7118.749512, -5875, -10475, "kalimdor/440".$lang['maplang'].".jpg"),
54 181=>array( 1, 16, -3277.083252, -8347.916016, 5341.666504, 1960.416626, "kalimdor/16".$lang['maplang'].".jpg"),
55 182=>array( 1, 361, 1641.666626, -4108.333008, 7133.333008, 3299.999756, "kalimdor/361".$lang['maplang'].".jpg"),
56 201=>array( 1, 490, 533.333313, -3166.666504, -5966.666504, -8433.333008, "kalimdor/490".$lang['maplang'].".jpg"),
57 241=>array( 1, 493, -1381.25, -3689.583252, 8491.666016, 6952.083008, "kalimdor/493".$lang['maplang'].".jpg"),
58 261=>array( 1, 1377, 2537.5, -945.8339844, -5958.333984, -8281.25, "kalimdor/1377".$lang['maplang'].".jpg"),
59 281=>array( 1, 618, -316.6666565, -7416.666504, 8533.333008, 3799.999756, "kalimdor/618".$lang['maplang'].".jpg"),
60 321=>array( 1, 1637, -3680.601074, -5083.205566, 2273.877197, 1338.460571, "kalimdor/1637".$lang['maplang'].".jpg"),
61 362=>array( 1, 1638, 516.666626, -527.083313, -849.999939, -1545.833252, "kalimdor/1638".$lang['maplang'].".jpg"),
62 381=>array( 1, 1657, 2938.362793, 1880.029541, 10238.31641, 9532.586914, "kalimdor/1657".$lang['maplang'].".jpg"),
63 //******************************************************************************
64 //***************************** BG Areas **************************************
65 //******************************************************************************
66 401=>array( 30, 2597, 1781.249878, -2456.25, 1085.416626, -1739.583252, "bg/2597".$lang['maplang'].".jpg"),
67 443=>array(489, 3277, 2041.666626, 895.833313, 1627.083252, 862.499939, "bg/3277".$lang['maplang'].".jpg"),
68 461=>array(529, 3358, 1858.333252, 102.0833282, 1508.333252, 337.5, "bg/3358".$lang['maplang'].".jpg"),
69 482=>array(566, 3820, 2660.416504, 389.583313, 2918.75, 1404.166626, "bg/3820".$lang['maplang'].".jpg"),
70 512=>array(607, 4384, 787.5, -956.25, 1883.333, 720.833, "bg/4384".$lang['maplang'].".jpg"),
71 540=>array(628, 4710, 525, -2125, 1708.33, -58.33, "bg/4710".$lang['maplang'].".jpg"),
72 //******************************************************************************
73 //************************* Island Areas **************************************
74 //******************************************************************************
75 480=>array(530, 3487, -6400.75, -7612.208496, 10153.70898, 9346.938477, "islands/3487".$lang['maplang'].".jpg"),
76 462=>array(530, 3430, -4487.5, -9412.5, 11041.66602, 7758.333008, "islands/3430".$lang['maplang'].".jpg"),
77 463=>array(530, 3433, -5283.333008, -8583.333008, 8266.666016, 6066.666504, "islands/3433".$lang['maplang'].".jpg"),
78 471=>array(530, 3557, -11066.36719, -12123.1377, -3609.68335, -4314.371094, "islands/3557".$lang['maplang'].".jpg"),
79 464=>array(530, 3524, -10500, -14570.83301, -2793.75, -5508.333008, "islands/3524".$lang['maplang'].".jpg"),
80 476=>array(530, 3525, -10075, -13337.49902, -758.333313, -2933.333252, "islands/3525".$lang['maplang'].".jpg"),
81 499=>array(530, 4080, -5302.083008, -8629.166016, 13568.74902, 11350, "islands/4080".$lang['maplang'].".jpg"),
82 502=>array(609, 4298, -4047.917, -7210.417, 3087.5, 979.167, "islands/4298".$lang['maplang'].".jpg"),
83 //******************************************************************************
84 //************************* Outland Areas **************************************
85 //******************************************************************************
86 466=>array(530, 0, 12996.03906, -4468.039063, 5821.359375, -5821.359375, "outland/530".$lang['maplang'].".jpg"),
87 465=>array(530, 3483, 5539.583008, 375, 1481.25, -1962.499878, "outland/3483".$lang['maplang'].".jpg"),
88 467=>array(530, 3521, 9475, 4447.916504, 1935.416626, -1416.666626, "outland/3521".$lang['maplang'].".jpg"),
89 473=>array(530, 3520, 4225, -1275, -1947.916626, -5614.583008, "outland/3520".$lang['maplang'].".jpg"),
90 475=>array(530, 3522, 8845.833008, 3420.833252, 4408.333008, 791.666626, "outland/3522".$lang['maplang'].".jpg"),
91 477=>array(530, 3518, 10295.83301, 4770.833008, 41.66666412, -3641.666504, "outland/3518".$lang['maplang'].".jpg"),
92 478=>array(530, 3519, 7083.333008, 1683.333252, -999.999939, -4600, "outland/3519".$lang['maplang'].".jpg"),
93 479=>array(530, 3523, 5483.333008, -91.666664, 5456.25, 1739.583252, "outland/3523".$lang['maplang'].".jpg"),
94 481=>array(530, 3703, 6135.258789, 4829.008789, -1473.954468, -2344.787842, "outland/3703".$lang['maplang'].".jpg"),
95 //******************************************************************************
96 //************************ Northrend Areas **************************************
97 //******************************************************************************
98 485=>array(571, 0, 9217.152, -8534.246, 10593.375, -1240.89, "northrend/571".$lang['maplang'].".jpg"),
99 486=>array(571, 3537, 8570.833, 2806.25, 4897.917, 1054.167, "northrend/3537".$lang['maplang'].".jpg"),
100 488=>array(571, 65, 3627.083, -1981.25, 5575, 1835.417, "northrend/65".$lang['maplang'].".jpg"),
101 490=>array(571, 394, -1110.417, -6360.417, 5516.667, 2016.667, "northrend/394".$lang['maplang'].".jpg"),
102 491=>array(571, 495, -1397.917, -7443.75, 3116.667, -914.583, "northrend/495".$lang['maplang'].".jpg"),
103 492=>array(571, 210, 5443.75, -827.083, 9427.083, 5245.833, "northrend/210".$lang['maplang'].".jpg"),
104 493=>array(571, 3711, 6929.167, 2572.917, 7287.5, 4383.333, "northrend/3711".$lang['maplang'].".jpg"),
105 495=>array(571, 67, 1841.667, -5270.833, 10197.916, 5456.25, "northrend/67".$lang['maplang'].".jpg"),
106 496=>array(571, 66, -600, -5593.75, 7668.75, 4339.583, "northrend/66".$lang['maplang'].".jpg"),
107 501=>array(571, 4197, 4329.167, 1354.167, 5716.667, 3733.333, "northrend/4197".$lang['maplang'].".jpg"),
108 504=>array(571, 4395, 1052.51, 222.495, 6066.67, 5513.33, "northrend/4395".$lang['maplang'].".jpg"),
109 510=>array(571, 2817, 1443.75, -1279.167, 6502.083, 4687.5, "northrend/2817".$lang['maplang'].".jpg"),
110 541=>array(571, 4742, 2797.92, -879.17, 10781.2, 8329.17, "northrend/4742".$lang['maplang'].".jpg")
113 $gZoneToAreaImage = array(
114 '-1'=>'0',
115 '1'=>'27', // DunMorogh
116 '3'=>'17', // Badlands
117 '4'=>'19', // BlastedLands
118 '8'=>'38', // SwampOfSorrows
119 '10'=>'34', // Duskwood
120 '11'=>'40', // Wetlands
121 '12'=>'30', // Elwynn
122 '14'=>'4', // Durotar
123 '15'=>'141', // Dustwallow
124 '16'=>'181', // Aszhara
125 '17'=>'11', // Barrens
126 '28'=>'22', // WesternPlaguelands
127 '33'=>'37', // Stranglethorn
128 '36'=>'15', // Alterac
129 '38'=>'35', // LochModan
130 '40'=>'39', // Westfall
131 '41'=>'32', // DeadwindPass
132 '44'=>'36', // Redridge
133 '45'=>'16', // Arathi
134 '46'=>'29', // BurningSteppes
135 '47'=>'26', // Hinterlands
136 '51'=>'28', // SearingGorge
137 '65'=>'488', // Dragonblight
138 '66'=>'496', // ZulDrak
139 '67'=>'495', // TheStormPeaks
140 '85'=>'20', // Tirisfal
141 '130'=>'21', // Silverpine
142 '139'=>'23', // EasternPlaguelands
143 '141'=>'41', // Teldrassil
144 '148'=>'42', // Darkshore
145 '206'=>'523', // Utgarde Keep
146 '210'=>'492', // IcecrownGlacier
147 '215'=>'9', // Mulgore
148 '267'=>'24', // Hilsbrad
149 '331'=>'43', // Ashenvale
150 '357'=>'121', // Feralas
151 '361'=>'182', // Felwood
152 '394'=>'490', // GrizzlyHills
153 '400'=>'61', // ThousandNeedles
154 '405'=>'101', // Desolace
155 '406'=>'81', // StonetalonMountains
156 '440'=>'161', // Tanaris
157 '490'=>'201', // UngoroCrater
158 '493'=>'241', // Moonglade
159 '495'=>'491', // HowlingFjord
160 '618'=>'281', // Winterspring
161 '1196'=>'524', // Utgarde Pinnacle
162 '1377'=>'261', // Silithus
163 '1497'=>'382', // Undercity
164 '1519'=>'301', // Stormwind
165 '1537'=>'341', // Ironforge
166 '1637'=>'321', // Ogrimmar
167 '1638'=>'362', // ThunderBluff
168 '1657'=>'381', // Darnassis
169 '2597'=>'401', // AlteracValley
170 '2817'=>'510', // CrystalsongForest
171 '3277'=>'443', // WarsongGulch
172 '3358'=>'461', // ArathiBasin
173 '3430'=>'462', // EversongWoods
174 '3433'=>'463', // Ghostlands
175 '3456'=>'535', // Naxxramas
176 '3483'=>'465', // Hellfire
177 '3487'=>'480', // SilvermoonCity
178 '3518'=>'477', // Nagrand
179 '3519'=>'478', // TerokkarForest
180 '3520'=>'473', // ShadowmoonValley
181 '3521'=>'467', // Zangarmarsh
182 '3522'=>'475', // BladesEdgeMountains
183 '3523'=>'479', // Netherstorm
184 '3524'=>'464', // AzuremystIsle
185 '3525'=>'476', // BloodmystIsle
186 '3537'=>'486', // BoreanTundra
187 '3557'=>'471', // TheExodar
188 '3703'=>'481', // ShattrathCity
189 '3711'=>'493', // SholazarBasin
190 '3820'=>'482', // NetherstormArena
191 '4080'=>'499', // Sunwell
192 '4100'=>'521', // The Culling of Stratholme
193 '4196'=>'534', // Drak'Tharon Keep
194 '4197'=>'501', // LakeWintergrasp
195 '4228'=>'528', // The Oculus
196 '4264'=>'526', // Halls of Stone
197 '4265'=>'520', // The Nexus
198 '4272'=>'525', // Halls of Lightning
199 '4273'=>'529', // Ulduar
200 '4277'=>'533', // Azjol-Nerub
201 '4298'=>'502', // ScarletEnclave
202 '4384'=>'512', // StrandoftheAncients
203 '4395'=>'504', // Dalaran
204 '4415'=>'536', // The Violet Hold
205 '4416'=>'530', // Gundrak
206 '4493'=>'531', // The Obsidian Sanctum
207 '4494'=>'522', // Ahn'kahet: The Old Kingdom
208 '4500'=>'527', // The Eye of Eternity
209 '4603'=>'532', // Vault of Archavon
210 '4710'=>'540', // Isle of Conquest
211 '4722'=>'542', // Trial of the Crusader
212 '4723'=>'543', // Trial of the Champion
213 '4742'=>'541', // Hrothgar's Landing
214 '4809'=>'601', // The Forge of Souls
215 '4812'=>'604', // Icecrown Citadel
216 '4813'=>'602', // Pit of Saron
217 '4820'=>'603', // Halls of Reflection
218 '4987'=>'609', // The Ruby Sanctum
221 function getRenderAreaData($area)
223 global $gAreaImagesCoord;
224 return @$gAreaImagesCoord[$area];
227 // Ïðåîáðàçóåò êîðäèíàòû äëÿ àðåà êàðò (ôàéë worldMapTransform.dbc)
228 // Êîãäà îáúåêò ôèçè÷åñêè íàõîäèòñÿ íà:
229 // - ðàçíûõ êàðòàõ (êàðòû îñòðîâîâ)
230 // À âûâîä èäeò íà îäíó êàðòèíêó íî ïî äðóãèì êîîðäèíàòàì
231 // ôîðìàò map, y1, y2, x1, x2, newmap, dx, dy
232 $areaMapTransform = array(
233 2=>array( 530, -4000, -10000, 14000, 5000, 0, -2400, 2400),
234 3=>array( 530,-6933.333, -16000, 533.333, -8000, 1,10133.333, 17600),
235 4=>array( 600, -20000, -20000, 20000, 20000, 600, 0, 0),
236 5=>array( 603, 2113, -220, 2530, 1336, 603, 0, 0),
237 6=>array( 619, -20000, -20000, 20000, 20000, 619, 0, 0),
238 7=>array( 603, 1940, 1335, 2530, 2718, 603, 0, 0),
239 8=>array( 602, 1408, 10, 1454, 67, 602, 0, 0),
240 9=>array( 616, -20000, -20000, 20000, 20000, 616, 0, 0),
241 10=>array(631, -20000, -20000, 20000, 20000, 631, 0, 0)
244 function transformAreaCoordinates(&$map, &$x, &$y)
246 global $areaMapTransform;
247 foreach ($areaMapTransform as $conv)
249 if ($conv[0] == $map AND
250 $conv[1] >= $y AND $conv[2] <= $y AND
251 $conv[3] >= $x AND $conv[4] <= $x )
253 $map = $conv[5];
254 $x += $conv[6];
255 $y += $conv[7];
256 return;
259 return;
262 // Ïðåîáðàçóåò êîðäèíàòû
263 // Êîãäà îáúåêò ôèçè÷åñêè íàõîäèòñÿ íà:
264 // - ðàçíûõ êàðòàõ (êàðòû îñòðîâîâ)
265 // - êàðòà ìíîãîýòàæíàÿ
266 // À âûâîä èä¸ò íà îäíó êàðòèíêó, íî ïî äðóãèì êîîðäèíàòàì
267 // ôîðìàò map, z1, z2, y1, y2, x1, x2, newmap, dx, dy, dz
268 $worldMapTransform = array(
269 2=>array(530, 2000, -2000, -4000, -10000, 14000, 5000, 0, -2638, 2496, 0),
270 3=>array(530, 2000, -2000, -6933, -16000, 533, -8000, 1, 10133.333, 17600, 0),
271 // Scarlet Monastery
272 4=>array(189, 2000, -2000, -200, -500, 300, 100, 189, 578, 1469, 0), // Library
273 5=>array(189, 2000, -2000, -300, -500, 2000, 1600, 189, -756, 1591, 0), // Armory
274 6=>array(189, 2000, -2000, 1500, 1000, 1900, 1700, 189, -970, 275, 0), // Caveyard
275 // Shadowfang
276 7=>array( 33, 140,113.4, 2200, 2100, -70, -180, 33, 7, -56, 0), // 2 floor
277 8=>array( 33, 160, 140, 2200, 2100, -70, -180, 33, -12, -108, 0), // 3 floor
281 function transformWorldCoordinates(&$map, &$x, &$y, &$z)
283 global $worldMapTransform;
284 foreach ($worldMapTransform as $conv)
286 if ($conv[0] == $map AND
287 $conv[1] >= $z AND $conv[2] <= $z AND
288 $conv[3] >= $y AND $conv[4] <= $y AND
289 $conv[5] >= $x AND $conv[6] <= $x)
291 $map = $conv[7];
292 $x += $conv[8];
293 $y += $conv[9];
294 $z += $conv[10];
295 return;
298 return;
301 // return true if map - dungeon
302 function isDungeon($id)
304 if ($id==0 || $id == 1 || $id == 530 || $id ==571)
305 return false;
306 return true;
309 // Ñîáñòâåííûå äàííûå äëÿ ïîêàçà êàðò
310 // id, y1, y2, x1, x2, sizeY, sizeX, filename
311 static $gMapCoord =array(
312 0=>array( 11200, -16000, 4264, -6936,1632, 672,"../azeroth_8x.jpg"),
313 1=>array( 12262, -12804, 8536, -9064,1504,1056,"../kalimdor_8x.jpg"),
314 530=>array( 5333, -5867, 10133, -1067,1344,1344,"../outland_4x.jpg"),
315 571=>array( 10667, -1066, 8533, -8000,1408,1984,'../northrend_4x.jpg'),
316 // 13=>array( , , , , , ,"Testing.jpg"), // not use
317 // 25=>array( , , , , , ,"ScottTest.jpg"), // not use
318 // 29=>array( , , , , , ,"CashTest.jpg"), // not use
319 30=>array( 1032, -1676, 296, -754,1300, 504,"AlteracValley.jpg"),
320 33=>array( -73, -317, 2355, 2001, 488, 708,"ShadowfangKeep.jpg"), // ïîâîðîò íà -69,16 (multilevel map)
321 34=>array( 201, -11, 158, -158, 424, 632,"Stockade.jpg"),
322 // 35=>array( , , , , , ,"unusedStormwindPrison.jpg"), // not use
323 36=>array( 128, -321, -339, -1151, 898,1623,"Deadmines.jpg"),
324 // 37=>array( , , , , , ,"AzsharaCrater.jpg"), // not use
325 // 42=>array( , , , , , ,"CollinTest.jpg"), // not use
326 43=>array( 192, -399, 560, -388,1182,1896,"WailingCaverns.jpg"),
327 // 44=>array( , , , , , ,"unusedMonastery.jpg"), // not use
328 47=>array( 2241, 1926, 2044, 1380, 630,1326,"RazorfenKraul.jpg"), // ïîâîðîò íà 47,29 ãðàä
329 48=>array( -72, -900, 429, -507,1656,1872,"BlackfathomDeeps.jpg"),
330 70=>array( 189, -375, 472, -75,1128,1094,"Uldaman.jpg"),
331 90=>array( -196, -920, 762, -146,1448,1816,"Gnomeregan.jpg"),
332 109=>array( -241, -718, 329, -141, 954, 940,"SunkenTemple.jpg"),
333 129=>array( 2635, 2244, 1145, 601, 781,1088,"RazorfenDowns.jpg"),
334 //169=>array( , , , , , ,"EmeraldDream.jpg"), // not use
335 189=>array( 1237, 637, 1724, 1014,1200,1420,"ScarletMonastery.jpg"), // use transform coordinates
336 209=>array( 2062, 1143, 1433, 604, 441, 398,"ZulFarrak.jpg"),
337 //229=>array( , , , , , ,"BlackrockSpire.jpg"), // have many level -> passed
338 230=>array( 1491, 252, 271, -855,2478,2252,"BlackrockDepths.jpg"),
339 249=>array( 67, -225, -8, -292, 583, 568,"OnyxiasLair.jpg"),
340 269=>array( -1327, -2421, 7698, 6527, 525, 562,"CavernsOfTime.jpg"),
341 //289=>array( , , , , , ,"Scholomance.jpg"), // have many level -> passed
342 309=>array(-11335, -12568, -1106, -2137, 592, 495,"ZulGurub.jpg"),
343 329=>array( 4155, 3373, -2923, -3809,1564,1772,"Stratholme.jpg"),
344 349=>array( 1172, -174, 300, -819,2692,2238,"Maraudon.jpg"),
345 //369=>array( , , , , , ,"DeeprunTram.jpg"), // not use ýòî êàðòà æåëåçíîé äîðîãè ìåæäó ñòîðìîì è àéðîíîì
346 389=>array( 23, -426, 280, -113, 898, 786,"OrgrimarInstance.jpg"),
347 409=>array( 1338, 483, -267, -1260,1710,1986,"MoltenCore.jpg"),
348 429=>array( 943, -224, 984, -876,1167,1860,"DireMaul.jpg"),
349 449=>array( 88, -32, 43, -97, 240, 280,"AlliancePVPBarracks.jpg"),
350 450=>array( 277, -87, 120, -188, 729, 618,"HordePVPBarracks.jpg"),
351 //451=>array( , , , , , ,"DevelopmentLand.jpg"), // not use
352 //469=>array( , , , , , ,"BlackwingLair.jpg"), // have many level -> passed
353 489=>array( 1698, 827, 1864, 994, 418, 418,"WarsongGulch.jpg"),
354 509=>array( -8070, -10257, 2470, 950,1050, 730,"RuinsofAhnQiraj.jpg"),
355 //529=>array( , , , , , ,"ArathiBasin.jpg"), // bg
356 531=>array( -7840, -9372, 2255, 782,3064,2947,"AhnQirajTemple.jpg"), // Ïîâîðîò íà 21.5 ãðàä
357 //532=>array( , , , , , ,"Karazhan.jpg"), // have many level -> passed
358 533=>array( 3569, 2428, -2862, -4080,2282,2436,"Naxxramas.jpg"),
359 534=>array( 5958, 4075, -1104, -4123, 904,1449,"TheBattleforMountHyjal.jpg"),
360 540=>array( 582, -46, 357, -168,1256,1050,"TheShatteredHalls.jpg"),
361 542=>array( 558, -49, 219, -229,1214, 896,"TheBloodFurnace.jpg"),
362 543=>array( -508, -2176, 2376, 900, 834, 738,"Ramparts.jpg"),
363 544=>array( 242, -127, 122, -111, 738, 466,"MagtheridonsLair.jpg"),
364 545=>array( 132, -406, 35, -622,1076,1314,"TheSteamvault.jpg"),
365 546=>array( 427, -189, 191, -610,1232,1602,"TheUnderbog.jpg"),
366 547=>array( 157.5, -357.5, 44.5,-829.5,1030,1748,"TheSlavePens.jpg"),
367 548=>array( 579, -396, 121, -1161,1950,2564,"SerpentshrineCavern.jpg"),
368 550=>array( 883, -78, 501, -509,1923,2021,"TheEye.jpg"),
369 552=>array( 547, -56, 247, -306,1206,1106,"TheArcatraz.jpg"),
370 553=>array( 232, -266, 641, -104, 996,1490,"TheBotanica.jpg"),
371 554=>array( 354, -104, 212, -221, 916, 866,"TheMechanar.jpg"),
372 555=>array( 86, -588.5, 83.5,-575.5,1349,1318,"ShadowLabyrinth.jpg"),
373 556=>array( 124, -295.5, 385, -70, 839, 910,"SethekkHalls.jpg"),
374 557=>array( 84.5, -438, 65.5,-306.5,1045, 744,"ManaTombs.jpg"),
375 558=>array(298.75,-187.25, 56,-448.5, 972,1009,"AuchenaiCrypts.jpg"),
376 //559=>array( , , , , , ,"NagrandArena.jpg"), // bg
377 560=>array( 3730, 530, 2667, -533,1536,1536,"TheEscapeFromDurnholde.jpg"),
378 //562=>array( , , , , , ,"BladeEdgeArena.jpg"), // bg
379 //564=>array( , , , , , ,"BlackTemple.jpg"),
380 565=>array( 304, -37, 445, -32, 682, 954,"GruulsLair.jpg"),
381 566=>array( 2873, 1433, 2118, 942, 891, 565,"EyeoftheStorm.jpg"), // bg
382 568=>array( 681, -381, 1990, 254, 510, 833,"ZulAman.jpg"),
383 //572=>array( , , , , , ,"RuinsofLordaeron.jpg"), // not use
384 //573=>array( , , , , , ,"ExteriorTest.jpg"), // not use
385 //574=>array( , , , , , ,"UtgardeKeep.jpg"), //
386 //575=>array( , , , , , ,"UtgardePinnacle.jpg"), //
387 //576=>array( , , , , , ,"TheNexus.jpg"), //
388 //578=>array( , , , , , ,"TheOculus.jpg"), //
389 580=>array( 2768, 512, 1691, -259,1083, 937,"SunwellPlateau.jpg"),
390 //582=>array( , , , , , ,".jpg"), // not use Transport: Rut'theran to Auberdine
391 //584=>array( , , , , , ,".jpg"), // not use Transport: Menethil to Theramore
392 //585=>array( , , , , , ,"MagisterTerrace.jpg"), //
393 //586=>array( , , , , , ,".jpg"), // not use Transport: Exodar to Auberdine
394 //587=>array( , , , , , ,".jpg"), // not use Transport: Feathermoon Ferry
395 //588=>array( , , , , , ,".jpg"), // not use Transport: Menethil to Auberdine
396 //589=>array( , , , , , ,".jpg"), // not use Transport: Orgrimmar to Grom'Gol
397 //590=>array( , , , , , ,".jpg"), // not use Transport: Grom'Gol to Undercity
398 //591=>array( , , , , , ,".jpg"), // not use Transport: Undercity to Orgrimmar
399 //592=>array( , , , , , ,".jpg"), // not use Transport: Borean Tundra Test
400 //593=>array( , , , , , ,".jpg"), // not use Transport: Booty Bay to Ratchet
401 //594=>array( , , , , , ,".jpg"), // not use Transport: Howling Fjord Sister Mercy (Quest)
402 //595=>array( , , , , , ,"CullingOfStratholme.jpg"), //
403 //596=>array( , , , , , ,".jpg"), // not use Transport: Naglfar
404 //597=>array( , , , , , ,"CraigTest.jpg"), // not use
405 //598=>array( , , , , , ,".jpg"), // not use Sunwell Fix
406 //599=>array( , , , , , ,"HallsOfStone.jpg"),
407 //600=>array( , , , , , ,"DrakTharonKeep.jpg"),
408 //601=>array( , , , , , ,"AzjolNerub.jpg"),
409 //602=>array( , , , , , ,"HallsOfLightning.jpg"),
410 //603=>array( , , , , , ,"Ulduar.jpg"),
411 //604=>array( , , , , , ,"Gundrak.jpg"),
412 //605=>array( , , , , , ,".jpg"), // not use Development Land (non-weighted textures)
413 //606=>array( , , , , , ,".jpg"), // not use QA and DVD
414 //607=>array( , , , , , ,"StrandOfTheAncients.jpg"),
415 //608=>array( , , , , , ,"VioletHold.jpg"),
416 //609=>array( , , , , , ,"EbonHold.jpg"),
417 //610=>array( , , , , , ,".jpg"), // not use Transport: Tirisfal to Vengeance Landing
418 //612=>array( , , , , , ,".jpg"), // not use Transport: Menethil to Valgarde
419 //613=>array( , , , , , ,".jpg"), // not use Transport: Orgrimmar to Warsong Hold
420 //614=>array( , , , , , ,".jpg"), // not use Transport: Stormwind to Valiance Keep
421 //615=>array( , , , , , ,"TheObsidianSanctum.jpg"),
422 //616=>array( , , , , , ,"TheEyeOfEternity.jpg"),
423 //617=>array( , , , , , ,"DalaranSewers.jpg"),
424 //618=>array( , , , , , ,"TheRinOfValor.jpg"),
425 //619=>array( , , , , , ,"TheOldKingdom.jpg"),
426 //620=>array( , , , , , ,".jpg"), // not use Transport: Moa'ki to Unu'pe
427 //621=>array( , , , , , ,".jpg"), // not use Transport: Moa'ki to Kamagua
428 //622=>array( , , , , , ,".jpg"), // not use Transport: Orgrim's Hammer
429 //623=>array( , , , , , ,".jpg"), // not use Transport: The Skybreaker
430 //624=>array( , , , , , ,"WintergraspRaid.jpg"),
431 //628=>array( , , , , , ,"IsleofConquest.jpg"),
432 //631=>array( , , , , , ,"IcecrownCitadel.jpg"),
433 //632=>array( , , , , , ,"IcecrownCitadel5Man.jpg"),
434 //641=>array( , , , , , ,".jpg"), // not useTransport_AllianceAirshipBG
435 //642=>array( , , , , , ,".jpg"), // not useTransport_HordeAirshipBG
436 //647=>array( , , , , , ,".jpg"), // not useTransport_Orgrimmar_to_Thunderbluff
437 //649=>array( , , , , , ,"ArgentTournamentRaid.jpg"),
438 //650=>array( , , , , , ,"ArgentTournamentDungeon.jpg"),
439 //658=>array( , , , , , ,"QuarryofTears.jpg"),
440 //668=>array( , , , , , ,"HallsOfReflection.jpg"),
441 //672=>array( , , , , , ,".jpg"), // not useTransport197347
442 //673=>array( , , , , , ,".jpg"), // not useTransport197348
443 //712=>array( , , , , , ,".jpg"), // not useTransport197349
444 //713=>array( , , , , , ,".jpg"), // not useTransport197350
445 //718=>array( , , , , , ,".jpg"), // not useTransport201834
446 //723=>array( , , , , , ,"Stormwind.jpg"),
447 //724=>array( , , , , , ,"ChamberofAspectsRed.jpg"),
450 function getRenderMapData($map)
452 global $gMapCoord;
453 return @$gMapCoord[$map];
456 $gMapIcon = array(
457 '0'=>"0.gif",
458 '1'=>"1.gif",
459 '30'=>"30.gif",
460 '33'=>"33.gif",
461 '34'=>"34.gif",
462 '36'=>"36.gif",
463 '43'=>"43.gif",
464 '47'=>"47.gif",
465 '48'=>"48.gif",
466 '70'=>"70.gif",
467 '90'=>"90.gif",
468 '109'=>"109.gif",
469 '129'=>"129.gif",
470 '189'=>"189.gif",
471 '209'=>"209.gif",
472 '229'=>"229.gif",
473 '230'=>"230.gif",
474 '249'=>"249.gif",
475 '269'=>"269.gif",
476 '289'=>"289.gif",
477 '309'=>"309.gif",
478 '329'=>"329.gif",
479 '349'=>"349.gif",
480 '389'=>"389.gif",
481 '409'=>"409.gif",
482 '429'=>"429.gif",
483 '469'=>"469.gif",
484 '489'=>"489.gif",
485 '509'=>"509.gif",
486 '529'=>"529.gif",
487 '530'=>"530.gif",
488 '531'=>"531.gif",
489 '532'=>"532.gif",
490 '533'=>"533.gif",
491 '534'=>"534.gif",
492 '540'=>"540.gif",
493 '542'=>"542.gif",
494 '543'=>"543.gif",
495 '544'=>"544.gif",
496 '545'=>"545.gif",
497 '546'=>"546.gif",
498 '547'=>"547.gif",
499 '548'=>"548.gif",
500 '550'=>"550.gif",
501 '552'=>"552.gif",
502 '553'=>"553.gif",
503 '554'=>"554.gif",
504 '555'=>"555.gif",
505 '556'=>"556.gif",
506 '557'=>"557.gif",
507 '558'=>"558.gif",
508 '560'=>"560.gif",
509 '564'=>"564.gif",
510 '565'=>"565.gif",
511 '568'=>"568.gif",
512 '571'=>"571.gif",
513 '574'=>"574.gif",
514 '575'=>"575.gif",
515 '576'=>"576.gif",
516 '578'=>"578.gif",
517 '580'=>"580.gif",
518 '585'=>"585.gif",
519 '595'=>"595.gif",
520 '599'=>"599.gif",
521 '600'=>"600.gif",
522 '601'=>"601.gif",
523 '602'=>"602.gif",
524 '603'=>"603.gif",
525 '604'=>"604.gif",
526 '608'=>"608.gif",
527 '615'=>"615.gif",
528 '616'=>"616.gif",
529 '619'=>"619.gif",
530 '624'=>"624.gif",
531 '631'=>"631.gif",
532 '632'=>"632.gif",
533 '649'=>"649.gif",
534 '650'=>"650.gif",
535 '658'=>"658.gif",
536 '668'=>"668.gif",
537 '724'=>"724.gif"
540 function getMapIcon($map)
542 global $gMapIcon;
543 $ico = @$gMapIcon[$map];
544 if (empty($ico)) $ico = "unknown.gif";
545 return "images/map_icons/".$ico;
548 // Âûâîä êàðòèíêè íà îáùåé êàðòå GPS
549 // ôîðìàò:
550 // posX - êîîðäèíàòà ëåâîãî âåðõíåãî óãëà êàðòû
551 // posY - êîîðäèíàòà ëåâîãî âåðõíåãî óãëà êàðòû
552 // y - êîîðäèíàòà ôàêòè÷åñêîî ðàñïîëîæåíèÿ êàðòû íà èçîáðàæåíèè
553 // x - êîîðäèíàòà ôàêòè÷åñêîî ðàñïîëîæåíèÿ êàðòû íà èçîáðàæåíèè
554 // scale - ìàñøòàá
555 $gGpsMap = array(
556 0=>array(11200, 4264, 128, 960, 0.48/16),
557 1=>array(12262, 8536, 192, 0, 0.48/16),
558 530=>array( 5333,10133, 464, 576, 0.48/16),
559 571=>array(10667, 8533, 0, 496, 0.48/16),
562 function getRenderGPSMapData($map)
564 global $gGpsMap;
565 return @$gGpsMap[$map];
568 function getWMOArea($area, $map, $x, $y, $z)
570 // some hacks for areas above or underground for ground area
571 if ($map == 571 && $z > 563 && $y > 282 && $y < 982 && $x > 5568 && $x < 6116) $area = 4395; // Dalaran
572 else if ($map == 0 && $z < 30 && $y > -86 && $y < 873 && $x > 1237 && $x < 1877) $area = 1497; // Undecity
573 else if ($map == 530 && $z < -10 && $y >-12123 && $y <-11066 && $x >-4314 && $x <-3609) $area = 3557; // The Exodar
574 else if ($map == 0 && $y > -1504 && $y < -713 && $x >-5096 && $x <-4569) $area = 1537; // Ironforge
575 return $area;
578 //======================================================
579 // Ïîëó÷åíèèå id ñòðóêòóðû çîíû ïðè èìåþùèõñÿ êîîðäèíàòàõ
580 // Ðåàëèçîâàíî ñ ïîìîùüþ àíàëîãà GPS êàðòû òîëüêî íà êàðòèíêå
581 // öâåòàìè îáîçíà÷åíû çîíû.
582 $gAreaMaskImage = NULL;
583 function getAreaIdFromPoint(&$posMap, $posX, $posY, $posZ)
585 global $gAreaMaskImage, $gAreaColors;
586 // Îøèáêà çàãðóçêè êàðòèíêè - âîçâðàùàåìñÿ
587 if ($gAreaMaskImage == -1)
588 return -1;
589 // Åñëè êàðòèíêà íå áûëà åùå çàãðóæåíà - ãðóçèì åå
590 if ($gAreaMaskImage == 0)
592 $gAreaMaskImage = imagecreatefrompng("images/map_image/areamask.png");
593 if ($gAreaMaskImage == 0)
594 return $gAreaMaskImage = -1;
596 // Ïðåîáðàçóåì ñåòêó êîîðäèíàò
597 transformWorldCoordinates($posMap, $posX, $posY, $posZ);
598 // Òî÷êà ïðèñóòñòâóåò íà GPS êàðòå
599 if ($gps = getRenderGPSMapData($posMap))
601 $x = intval($gps[2]+$gps[4]*($gps[0] - $posX));
602 $y = intval($gps[3]+$gps[4]*($gps[1] - $posY));
603 // Ïîëó÷àåì öâåò òî÷êè ïî êîîðäèíàòàì è âû÷èñëåì çîíó
604 if ($area = @imagecolorat($gAreaMaskImage, $y, $x))
605 return getWMOArea($area, $posMap, $posX, $posY, $posZ);
607 return -1;
610 function getZoneFromPoint(&$posMap, $posX, $posY, $posZ)
612 $areaId = getAreaIdFromPoint($posMap, $posX, $posY, $posZ);
613 $area_data = getArea($areaId);
614 if ($area_data && $area_data['zone_id'])
615 return $area_data['zone_id'];
616 return $areaId;
619 // Âîçâðàùàåò id êàðòèíêè ïî êîîðäèíàòàì
620 function getAreaImageIdFromPoint(&$posMap, $posX, $posY, $posZ)
622 global $gZoneToAreaImage;
623 $zone = getZoneFromPoint($posMap, $posX, $posY, $posZ);
624 if ($zone > 0)
625 return isset($gZoneToAreaImage[$zone]) ? $gZoneToAreaImage[$zone] : -1;
626 return -1;
629 // Âîçâðàùàåò èìÿ çîíû ïî êîîðäèíàòàì
630 function getAreaNameFromPoint($posMap, $posX, $posY, $posZ)
632 $areaId = getAreaIdFromPoint($posMap, $posX, $posY, $posZ);
633 if ($areaId==-1)
634 return "";
635 $area_data = getArea($areaId);
636 $zone_data = $area_data['zone_id'] ? getArea($area_data['zone_id']):$area_data;
637 if ($zone_data['name']!=$area_data['name'])
638 return $zone_data['name']." - ".$area_data['name'];
639 return $zone_data['name'];
642 // Âîçâðàùàåò èìÿ êàðòû ïî êîîðäèíàòàì
643 function getMapNameFromPoint($posMap, $posX, $posY, $posZ)
645 transformWorldCoordinates($posMap, $posX, $posY, $posZ);
646 return getMapName($posMap);
649 // Ñàllback ôóíêöèÿ äëÿ âûâîäà òî÷åê è èõ èíôîðìàöèè íà êàðòàõ.
650 function defaultMapRenderCallback($data, $x, $y)
652 global $lang;
653 $img = "images/map_points/gps_icon.png";
654 $imgX = 16;
655 $imgY = 16;
656 $x = round($x-$imgX/2, 0);
657 $y = round($y-$imgY/2, 0);
659 $area = getAreaIdFromPoint($data['map'], $data['position_x'], $data['position_y'], $data['position_z']);
660 if ($area_data = getArea($area))
661 $areaname = $area_data['zone_id'] ? getAreaName($area_data['zone_id'],0).' ('.$area_data['name'].')' : $area_data['name'];
662 else
663 $areaname = '';
664 if ($data['type']=='n') {
665 $text = getCreatureName($data['id'], 0)." ($data[guid])<br>$areaname<br>$lang[respawn]&nbsp;".getTimeText($data['spawntimesecs']);
666 if (getCreatureEvent($data['guid'])>0)
667 $text = substr_replace("<br>$lang[spawn_at_event]&nbsp;-&nbsp;".getGameEventName(getCreatureEvent($data['guid'])), $text, 0, 0);
668 if (getCreatureEvent($data['guid'])<0)
669 $text = substr_replace("<br>$lang[despawn_at_event]&nbsp;-&nbsp;".getGameEventName(abs(getCreatureEvent($data['guid']))), $text, 0, 0);
670 if (getCreaturePool($data['guid']))
671 $text = substr_replace("<br>$lang[pool]&nbsp;(".getCreaturePool($data['guid']).")", $text, 0, 0);
672 if (getCreaturePoolTemplate($data['id']))
673 $text = substr_replace("<br>$lang[pool]&nbsp;(".getCreaturePoolTemplate($data['id']).")", $text, 0, 0);
675 if ($data['type']=='o') {
676 $text = getGameobjectName($data['id'], 0)." ($data[guid])<br>$areaname<br>$lang[respawn]&nbsp;".getTimeText($data['spawntimesecs']);
677 if (getGameobjectEvent($data['guid'])>0)
678 $text = substr_replace("<br>$lang[spawn_at_event]&nbsp;-&nbsp;".getGameEventName(getGameobjectEvent($data['guid'])), $text, 0, 0);
679 if (getGameobjectEvent($data['guid'])<0)
680 $text = substr_replace("<br>$lang[despawn_at_event]&nbsp;-&nbsp;".getGameEventName(abs(getGameobjectEvent($data['guid']))), $text, 0, 0);
681 if (getGameobjectPool($data['guid']))
682 $text = substr_replace("<br>$lang[pool]&nbsp;(".getGameobjectPool($data['guid']).")", $text, 0, 0);
683 if (getGameobjectPoolTemplate($data['id']))
684 $text = substr_replace("<br>$lang[pool]&nbsp;(".getGameobjectPoolTemplate($data['id']).")", $text, 0, 0);
686 if ($data['type']=='i')
687 $text = $areaname;
688 if ($data['type']=='w')
689 $text = $data['point'];
690 return '<img src="'.$img.'" class=point style="left: '.$x.'px; top: '.$y.'px;" '.addTooltip($text).'>'."\n";
693 function defaultAreaRenderCallback($area_id, $data, $x, $y)
695 global $gZoneToAreaImage, $lang;
696 $area = getAreaIdFromPoint($data['map'], $data['position_x'], $data['position_y'], $data['position_z']);
697 if (!$area)
698 return;
699 $area_data = getArea($area);
701 $zone = $area_data['zone_id'] ? $area_data['zone_id'] : $area;
702 $mapname = getMapName($data['map']);
703 $areaname = $area_data['zone_id'] ? getAreaName($area_data['zone_id'],0)." (".$area_data['name'].")" : $area_data['name'];
705 if ($data['type']=='n') {
706 $text = getCreatureName($data['id'], 0)."&nbsp;($data[guid])<br>$mapname&nbsp;-&nbsp;$areaname<br>$lang[respawn]&nbsp;".getTimeText($data['spawntimesecs']);
707 if (getCreatureEvent($data['guid'])>0)
708 $text = substr_replace("<br>$lang[spawn_at_event]&nbsp;-&nbsp;".getGameEventName(getCreatureEvent($data['guid'])), $text, 0, 0);
709 if (getCreatureEvent($data['guid'])<0)
710 $text = substr_replace("<br>$lang[despawn_at_event]&nbsp;-&nbsp;".getGameEventName(abs(getCreatureEvent($data['guid']))), $text, 0, 0);
711 if (getCreaturePool($data['guid']))
712 $text = substr_replace("<br>$lang[pool]&nbsp;(".getCreaturePool($data['guid']).")", $text, 0, 0);
713 if (getCreaturePoolTemplate($data['id']))
714 $text = substr_replace("<br>$lang[pool]&nbsp;(".getCreaturePoolTemplate($data['id']).")", $text, 0, 0);
716 if ($data['type']=='o') {
717 $text = getGameobjectName($data['id'], 0)."&nbsp;($data[guid])<br>$mapname&nbsp;-&nbsp;$areaname<br>$lang[respawn]&nbsp;".getTimeText($data['spawntimesecs']);
718 if (getGameobjectEvent($data['guid'])>0)
719 $text = substr_replace("<br>$lang[spawn_at_event]&nbsp;-&nbsp;".getGameEventName(getGameobjectEvent($data['guid'])), $text, 0, 0);
720 if (getGameobjectEvent($data['guid'])<0)
721 $text = substr_replace("<br>$lang[despawn_at_event]&nbsp;-&nbsp;".getGameEventName(abs(getGameobjectEvent($data['guid']))), $text, 0, 0);
722 if (getGameobjectPool($data['guid']))
723 $text = substr_replace("<br>$lang[pool]&nbsp;(".getGameobjectPool($data['guid']).")", $text, 0, 0);
724 if (getGameobjectPoolTemplate($data['id']))
725 $text = substr_replace("<br>$lang[pool]&nbsp;(".getGameobjectPoolTemplate($data['id']).")", $text, 0, 0);
727 if ($data['type']=='i')
728 $text = "$mapname - $areaname";
729 if ($data['type']=='w')
730 $text = $data['point'];
731 if ($gZoneToAreaImage[$zone] == $area_id)
732 $img = "images/map_points/gps_icon.png";
733 else
734 $img = "images/map_points/gps_icon1.png";
735 $imgX = 16;
736 $imgY = 16;
737 $x = round($x-$imgX/2, 0);
738 $y = round($y-$imgY/2, 0);
740 return '<img src="'.$img.'" class=point style="left: '.$x.'px; top: '.$y.'px;" '.addTooltip($text).'>'."\n";
743 function renderGPSMap($header, $outSizeX, $pointsList = 0, $render = 'defaultMapRenderCallback')
745 $imageY = $outSizeX==0 ? 1296 : $outSizeX;
746 $imageX = $outSizeX==0 ? 944 : intval(944 * $outSizeX / 1296);
747 $imageScale = $imageY/1296;
748 $image = "images/map_image/gps_map.jpg";
750 $sizeX = $imageX+4;
751 $sizeY = $imageY;
752 $tableBorder = 1;
753 $tableWidth = $sizeY+$tableBorder*2+8;
754 echo "<table class=\"map\" border=$tableBorder width=$tableWidth>";
755 echo "<tbody>";
756 echo "<tr><td class=mapname>".$header."</td></tr>";
757 echo "<tr><td width=$sizeY height=$sizeX align=left valign=top>";
758 echo "<div style=\"position: relative; border: 0px; left: 0px; top: 0px;\">";
759 echo "<img src=$image width={$imageY}px height={$imageX}px>\n";
761 if($pointsList)
762 foreach ($pointsList as $point)
764 if ($gps = getRenderGPSMapData($point['map']))
766 $posMap= $point['map'];
767 $posX = $point['position_x'];
768 $posY = $point['position_y'];
769 $posZ = $point['position_z'];
771 transformWorldCoordinates($posMap, $posX, $posY, $posZ);
772 if ($gps = getRenderGPSMapData($posMap))
774 $x = ($gps[2]+$gps[4]*($gps[0] - $posX))*$imageScale;
775 $y = ($gps[3]+$gps[4]*($gps[1] - $posY))*$imageScale;
776 if ($x>=0 && $x < 944 && $y>=0 && $y < 1296)
777 echo $render($point, $y, $x);
781 echo "</div>";
782 echo "</td></tr></tbody>";
783 echo "</table>";
786 function getAreaNameFromId($areaId)
788 $area = getRenderAreaData($areaId);
789 if (empty($area))
790 return "$lang[map_no_found]&nbsp;$areaId";
791 if ($area[1] == 0)
792 return getMapName($area[0]);
793 return getAreaName($area[1]);
796 function renderArea($areaId, $outSizeX = 0, $pointsList = 0, $render = 'defaultAreaRenderCallback')
798 global $gAreaCoord;
799 $area = getRenderAreaData($areaId);
800 if (empty($area))
802 echo "$lang[map_no_found]&nbsp;$areaId<br>";
803 return;
805 // Äàííûå êàðòû
806 $mapId = $area[0];
807 $name = $area[1] == 0 ? getMapName($mapId): getAreaName($area[1]);
808 $areaY1 = $area[2];
809 $areaY2 = $area[3];
810 $areaX1 = $area[4];
811 $areaX2 = $area[5];
812 $imageY = $outSizeX==0 ? 1002 : $outSizeX;
813 $imageX = $outSizeX==0 ? 668 : intval(668 * $outSizeX / 1002);
814 $image = "images/map_image/areas/".$area[6];
816 $sizeX = $imageX+4;
817 $sizeY = $imageY;
818 $tableBorder = 1;
819 $tableWidth = $sizeY+$tableBorder*2+8;
820 echo "<table class=\"map\" border=$tableBorder width=$tableWidth>";
821 echo "<tbody><tr><td class=mapname id=mappername>$name</td></tr>";
822 echo "<tr><td width=$sizeY height=$sizeX align=left valign=top>";
823 echo "<div id=mapperarea style=\"font-size: 10px; position: relative; border: 0px; left: 0px; top: 0px;\" onmousemove=outMouseCoords(this,event,'mappercoord') onmouseout=cleanMouseCoords('mappercoord')>";
824 echo "<img src=$image width={$imageY}px height={$imageX}px>\n";
825 if($pointsList)
826 foreach ($pointsList as $point)
828 $posMap= $point['map'];
829 $posX = $point['position_x'];
830 $posY = $point['position_y'];
831 if ($area[1] == 0)
832 transformAreaCoordinates($posMap, $posX, $posY);
833 if ($mapId == $posMap AND
834 $areaY1 >= $posY AND $areaY2 <= $posY AND
835 $areaX1 >= $posX AND $areaX2 <= $posX)
837 $x = $imageX*($posX-$areaX1)/($areaX2-$areaX1);
838 $y = $imageY*($posY-$areaY1)/($areaY2-$areaY1);
839 echo $render($areaId, $point, $y, $x);
842 echo '<div id=mappercoord style="position: absolute; left: 10px; bottom: 15px;"></div>';
844 echo "</div>";
845 echo "</td></tr></tbody>";
846 echo "</table>";
849 function renderMap($mapId, $outSizeX = 0, $pointsList = 0, $render = 'defaultMapRenderCallback')
851 global $gMapCoord, $gmapName, $lang;
852 $mapName = '<a href=?instance='.$mapId.'>'.getMapName($mapId).'</a>';
853 if (empty($mapName))
855 echo "$lang[map_no_found]&nbsp;$mapId<br>";
856 return;
858 $map = getRenderMapData($mapId);
859 if (empty($map))
861 echo "$lang[no_image]&nbsp;$mapName&nbsp;($mapId)<br>";
862 return;
864 // Äàííûå êàðòû
865 $areaX1 = $map[0];
866 $areaX2 = $map[1];
867 $areaY1 = $map[2];
868 $areaY2 = $map[3];
869 $imageY = $outSizeX==0 ? $map[5] : $outSizeX;
870 $imageX = $outSizeX==0 ? $map[4] : intval($map[4] * $outSizeX / $map[5]);
871 $image = "images/map_image/maps/".$map[6];
873 $sizeX = $imageX+4;
874 $sizeY = $imageY;
875 $tableBorder = 1;
876 $tableWidth = $sizeY+$tableBorder*2+8;
877 echo "<table class=map border=$tableBorder width={$tableWidth}px>";
878 echo "<tbody><tr><td id=mappername class=mapname>$mapName</td></tr>";
879 echo "<tr><td width={$sizeY}px height={$sizeX}px align=left valign=top>";
880 echo "<div id=mapperarea style=\"position: relative; border: 0px; left: 0px; top: 0px;\">";
881 echo "<img src=$image width={$imageY}px height={$imageX}px>\n";
883 if ($pointsList)
884 foreach ($pointsList as $point)
886 $posMap= $point['map'];
887 $posX = $point['position_x'];
888 $posY = $point['position_y'];
889 $posZ = $point['position_z'];
890 transformWorldCoordinates($posMap, $posX, $posY, $posZ);
891 if ($mapId == $posMap AND
892 $areaY1 >= $posY AND $areaY2 <= $posY AND
893 $areaX1 >= $posX AND $areaX2 <= $posX)
895 $x = $imageX*($posX-$areaX1)/($areaX2-$areaX1);
896 $y = $imageY*($posY-$areaY1)/($areaY2-$areaY1);
897 echo $render($point, $y, $x);
900 echo "</div>";
901 echo "</td></tr></tbody>";
902 echo "</table>";
905 class mapPoints{
906 var $points = array();
907 function getCount(){ return count($this->points);}
908 //*************************************
909 // Add creature list
910 //*************************************
911 function addNpc($id, $map = -1)
913 global $dDB;
914 $list = $dDB->select('SELECT
915 \'n\' AS `type`,
916 `guid`,
917 `id`,
918 `map`,
919 `spawnMask`,
920 `phaseMask`,
921 `modelid`,
922 `equipment_id`,
923 `position_x`,
924 `position_y`,
925 `position_z`,
926 `orientation`,
927 `spawntimesecs`,
928 `spawndist`,
929 `currentwaypoint`,
930 `curhealth`,
931 `curmana`,
932 `DeathState`,
933 `MovementType`
934 FROM `creature` WHERE `id` = ?d {AND `map` = ?d}', $id, $map==-1? DBSIMPLE_SKIP:$map);
935 if ($list) $this->points = array_merge($this->points, $list);
937 //*************************************
938 // Add object list
939 //*************************************
940 function addGo($id, $map = -1)
942 global $dDB;
943 $list = $dDB->select('SELECT
944 \'o\' AS `type`,
945 `guid`,
946 `id`,
947 `map`,
948 `spawnMask`,
949 `phaseMask`,
950 `position_x`,
951 `position_y`,
952 `position_z`,
953 `orientation`,
954 `spawntimesecs`,
955 `state`
956 FROM `gameobject` WHERE `id` = ?d {AND `map` = ?d}', $id, $map==-1? DBSIMPLE_SKIP:$map);
957 if ($list) $this->points = array_merge($this->points, $list);
959 //*************************************
960 // Add waypoints list
961 //*************************************
962 function addWaypoint($id, $map)
964 global $dDB;
965 $list = $dDB->select('SELECT
966 \'w\' AS `type`,
967 `id`,
968 `point`,
969 ?d AS `map`,
970 `position_x`,
971 `position_y`,
972 `position_z`,
973 `waittime`,
974 `spell`
975 FROM `creature_movement` WHERE `id` = ?d ', $map, $id);
976 if ($list) $this->points = array_merge($this->points, $list);
979 //*************************************
980 // Add point
981 //*************************************
982 function addPoint($map, $x, $y, $z)
984 $this->points[] = array('type'=>'i', 'map'=>$map, 'position_x'=>$x, 'position_y'=>$y, 'position_z'=>$z);
987 //*************************************
988 // Create area and maps list from points
989 //*************************************
990 function getMapsList()
992 $gpsCount = 0;
993 $areaList= array();
994 $mapsList= array();
995 foreach ($this->points as $point)
997 $a = getAreaImageIdFromPoint($point['map'], $point['position_x'], $point['position_y'], $point['position_z']);
998 if ($a>0) @$areaList[$a]++;
999 @$mapsList[$point['map']]++;
1001 $area_keys = array_keys($areaList);
1002 $maps_keys = array_keys($mapsList);
1004 $list = array();
1005 if ($area_keys)
1006 foreach($areaList as $id=>$count)
1007 $list['area'][]=array('id'=>$id, 'text'=>getAreaNameFromId($id).' - ('.$count.')');
1009 if ($mapsList)
1010 foreach($mapsList as $id=>$count)
1012 if (getRenderGPSMapData($id)) $gpsCount+=$count;
1013 $list['map'][]=array('id'=>$id, 'text'=>getMapName($id).' - ('.$count.')');
1015 if ($gpsCount)
1016 $list['gps'][]=array('text'=>'('.$gpsCount.')');
1018 return $list;
1022 function getPointData($area_id, &$data, $x, $y)
1024 global $gZoneToAreaImage, $lang;
1026 $area = getAreaIdFromPoint($data['map'], $data['position_x'], $data['position_y'], $data['position_z']);
1027 $area_data = getArea($area);
1028 if (!$area_data)
1029 return 0;
1030 $zone = @$area_data['zone_id'] ? $area_data['zone_id'] : $area;
1031 $areaname = $area_data['zone_id'] ? getAreaName($zone)." (".$area_data['name'].")" : $area_data['name'];
1032 $img = 'images/map_points/';
1033 $img.= ($gZoneToAreaImage[$zone] == $area_id) ? 'gps_icon.png' : 'gps_icon1.png';
1034 $imgX = 16;
1035 $imgY = 16;
1036 $name = '';
1037 if (@$data['type']=='n') {
1038 $text = getCreatureName($data['id'], 0)."&nbsp;($data[guid])<br>$areaname<br>$lang[respawn]&nbsp;".getTimeText($data['spawntimesecs']);
1039 if (getCreatureEvent($data['guid'])>0)
1040 $text = substr_replace("<br>$lang[spawn_at_event]&nbsp;-&nbsp;".getGameEventName(getCreatureEvent($data['guid'])), $text, 0, 0);
1041 if (getCreatureEvent($data['guid'])<0)
1042 $text = substr_replace("<br>$lang[despawn_at_event]&nbsp;-&nbsp;".getGameEventName(abs(getCreatureEvent($data['guid']))), $text, 0, 0);
1043 if (getCreaturePool($data['guid']))
1044 $text = substr_replace("<br>$lang[pool]&nbsp;(".getCreaturePool($data['guid']).")", $text, 0, 0);
1045 if (getCreaturePoolTemplate($data['id']))
1046 $text = substr_replace("<br>$lang[pool]&nbsp;(".getCreaturePoolTemplate($data['id']).")", $text, 0, 0);
1048 if (@$data['type']=='o') {
1049 $text =getGameobjectName($data['id'], 0)."&nbsp;($data[guid])<br>$areaname<br>$lang[respawn]&nbsp;".getTimeText($data['spawntimesecs']);
1050 if (getGameobjectEvent($data['guid'])>0)
1051 $text = substr_replace("<br>$lang[spawn_at_event]&nbsp;-&nbsp;".getGameEventName(getGameobjectEvent($data['guid'])), $text, 0, 0);
1052 if (getGameobjectEvent($data['guid'])<0)
1053 $text = substr_replace("<br>$lang[despawn_at_event]&nbsp;-&nbsp;".getGameEventName(abs(getGameobjectEvent($data['guid']))), $text, 0, 0);
1054 if (getGameobjectPool($data['guid']))
1055 $text = substr_replace("<br>$lang[pool]&nbsp;(".getGameobjectPool($data['guid']).")", $text, 0, 0);
1056 if (getGameobjectPoolTemplate($data['id']))
1057 $text = substr_replace("<br>$lang[pool]&nbsp;(".getGameobjectPoolTemplate($data['id']).")", $text, 0, 0);
1059 return array(
1060 'id'=>$data['id'],
1061 'x'=>$y,
1062 'y'=>$x,
1063 'imgX'=>$imgX,
1064 'imgY'=>$imgY,
1065 'image'=>$img,
1066 'href'=>"",
1067 'tooltip'=> $text);
1069 function get_mapAreaData($areaId, $pointsList = 0)
1071 global $gAreaCoord;
1072 $area = getRenderAreaData($areaId);
1073 if (empty($area))
1075 echo "$lang[map_no_found]&nbsp;$areaId<br>";
1076 return;
1078 $map = array();
1079 // Äàííûå êàðòû
1080 $mapId = $area[0];
1081 $areaY1 = $area[2];
1082 $areaY2 = $area[3];
1083 $areaX1 = $area[4];
1084 $areaX2 = $area[5];
1086 $map['header']= $area[1] == 0 ? getMapName($mapId): getAreaName($area[1]);
1087 $map['width'] = 1002;
1088 $map['height']= 668;
1089 $map['coord'] = 0;
1090 $map['image'] = "images/map_image/areas/".$area[6];
1092 if($pointsList)
1093 foreach ($pointsList as &$point)
1095 $posMap= $point['map'];
1096 $posX = $point['position_x'];
1097 $posY = $point['position_y'];
1098 if ($area[1] == 0)
1099 transformAreaCoordinates($posMap, $posX, $posY);
1100 if ($mapId == $posMap AND
1101 $areaY1 >= $posY AND $areaY2 <= $posY AND
1102 $areaX1 >= $posX AND $areaX2 <= $posX)
1104 $x = ($posX-$areaX1)/($areaX2-$areaX1); // 0-1 on image
1105 $y = ($posY-$areaY1)/($areaY2-$areaY1); // 0-1 on image
1106 $map['points'][]=getPointData($areaId, $point, $x, $y);
1109 return $map;