SHARE
TWEET

Untitled

a guest Oct 10th, 2016 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. call SetMapToCurrentZone() if zones changes! "ZONE_CHANGED_NEW_AREA" event
  2.  
  3. use GetCurrentMapZone() to get the index number
  4.  
  5. example to check distance for UnitID = function, works only for Eastern Kingdoms!:
  6.  
  7. function VHM:GetMapScale()
  8.     if VHM.GetNumPartyMembers() > 0 then
  9.         SetMapToCurrentZone()
  10.         local UnitID = "party1"
  11.         local px,py = GetPlayerMapPosition("player")
  12.         local ux,local uy = GetPlayerMapPosition(UnitID)
  13.        
  14.         local distance = sqrt(((px - ux)/MapScales[GetCurrentMapZone()].x)^2 + ((py - uy)/MapScales[GetCurrentMapZone()].y)^2)
  15.         DEFAULT_CHAT_FRAME:AddMessage(distance)
  16.     end
  17. end
  18.  
  19. MapScales = {
  20. -- Kalimdor
  21.     [1] = {x=0.00018538534641226,y=0.00027837923594884}, -- Ashenvale
  22.     [2] = {x=0.0002110515322004,y=0.00031666883400508}, -- Aszhara
  23.     [3] = {x=0.00016346999577114,y=0.0002448782324791}, -- Darkshore
  24.     [4] = {x=0.001011919762407,y=0.0015176417572158}, -- Darnassus
  25.     [5] = {x=0.000238049243117769,y=0.00035701000264713}, -- Desolace
  26.     [6] = {x=0.000202241752828887,y=0.00030311250260898},  -- Durotar
  27.     [7] = {x=0.00020404585770198,y=0.00030594425542014}, -- Dustwallow
  28.     [8] = {x=0.00018605589866638,y=0.00027919347797121}, -- Felwood
  29.     [9] = {x=0.00015413335391453,y=0.00023112978254046}, -- Feralas
  30.     [10] = {x=0.00046338992459433,y=0.00069469745670046}, -- Moonglade
  31.     [11] = {x=0.00020824585642133,y=0.00031234536852155}, -- Mulgor
  32.     [12] = {x=0.00076302673135485,y=0.0011450946331024}, -- Orgrimmar
  33.     [13] = {x=0.00030702139650072,y=0.00046115900788988}, -- Silithus
  34.     [14] = {x=0.0002192035317421,y=0.00032897400004523}, -- Stonetalon
  35.     [15] = {x=0.00015519559383392,y=0.00023255497217178}, -- Tanaris
  36.     [16] = {x=0.00021010743720191,y=0.00031522342136928}, -- Teldrassil
  37.     [17] = {x=0.0001055257661002,y=0.00015825512153762}, -- Barrens
  38.     [18] = {x=0.00024301665169852,y=0.00036516572747912}, -- Needles
  39.     [19] = {x=0.00102553303755263,y=0.0015390366315842}, -- Thunderbluff
  40.     [20] = {x=0.00028926772730691,y=0.0004336131470544}, -- Ungoro
  41.     [21] = {x=0.0001503484589713,y=0.0002260080405644}, -- Winterspring
  42.  
  43. -- Eastern Kingdoms
  44.     [1] = {x=0.00038236060312816,y=0.00057270910058703}, -- Alterac mountains
  45.     [2] = {x=0.00029711957488741,y=0.00044587893145425}, -- arathi
  46.     [3] = {x=0.00043004538331713,y=0.00064518196242196}, -- Badlands
  47.     [4] = {x=0.00031955327306475,y=0.00047930649348668}, -- blasted lands
  48.     [5] = {x=0.00036544565643583,y=0.00054845426763807}, -- Burning steppes
  49.     [6] = {x=0.00042719074657985,y=0.00064268921102796}, -- deadwind pass
  50.     [7] = {x=0.00021748670509883,y=0.00032613213573183}, -- Dun Morogh
  51.     [8] = {x=0.00039665134889739,y=0.000594192317755393},-- duskwood
  52.     [9] = {x=0.00027669753347124,y=0.00041501436914716}, -- EPL
  53.     [10] = {x=0.00030816452843802,y=0.00046261719294957}, -- Elwynn Forest
  54.     [11] = {x=0.00033472904137203,y=0.00050214784485953}, -- hillsbrad
  55.     [12] = {x=0.0013541845338685,y=0.0020301469734737}, -- Ironforge
  56.     [13] = {x=0.00038827742849077,y=0.000582420040021079}, -- loch modan
  57.     [14] = {x=0.00049317521708352,y=0.0007399320602417}, -- redridge mountains
  58.     [15] = {x=0.00047916280371802,y=0.00071918751512255}, -- Searing G.
  59.     [16] = {x=0.00025506743362975,y=0.00038200191089085}, -- silverpine
  60.     [17] = {x=0.00079576990434102,y=0.0011931381055287}, -- Stormwind
  61.     [18] = {x=0.00016783603600093,y=0.00025128040994917}, -- stranglethorn
  62.     [19] = {x=0.00046689595494952,y=0.00070027368409293}, -- swamp of sorrows
  63.     [20] = {x=0.0002777065549578,y=0.00041729531117848}, -- Hinterlands
  64.     [21] = {x=0.00023638989244189,y=0.0003550010068076}, -- Tirisfal
  65.     [22] = {x=0.0011167100497655,y=0.0016737942184721}, -- Undercity
  66.     [23] = {x=0.00024908781051636,y=0.00037342309951782}, -- WPL
  67.     [24] = {x=0.00030591232436044,y=0.00045816733368805},-- westfall
  68.     [25] = {x=0.00025879591703415,y=0.00038863212934562}, -- wetlands
  69. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top