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