38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
| EVERY FRAME
 | |
| function()
 | |
|     local function range (val, min, max, max2)
 | |
|         val = 1 - (((max - val) / (max - min)) * max2)
 | |
|         return val
 | |
|     end
 | |
|     local pX = UnitPosition("player") or 0
 | |
|     local pY = select(2,UnitPosition("player")) or 0
 | |
|     local tX = UnitPosition("Alurielle") or 0
 | |
|     local tY = select(2,UnitPosition("Alurielle")) or 0
 | |
|     local X = pX - tX
 | |
|     local Y = pY - tY
 | |
|     local playerFace = GetPlayerFacing() or 0
 | |
|     local playerA = math.floor(playerFace * 100)
 | |
|     playerA = range(playerA, 0, 630, 360) - 1
 | |
|     playerA = - playerA
 | |
|     playerA = playerA - 90
 | |
|     if playerA < 0 then playerA = playerA + 360 end
 | |
|     aura_env.hyp = math.sqrt((math.abs(X^2)) + (math.abs(Y^2)))
 | |
|     aura_env.angle = math.deg(math.atan2(X,Y))
 | |
|     if aura_env.angle < 0 then aura_env.angle = aura_env.angle + 360 end
 | |
|     aura_env.angle = aura_env.angle - playerA
 | |
| end
 | |
| 
 | |
| DISPLAY
 | |
| function()
 | |
|     local pX = UnitPosition("player") or 0
 | |
|     local pY = select(2,UnitPosition("player")) or 0
 | |
|     local tX = UnitPosition("Alurielle") or 0
 | |
|     local tY = select(2,UnitPosition("Alurielle")) or 0
 | |
|     local X = pX - tX
 | |
|     local Y = pY - tY
 | |
|     local hyp = math.floor(math.sqrt((math.abs(X^2)) + (math.abs(Y^2))))
 | |
|     return hyp
 | |
| end
 | |
| 
 | |
| INIT
 | |
| aura_env.angle = 0 |