Advertisement
Yakumile

astro

Mar 25th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.74 KB | None | 0 0
  1. --[[
  2. Name: Astrolabe
  3. Revision: $Rev: 17 $
  4. $Date: 2006-11-26 09:36:31 +0100 (So, 26 Nov 2006) $
  5. Author(s): Esamynn (jcarrothers@gmail.com)
  6. Inspired By: Gatherer by Norganna
  7. MapLibrary by Kristofer Karlsson (krka@kth.se)
  8. Website: http://esamynn.wowinterface.com/
  9. Documentation:
  10. SVN:
  11. Description:
  12. This is a library for the World of Warcraft UI system to place
  13. icons accurately on both the Minimap and the Worldmaps accurately
  14. and maintain the accuracy of those positions.
  15.  
  16. License:
  17.  
  18. Copyright (C) 2006 James Carrothers
  19.  
  20. This library is free software; you can redistribute it and/or
  21. modify it under the terms of the GNU Lesser General Public
  22. License as published by the Free Software Foundation; either
  23. version 2.1 of the License, or (at your option) any later version.
  24.  
  25. This library is distributed in the hope that it will be useful,
  26. but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  28. Lesser General Public License for more details.
  29.  
  30. You should have received a copy of the GNU Lesser General Public
  31. License along with this library; if not, write to the Free Software
  32. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  33. ]]
  34.  
  35. local LIBRARY_VERSION_MAJOR = "Astrolabe-0.2"
  36. local LIBRARY_VERSION_MINOR = "$Revision: 17 $"
  37.  
  38. if not AceLibrary then error(LIBRARY_VERSION_MAJOR .. " requires AceLibrary.") end
  39. if not AceLibrary:IsNewVersion(LIBRARY_VERSION_MAJOR, LIBRARY_VERSION_MINOR) then return end
  40.  
  41. Astrolabe = {};
  42.  
  43. -- define local variables for Data Tables (defined at the end of this file)
  44. local WorldMapSize, MinimapSize;
  45.  
  46. --------------------------------------------------------------------------------------------------------------
  47. -- Working Tables and Config Constants
  48. --------------------------------------------------------------------------------------------------------------
  49.  
  50. Astrolabe.LastPlayerPosition = {};
  51. Astrolabe.MinimapIcons = {};
  52.  
  53.  
  54. Astrolabe.MinimapUpdateTime = 0.2;
  55. Astrolabe.UpdateTimer = 0;
  56. Astrolabe.ForceNextUpdate = false;
  57.  
  58. local twoPi = math.pi * 2;
  59.  
  60.  
  61. --------------------------------------------------------------------------------------------------------------
  62. -- General Uility Functions
  63. --------------------------------------------------------------------------------------------------------------
  64.  
  65. local function getContPosition( zoneData, z, x, y )
  66. --Fixes nil error
  67. if z < 0 then
  68. z = 1;
  69. end
  70. if ( z ~= 0 ) then
  71. zoneData = zoneData[z];
  72. x = x * zoneData.width + zoneData.xOffset;
  73. y = y * zoneData.height + zoneData.yOffset;
  74. else
  75. x = x * zoneData.width;
  76. y = y * zoneData.height;
  77. end
  78. return x, y;
  79. end
  80.  
  81. function Astrolabe:ComputeDistance( c1, z1, x1, y1, c2, z2, x2, y2 )
  82. z1 = z1 or 0;
  83. z2 = z2 or 0;
  84.  
  85. local dist, xDelta, yDelta;
  86. if ( c1 == c2 and z1 == z2 ) then
  87. -- points in the same zone
  88. local zoneData = WorldMapSize[c1];
  89. if ( z1 ~= 0 ) then
  90. zoneData = zoneData[z1];
  91. end
  92. if zoneData == nil then
  93. return 0, 0, 0; -- temporary fix, todo: log this
  94. end
  95. xDelta = (x2 - x1) * zoneData.width;
  96. yDelta = (y2 - y1) * zoneData.height;
  97.  
  98. elseif ( c1 == c2 ) then
  99. -- points on the same continent
  100. local zoneData = WorldMapSize[c1];
  101. if zoneData == nil then
  102. return 0, 0, 0; -- temporary fix, todo: log this
  103. end
  104. x1, y1 = getContPosition(zoneData, z1, x1, y1);
  105. x2, y2 = getContPosition(zoneData, z2, x2, y2);
  106. xDelta = (x2 - x1);
  107. yDelta = (y2 - y1);
  108.  
  109. elseif ( c1 and c2 ) then
  110. local cont1 = WorldMapSize[c1];
  111. local cont2 = WorldMapSize[c2];
  112. if cont1 == nil or cont2 == nil then
  113. return 0, 0, 0; -- temporary fix, todo: log this
  114. end
  115. if ( cont1.parentContinent == cont2.parentContinent ) then
  116. if ( c1 ~= cont1.parentContinent ) then
  117. x1, y1 = getContPosition(cont1, z1, x1, y1);
  118. x1 = x1 + cont1.xOffset;
  119. y1 = y1 + cont1.yOffset;
  120. end
  121. if ( c2 ~= cont2.parentContinent ) then
  122. x2, y2 = getContPosition(cont2, z2, x2, y2);
  123. x2 = x2 + cont2.xOffset;
  124. y2 = y2 + cont2.yOffset;
  125. end
  126.  
  127. xDelta = x2 - x1;
  128. yDelta = y2 - y1;
  129. end
  130.  
  131. end
  132. if ( xDelta and yDelta ) then
  133. dist = sqrt(xDelta*xDelta + yDelta*yDelta);
  134. end
  135. return dist, xDelta, yDelta;
  136. end
  137.  
  138. function Astrolabe:TranslateWorldMapPosition( C, Z, xPos, yPos, nC, nZ )
  139. Z = Z or 0;
  140. nZ = nZ or 0;
  141. if ( nC < 0 ) then
  142. return;
  143. end
  144.  
  145. --Fixes nil error.
  146. if(C < 0) then
  147. C=2;
  148. end
  149. if(nC < 0) then
  150. nC = 2;
  151. end
  152.  
  153. local zoneData;
  154. if ( C == nC and Z == nZ ) then
  155. return xPos, yPos;
  156.  
  157. elseif ( C == nC ) then
  158. -- points on the same continent
  159. zoneData = WorldMapSize[C];
  160. xPos, yPos = getContPosition(zoneData, Z, xPos, yPos);
  161. if ( nZ ~= 0 ) then
  162. zoneData = WorldMapSize[C][nZ];
  163. xPos = xPos - zoneData.xOffset;
  164. yPos = yPos - zoneData.yOffset;
  165. end
  166.  
  167. elseif ( C and nC ) and ( WorldMapSize[C].parentContinent == WorldMapSize[nC].parentContinent ) then
  168. -- different continents, same world
  169. zoneData = WorldMapSize[C];
  170. local parentContinent = zoneData.parentContinent;
  171. xPos, yPos = getContPosition(zoneData, Z, xPos, yPos);
  172. if ( C ~= parentContinent ) then
  173. -- translate up to world map if we aren't there already
  174. xPos = xPos + zoneData.xOffset;
  175. yPos = yPos + zoneData.yOffset;
  176. zoneData = WorldMapSize[parentContinent];
  177. end
  178. if ( nC ~= parentContinent ) then
  179. --translate down to the new continent
  180. zoneData = WorldMapSize[nC];
  181. xPos = xPos - zoneData.xOffset;
  182. yPos = yPos - zoneData.yOffset;
  183. if ( nZ ~= 0 ) then
  184. zoneData = zoneData[nZ];
  185. xPos = xPos - zoneData.xOffset;
  186. yPos = yPos - zoneData.yOffset;
  187. end
  188. end
  189.  
  190. else
  191. return;
  192. end
  193.  
  194. return (xPos / zoneData.width), (yPos / zoneData.height);
  195. end
  196.  
  197. Astrolabe_LastX = 0;
  198. Astrolabe_LastY = 0;
  199. Astrolabe_LastZ = 0;
  200. Astrolabe_LastC = 0;
  201. function Astrolabe:GetCurrentPlayerPosition()
  202. Z = GetCurrentMapZone();
  203. C = GetCurrentMapContinent();
  204. local x, y = GetPlayerMapPosition("player");
  205. if(WorldMapFrame:IsVisible() == nil or (Astrolabe_LastZ == Z and Astrolabe_LastC == C)) then
  206. if ( x <= 0 and y <= 0 ) then
  207. SetMapToCurrentZone();
  208. x, y = GetPlayerMapPosition("player");
  209. Astrolabe_LastX = x;
  210. Astrolabe_LastY = y;
  211. if ( x <= 0 and y <= 0 ) then
  212. SetMapZoom(GetCurrentMapContinent());
  213. x, y = GetPlayerMapPosition("player");
  214. Astrolabe_LastX = x;
  215. Astrolabe_LastY = y;
  216. if ( x <= 0 and y <= 0 ) then
  217. -- we are in an instance or otherwise off the continent map
  218. return;
  219. end
  220. end
  221. end
  222. Astrolabe_LastZ = GetCurrentMapZone();
  223. Astrolabe_LastC = GetCurrentMapContinent();
  224. return Astrolabe_LastC, Astrolabe_LastZ, x, y;
  225. else
  226. return Astrolabe_LastC, Astrolabe_LastZ, Astrolabe_LastX, Astrolabe_LastY;
  227. end
  228. end
  229.  
  230. --------------------------------------------------------------------------------------------------------------
  231. -- Working Table Cache System
  232. --------------------------------------------------------------------------------------------------------------
  233.  
  234. local tableCache = {};
  235. tableCache["__mode"] = "v";
  236. setmetatable(tableCache, tableCache);
  237.  
  238. local function GetWorkingTable( icon )
  239. if ( tableCache[icon] ) then
  240. return tableCache[icon];
  241. else
  242. local T = {};
  243. tableCache[icon] = T;
  244. return T;
  245. end
  246. end
  247.  
  248.  
  249. --------------------------------------------------------------------------------------------------------------
  250. -- Minimap Icon Placement
  251. --------------------------------------------------------------------------------------------------------------
  252.  
  253. function Astrolabe:PlaceIconOnMinimap( icon, continent, zone, xPos, yPos )
  254. -- check argument types
  255. self:argCheck(icon, 2, "table");
  256. self:assert(icon.SetPoint and icon.ClearAllPoints, "Usage Message");
  257. self:argCheck(continent, 3, "number");
  258. self:argCheck(zone, 4, "number", "nil");
  259. self:argCheck(xPos, 5, "number");
  260. self:argCheck(yPos, 6, "number");
  261.  
  262. local lC, lZ, lx, ly = unpack(self.LastPlayerPosition);
  263. local dist, xDist, yDist = self:ComputeDistance(lC, lZ, lx, ly, continent, zone, xPos, yPos);
  264. if not ( dist ) then
  265. --icon's position has no meaningful position relative to the player's current location
  266. return -1;
  267. end
  268. local iconData = self.MinimapIcons[icon];
  269. if not ( iconData ) then
  270. iconData = GetWorkingTable(icon);
  271. self.MinimapIcons[icon] = iconData;
  272. end
  273. iconData.continent = continent;
  274. iconData.zone = zone;
  275. iconData.xPos = xPos;
  276. iconData.yPos = yPos;
  277. iconData.dist = dist;
  278. iconData.xDist = xDist;
  279. iconData.yDist = yDist;
  280.  
  281. --show the new icon and force a placement update on the next screen draw
  282. icon:Show()
  283. self.UpdateTimer = 0;
  284. Astrolabe.ForceNextUpdate = true;
  285.  
  286. return 0;
  287. end
  288.  
  289. function Astrolabe:RemoveIconFromMinimap( icon )
  290. if not ( self.MinimapIcons[icon] ) then
  291. return 1;
  292. end
  293. self.MinimapIcons[icon] = nil;
  294. icon:Hide();
  295. return 0;
  296. end
  297.  
  298. function Astrolabe:RemoveAllMinimapIcons()
  299. local minimapIcons = self.MinimapIcons
  300. for k, v in pairs(minimapIcons) do
  301. minimapIcons[k] = nil;
  302. k:Hide();
  303. end
  304. end
  305.  
  306. local function placeIconOnMinimap( minimap, minimapZoom, mapWidth, mapHeight, icon, dist, xDist, yDist )
  307. --TODO: add support for non-circular minimaps
  308. local mapDiameter;
  309. if ( Astrolabe.minimapOutside or true) then -- cheeky bastard
  310. mapDiameter = MinimapSize.outdoor[minimapZoom];
  311. else
  312. mapDiameter = MinimapSize.indoor[minimapZoom];
  313. end
  314. local mapRadius = mapDiameter / 2;
  315. local xScale = mapDiameter / mapWidth;
  316. local yScale = mapDiameter / mapHeight;
  317. local iconDiameter = ((icon:GetWidth() / 2) + 3) * xScale;
  318.  
  319. icon:ClearAllPoints();
  320. if ( (dist + iconDiameter) > mapRadius ) then
  321. -- position along the outside of the Minimap
  322. local factor = (mapRadius - iconDiameter) / dist;
  323. xDist = xDist * factor;
  324. yDist = yDist * factor;
  325. end
  326. icon:SetPoint("CENTER", minimap, "CENTER", xDist/xScale, -yDist/yScale);
  327. end
  328.  
  329. local lastZoom;
  330. function Astrolabe:UpdateMinimapIconPositions()
  331. local C, Z, x, y = self:GetCurrentPlayerPosition();
  332. if not ( C and Z and x and y ) then
  333. self.processingFrame:Hide();
  334. end
  335. local Minimap = Minimap;
  336. local lastPosition = self.LastPlayerPosition;
  337. local lC, lZ, lx, ly = unpack(lastPosition);
  338.  
  339. if ( (lC == C and lZ == Z and lx == x and ly == y)) then--Added or WorldMapFrame:IsVisible() to fix the jumping around minimap icons when the map is opened -- Removed it not needed?
  340. -- player has not moved since the last update
  341. if ( lastZoom ~= Minimap:GetZoom() or self.ForceNextUpdate ) then
  342. local currentZoom = Minimap:GetZoom();
  343. lastZoom = currentZoom;
  344. local mapWidth = Minimap:GetWidth();
  345. local mapHeight = Minimap:GetHeight();
  346. for icon, data in pairs(self.MinimapIcons) do
  347. placeIconOnMinimap(Minimap, currentZoom, mapWidth, mapHeight, icon, data.dist, data.xDist, data.yDist);
  348. end
  349. self.ForceNextUpdate = false;
  350. end
  351. else
  352. local dist, xDelta, yDelta = self:ComputeDistance(lC, lZ, lx, ly, C, Z, x, y);
  353. local currentZoom = Minimap:GetZoom();
  354. lastZoom = currentZoom;
  355. local mapWidth = Minimap:GetWidth();
  356. local mapHeight = Minimap:GetHeight();
  357. for icon, data in pairs(self.MinimapIcons) do
  358. local xDist = data.xDist - xDelta;
  359. local yDist = data.yDist - yDelta;
  360. local dist = sqrt(xDist*xDist + yDist*yDist);
  361.  
  362. placeIconOnMinimap(Minimap, currentZoom, mapWidth, mapHeight, icon, dist, xDist, yDist);
  363.  
  364. data.dist = dist;
  365. data.xDist = xDist;
  366. data.yDist = yDist;
  367. end
  368.  
  369. lastPosition[1] = C;
  370. lastPosition[2] = Z;
  371. lastPosition[3] = x;
  372. lastPosition[4] = y;
  373. --self.LastPlayerPosition = lastPosition;--It did not set before? Wonder why...
  374. end
  375. end
  376.  
  377. function Astrolabe:CalculateMinimapIconPositions()
  378. local C, Z, x, y = self:GetCurrentPlayerPosition();
  379. if not ( C and Z and x and y ) then
  380. self.processingFrame:Hide();
  381. end
  382.  
  383. local currentZoom = Minimap:GetZoom();
  384. lastZoom = currentZoom;
  385. local Minimap = Minimap;
  386. local mapWidth = Minimap:GetWidth();
  387. local mapHeight = Minimap:GetHeight();
  388. for icon, data in pairs(self.MinimapIcons) do
  389. local dist, xDist, yDist = self:ComputeDistance(C, Z, x, y, data.continent, data.zone, data.xPos, data.yPos);
  390. placeIconOnMinimap(Minimap, currentZoom, mapWidth, mapHeight, icon, dist, xDist, yDist);
  391.  
  392. data.dist = dist;
  393. data.xDist = xDist;
  394. data.yDist = yDist;
  395. end
  396.  
  397. local lastPosition = self.LastPlayerPosition;
  398. lastPosition[1] = C;
  399. lastPosition[2] = Z;
  400. lastPosition[3] = x;
  401. lastPosition[4] = y;
  402. --self.LastPlayerPosition = lastPosition;--It did not set before? Wonder why...
  403. end
  404.  
  405. function Astrolabe:GetDistanceToIcon( icon )
  406. local data = Astrolabe.MinimapIcons[icon];
  407. if ( data ) then
  408. return data.dist, data.xDist, data.yDist;
  409. end
  410. end
  411.  
  412. function Astrolabe:GetDirectionToIcon( icon )
  413. local data = Astrolabe.MinimapIcons[icon];
  414. if ( data ) then
  415. local dir = atan2(data.xDist, -(data.yDist))
  416. if ( dir > 0 ) then
  417. return twoPi - dir;
  418. else
  419. return -dir;
  420. end
  421. end
  422. end
  423.  
  424. --------------------------------------------------------------------------------------------------------------
  425. -- World Map Icon Placement
  426. --------------------------------------------------------------------------------------------------------------
  427.  
  428. function Astrolabe:PlaceIconOnWorldMap( worldMapFrame, icon, continent, zone, xPos, yPos )
  429. -- check argument types
  430. self:argCheck(worldMapFrame, 2, "table");
  431. self:assert(worldMapFrame.GetWidth and worldMapFrame.GetHeight, "Usage Message");
  432. self:argCheck(icon, 3, "table");
  433. self:assert(icon.SetPoint and icon.ClearAllPoints, "Usage Message");
  434. self:argCheck(continent, 4, "number");
  435. self:argCheck(zone, 5, "number", "nil");
  436. self:argCheck(xPos, 6, "number");
  437. self:argCheck(yPos, 7, "number");
  438.  
  439. local C, Z = GetCurrentMapContinent(), GetCurrentMapZone();
  440. local nX, nY = self:TranslateWorldMapPosition(continent, zone, xPos, yPos, C, Z);
  441. if ( nX and nY and (0 < nX and nX <= 1) and (0 < nY and nY <= 1) ) then
  442. icon:ClearAllPoints();
  443. icon:SetPoint("CENTER", worldMapFrame, "TOPLEFT", nX * worldMapFrame:GetWidth(), -nY * worldMapFrame:GetHeight());
  444. end
  445. return nX, nY;
  446. end
  447.  
  448.  
  449. --------------------------------------------------------------------------------------------------------------
  450. -- Handler Scripts
  451. --------------------------------------------------------------------------------------------------------------
  452.  
  453. function Astrolabe:OnEvent( frame, event )
  454. if ( event == "MINIMAP_UPDATE_ZOOM" ) then
  455. -- update minimap zoom scale
  456. local Minimap = Minimap;
  457. local curZoom = Minimap:GetZoom();
  458. if ( GetCVar("minimapZoom") == GetCVar("minimapInsideZoom") ) then
  459. if ( curZoom < 2 ) then
  460. Minimap:SetZoom(curZoom + 1);
  461. else
  462. Minimap:SetZoom(curZoom - 1);
  463. end
  464. end
  465. if ( GetCVar("minimapZoom")+0 == Minimap:GetZoom() ) then
  466. self.minimapOutside = true;
  467. else
  468. self.minimapOutside = false;
  469. end
  470. Minimap:SetZoom(curZoom);
  471.  
  472. -- re-calculate all Minimap Icon positions
  473. if ( frame:IsVisible() ) then
  474. self:CalculateMinimapIconPositions();
  475. end
  476.  
  477. elseif ( event == "PLAYER_LEAVING_WORLD" ) then
  478. frame:Hide();
  479. self:RemoveAllMinimapIcons(); --dump all minimap icons
  480.  
  481. elseif ( event == "PLAYER_ENTERING_WORLD" ) then
  482. frame:Show();
  483.  
  484. elseif ( event == "ZONE_CHANGED_NEW_AREA" ) then
  485. frame:Show();
  486.  
  487. end
  488. end
  489.  
  490. function Astrolabe:OnUpdate( frame, elapsed )
  491. local updateTimer = self.UpdateTimer - elapsed;
  492. if ( updateTimer > 0 ) then
  493. self.UpdateTimer = updateTimer;
  494. return;
  495. end
  496. self.UpdateTimer = self.MinimapUpdateTime;
  497. self:UpdateMinimapIconPositions();
  498. end
  499.  
  500. function Astrolabe:OnShow( frame )
  501. self:CalculateMinimapIconPositions();
  502. end
  503.  
  504.  
  505. --------------------------------------------------------------------------------------------------------------
  506. -- Library Registration
  507. --------------------------------------------------------------------------------------------------------------
  508.  
  509. local function activate( self, oldLib, oldDeactivate )
  510. Astrolabe = self;
  511. local frame = self.processingFrame;
  512. if not ( frame ) then
  513. frame = CreateFrame("Frame");
  514. self.processingFrame = frame;
  515. end
  516. frame:SetParent("Minimap");
  517. frame:Hide();
  518. frame:UnregisterAllEvents();
  519. frame:RegisterEvent("MINIMAP_UPDATE_ZOOM");
  520. frame:RegisterEvent("PLAYER_LEAVING_WORLD");
  521. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  522. frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
  523. frame:SetScript("OnEvent",
  524. function( frame, event)
  525. self:OnEvent(frame, event);
  526. end
  527. );
  528. frame:SetScript("OnUpdate",
  529. function( frame, elapsed )
  530. -- elapsed doesn't work in Lua created frames, however it is equal to the time passed between each frame. So calulcate from FPS ;)
  531. self:OnUpdate(frame, 1/GetFramerate());
  532. end
  533. );
  534. frame:SetScript("OnShow",
  535. function( frame )
  536. self:OnShow(frame);
  537. end
  538. );
  539. frame:Show();
  540.  
  541. if not ( self.ContinentList ) then
  542. self.ContinentList = { GetMapContinents() };
  543. for C in pairs(self.ContinentList) do
  544. local zones = { GetMapZones(C) };
  545. self.ContinentList[C] = zones;
  546. for Z in ipairs(zones) do
  547. SetMapZoom(C, Z);
  548. zones[Z] = GetMapInfo();
  549. end
  550. end
  551. end
  552. end
  553.  
  554. AceLibrary:Register(Astrolabe, LIBRARY_VERSION_MAJOR, LIBRARY_VERSION_MINOR, activate)
  555.  
  556.  
  557. --------------------------------------------------------------------------------------------------------------
  558. -- Data
  559. --------------------------------------------------------------------------------------------------------------
  560.  
  561. -- diameter of the Minimap in game yards at
  562. -- the various possible zoom levels
  563. MinimapSize = {
  564. indoor = {
  565. [0] = 300, -- scale
  566. [1] = 240, -- 1.25
  567. [2] = 180, -- 5/3
  568. [3] = 120, -- 2.5
  569. [4] = 80, -- 3.75
  570. [5] = 50, -- 6
  571. },
  572. outdoor = {
  573. [0] = 466 + 2/3, -- scale
  574. [1] = 400, -- 7/6
  575. [2] = 333 + 1/3, -- 1.4
  576. [3] = 266 + 2/6, -- 1.75
  577. [4] = 200, -- 7/3
  578. [5] = 133 + 1/3, -- 3.5
  579. },
  580. }
  581.  
  582. -- distances across and offsets of the world maps
  583. -- in game yards
  584. WorldMapSize = {
  585. -- World Map of Azeroth
  586. [0] = {
  587. parentContinent = 0,
  588. height = 29687.90575403711,
  589. width = 44531.82907938571,
  590. },
  591. -- Kalimdor
  592. [1] = {
  593. parentContinent = 0,
  594. height = 24532.39670836129,
  595. width = 36798.56388065484,
  596. xOffset = -8310.762035321373,
  597. yOffset = 1815.149000954498,
  598. zoneData = {
  599. Ashenvale = {
  600. height = 3843.627450950699,
  601. width = 5766.471113365881,
  602. xOffset = 15366.08027406009,
  603. yOffset = 8126.716152815561,
  604. },
  605. Aszhara = {
  606. height = 3381.153764845262,
  607. width = 5070.669448432522,
  608. xOffset = 20342.99178351035,
  609. yOffset = 7457.974565554941,
  610. },
  611. AzuremystIsle = {
  612. height = 2714.490705490833,
  613. width = 4070.691916244019,
  614. xOffset = 9966.264785353642,
  615. yOffset = 5460.139378090237,
  616. },
  617. Barrens = {
  618. height = 6756.028094350823,
  619. width = 10132.98626357964,
  620. xOffset = 14443.19633043607,
  621. yOffset = 11187.03406016663,
  622. },
  623. BloodmystIsle = {
  624. height = 2174.923922716305,
  625. width = 3262.385067990556,
  626. xOffset = 9541.280691875327,
  627. yOffset = 3424.790637352245,
  628. },
  629. Darkshore = {
  630. height = 4366.52571734943,
  631. width = 6549.780280774227,
  632. xOffset = 14124.4534386827,
  633. yOffset = 4466.419105960455,
  634. },
  635. Darnassis = {
  636. height = 705.7102838625474,
  637. width = 1058.300884213672,
  638. xOffset = 14127.75729935019,
  639. yOffset = 2561.497770365213,
  640. },
  641. Desolace = {
  642. height = 2997.808472061639,
  643. width = 4495.726850591814,
  644. xOffset = 12832.80723200791,
  645. yOffset = 12347.420176847,
  646. },
  647. Durotar = {
  648. height = 3524.884894927208,
  649. width = 5287.285801274457,
  650. xOffset = 19028.47465485265,
  651. yOffset = 10991.20642822035,
  652. },
  653. Dustwallow = {
  654. height = 3499.922239823486,
  655. width = 5249.824712249077,
  656. xOffset = 18040.98829886713,
  657. yOffset = 14832.74650226312,
  658. },
  659. Felwood = {
  660. height = 3833.206376333298,
  661. width = 5749.8046476606,
  662. xOffset = 15424.4116748014,
  663. yOffset = 5666.381311442202,
  664. },
  665. Feralas = {
  666. height = 4633.182754891688,
  667. width = 6949.760203962193,
  668. xOffset = 11624.54217828119,
  669. yOffset = 15166.06954533647,
  670. },
  671. Moonglade = {
  672. height = 1539.548478194226,
  673. width = 2308.253559286662,
  674. xOffset = 18447.22668103606,
  675. yOffset = 4308.084192710569,
  676. },
  677. Mulgore = {
  678. height = 3424.88834791471,
  679. width = 5137.32138887616,
  680. xOffset = 15018.17633401988,
  681. yOffset = 13072.38917227894,
  682. },
  683. Ogrimmar = {
  684. height = 935.3750279485016,
  685. width = 1402.563051365538,
  686. xOffset = 20746.49533101771,
  687. yOffset = 10525.68532631853,
  688. },
  689. Silithus = {
  690. height = 2322.839629859208,
  691. width = 3483.224287356748,
  692. xOffset = 14528.60591761034,
  693. yOffset = 18757.61998086822,
  694. },
  695. StonetalonMountains = {
  696. height = 3256.141917023559,
  697. width = 4883.173287670144,
  698. xOffset = 13820.29750397374,
  699. yOffset = 9882.909063258192,
  700. },
  701. Tanaris = {
  702. height = 4599.847335452488,
  703. width = 6899.765399158026,
  704. xOffset = 17284.7655865671,
  705. yOffset = 18674.28905369955,
  706. },
  707. Teldrassil = {
  708. height = 3393.632169760774,
  709. width = 5091.467863261982,
  710. xOffset = 13251.58449896318,
  711. yOffset = 968.6223632831094,
  712. },
  713. TheExodar = {
  714. height = 704.6641703983866,
  715. width = 1056.732317707213,
  716. xOffset = 10532.61275516805,
  717. yOffset = 6276.045028807911,
  718. },
  719. ThousandNeedles = {
  720. height = 2933.241274801781,
  721. width = 4399.86408093722,
  722. xOffset = 17499.32929341832,
  723. yOffset = 16766.0151133423,
  724. },
  725. ThunderBluff = {
  726. height = 695.8116150081206,
  727. width = 1043.762849319158,
  728. xOffset = 16549.32009877855,
  729. yOffset = 13649.45129927044,
  730. },
  731. UngoroCrater = {
  732. height = 2466.588521980952,
  733. width = 3699.872808671186,
  734. xOffset = 16532.70803775362,
  735. yOffset = 18765.95157787033,
  736. },
  737. Winterspring = {
  738. height = 4733.190938744951,
  739. width = 7099.756078049357,
  740. xOffset = 17382.67868933954,
  741. yOffset = 4266.421320915686,
  742. },
  743. },
  744. },
  745. -- Eastern Kingdoms
  746. [2] = {
  747. parentContinent = 0,
  748. height = 25098.84390074281,-- added 500 (seems about right total guess) to "remove" the blood elf start zones You need to logout each time you change these values
  749. width = 37649.15159852673,
  750. xOffset = 15425.32200715066,--old 15525
  751. yOffset = 1272.3934326738229,--Old 670
  752. zoneData = {
  753. Alterac = {
  754. height = 1866.508741236576,
  755. width = 2799.820894040741,
  756. xOffset = 16267.51182664554,--old 16267
  757. yOffset = 7000.598754637632,--old 7693
  758. },
  759. Arathi = {
  760. height = 2399.784956908336,
  761. width = 3599.78645678886,
  762. xOffset = 18317.40598190062,--17917.40598190062, Switched to more sane values!18317
  763. yOffset = 8826.804744097401,--9326.804744097401, 8826
  764. },
  765. Badlands = {
  766. height = 1658.195027852759,
  767. width = 2487.343589680943,
  768. xOffset = 19129.83542887301,
  769. yOffset = 15082.55526717644,
  770. },
  771. BlastedLands = {
  772. height = 2233.146573433955,
  773. width = 3349.808966078055,
  774. xOffset = 18292.37876312771,
  775. yOffset = 19759.24272564734,
  776. },
  777. BurningSteppes = {
  778. height = 1951.911155356982,
  779. width = 2928.988452241535,
  780. xOffset = 17317.44291506163,
  781. yOffset = 16224.12640057407,
  782. },
  783. DeadwindPass = {
  784. height = 1666.528298197048,
  785. width = 2499.848163715574,
  786. xOffset = 17884.07519016362,
  787. yOffset = 19059.30117481421,
  788. },
  789. DunMorogh = {
  790. height = 3283.064682642022,
  791. width = 4924.664537147015,
  792. xOffset = 15248.84370721237,
  793. yOffset = 13070.22369811241,
  794. },
  795. Duskwood = {
  796. height = 1799.84874595001,
  797. width = 2699.837284973949,
  798. xOffset = 16217.51007473156,
  799. yOffset = 18909.31475362112,
  800. },
  801. EasternPlaguelands = {
  802. height = 2581.024511737268,
  803. width = 3870.596078314358,
  804. xOffset = 19836.07699848783,--old 19636
  805. yOffset = 4593.799386328108,--Old 5393
  806. },
  807. Elwynn = {
  808. height = 2314.38613060264,
  809. width = 3470.62593362794,
  810. xOffset = 15515.46777926721,
  811. yOffset = 17132.38313881497,
  812. },
  813. EversongWoods = {
  814. height = 3283.057803444214,
  815. width = 4924.70470173181,
  816. xOffset = 19138.16325760612,
  817. yOffset = 552.5351270080572,
  818. },
  819. Ghostlands = {
  820. height = 2199.788221727843,
  821. width = 3299.755735439147,
  822. xOffset = 19933.969945598,
  823. yOffset = 3327.317139912411,
  824. },
  825. Hilsbrad = {
  826. height = 2133.153088717906,
  827. width = 3199.802496078764,
  828. xOffset = 15984.19170342619,
  829. yOffset = 8793.505832296016,
  830. },
  831. Hinterlands = {
  832. height = 2566.448674847725,
  833. width = 3849.77134323942,
  834. xOffset = 18625.69536724846,
  835. yOffset = 7226.929725104341, --Old 7726
  836. },
  837. Ironforge = {
  838. height = 527.5626661642974,
  839. width = 790.5745810546713,
  840. xOffset = 17764.34206355846,
  841. yOffset = 13762.32403658607,
  842. },
  843. LochModan = {
  844. height = 1839.436067817912,
  845. width = 2758.158752877019,
  846. xOffset = 19400.42466174755,--19044
  847. yOffset = 13500.58746225864,--13680
  848. },
  849. Redridge = {
  850. height = 1447.811817383856,
  851. width = 2170.704876735185,
  852. xOffset = 18621.52904187992,
  853. yOffset = 17767.73128664901,
  854. },
  855. SearingGorge = {
  856. height = 1487.371558351205,
  857. width = 2231.119799153945,
  858. xOffset = 17373.68649889545,
  859. yOffset = 15292.9566475719,
  860. },
  861. SilvermoonCity = {
  862. height = 806.6680775210333,
  863. width = 1211.384457945605,
  864. xOffset = 21051.29911245071,
  865. yOffset = 1440.439646345552,
  866. },
  867. Silverpine = {
  868. height = 2799.763349841058,
  869. width = 4199.739879721531,
  870. xOffset = 13601.00798540562,
  871. yOffset = 6800.945768538925,--old 7526
  872. },
  873. Stormwind = {
  874. height = 896.2784132739149,
  875. width = 1344.138055148283,
  876. xOffset = 15669.93346231942,
  877. yOffset = 17471.62163820253,
  878. },
  879. Stranglethorn = {
  880. height = 4253.796738213571,
  881. width = 6380.866711475876,
  882. xOffset = 14830.09122763351,
  883. yOffset = 20361.27611706414,
  884. },
  885. SwampOfSorrows = {
  886. height = 1529.04028583782,
  887. width = 2293.606089974149,
  888. xOffset = 19273.57577346738,
  889. yOffset = 18813.48829580375,
  890. },
  891. Tirisfal = {
  892. height = 3012.244783356771,
  893. width = 4518.469744413802,
  894. xOffset = 14017.64852522109,--old
  895. yOffset = 4556.296558943325,--old
  896. },
  897. Undercity = {
  898. height = 640.0492683780853,
  899. width = 959.3140238076666,
  900. xOffset = 16177.65630384973,--16177
  901. yOffset = 6415.685533181013,--7315
  902. },
  903. WesternPlaguelands = {
  904. height = 2866.410476553068,
  905. width = 4299.7374000546,
  906. xOffset = 16950.14908983872,--old 16634
  907. yOffset = 5000.092974820261,--old 5827
  908. },
  909. Westfall = {
  910. height = 2333.132106534445,
  911. width = 3499.786489780177,
  912. xOffset = 14034.31142029944,
  913. yOffset = 18592.67765947875,
  914. },
  915. Wetlands = {
  916. height = 2756.004767589141,
  917. width = 4135.166184805389,
  918. xOffset = 17680.35277057554,--17440
  919. yOffset = 11100.20698670613,--11341
  920. },
  921. },
  922. },
  923. -- Outland
  924. [3] = {
  925. parentContinent = 3,
  926. height = 11642.3552270912,
  927. width = 17463.5328406368,
  928. zoneData = {
  929. BladesEdgeMountains = {
  930. height = 3616.553353533977,
  931. width = 5424.84803598309,
  932. xOffset = 4150.068157139826,
  933. yOffset = 1412.982266241851,
  934. },
  935. Hellfire = {
  936. height = 3443.642890402687,
  937. width = 5164.421615455519,
  938. xOffset = 7456.223236253186,
  939. yOffset = 4339.973528794677,
  940. },
  941. Nagrand = {
  942. height = 3683.218386203915,
  943. width = 5524.827295176373,
  944. xOffset = 2700.121400200201,
  945. yOffset = 5779.512212073806,
  946. },
  947. Netherstorm = {
  948. height = 3716.547708910237,
  949. width = 5574.82788866266,
  950. xOffset = 7512.470386633603,
  951. yOffset = 365.0992858464317,
  952. },
  953. ShadowmoonValley = {
  954. height = 3666.547917042888,
  955. width = 5499.827432644566,
  956. xOffset = 8770.765422136874,
  957. yOffset = 7769.034259125071,
  958. },
  959. ShattrathCity = {
  960. height = 870.8063021892297,
  961. width = 1306.210386847456,
  962. xOffset = 6860.565394341991,
  963. yOffset = 7295.086145447915,
  964. },
  965. TerokkarForest = {
  966. height = 3599.889712038368,
  967. width = 5399.832305361811,
  968. xOffset = 5912.521284664757,
  969. yOffset = 6821.146112637057,
  970. },
  971. Zangarmarsh = {
  972. height = 3351.978685113859,
  973. width = 5026.925554043871,
  974. xOffset = 3520.930685571132,
  975. yOffset = 3885.821388791224,
  976. },
  977. },
  978. },
  979. }
  980.  
  981. for c, v in pairs(WorldMapSize[2]["zoneData"]) do
  982. v.yOffset = v.yOffset-500;
  983. end
  984.  
  985. local zeroData = { xOffset = 0, height = 0, yOffset = 0, width = 0 };
  986. for continent, zones in pairs(Astrolabe.ContinentList) do
  987. local mapData = WorldMapSize[continent];
  988. for index, mapName in pairs(zones) do
  989. if not ( mapData.zoneData[mapName] ) then
  990. --WE HAVE A PROBLEM!!!
  991. ChatFrame1:AddMessage("Astrolabe is missing data for "..select(index, GetMapZones(continent))..".");
  992. mapData.zoneData[mapName] = zeroData;
  993. end
  994. mapData[index] = mapData.zoneData[mapName];
  995. mapData.zoneData[mapName] = nil;
  996. end
  997. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement