EndScense хукнуть и на DirectX сделать ее, координаты получать с памяти клиента.
PHP код:
local f = CreateFrame("frame", "arr", UIParent)
f:SetSize(150, 150)
f:SetPoint("CENTER", -200, -120)
f:SetBackdrop({
--bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
--edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
--edgeSize = 10,
--insets={left = 3, right = 3, top = 3, bottom = 3}
})
f.arrow = f:CreateTexture(nil, "OVERLAY")
f.arrow:SetPoint("CENTER", 0, 0)
f.down = false
local function GetDistance(x1, x2, y1, y2)
return ((x1 - x2) ^ 2) + ((y1 - y2) ^ 2)
end
local function GetDir(ux, uy, px, py)
if not WorldMapFrame:IsShown() then
SetMapToCurrentZone()
end
if px == 0 and py == 0 then
return 0, print("3.14зда рулю, на этой карте нельзя сделать стрелочку")
end
local w, h = WorldMapButton:GetSize()
return -(math.rad(((GetPlayerFacing() - math.atan2((px - ux) * w,(py - uy) * h)) * 180 / math.pi + 180) % 360 - 180))
end
local function CGrad(perc, ...)
local num = select("#", ...)
local r, g, b = 1, 1, 1
num = num / 3
local segment, relperc = math.modf(perc * (num - 1))
local r1, g1, b1, r2, g2, b2
r1, g1, b1 = select((segment * 3) + 1, ...), select((segment * 3) + 2, ...), select((segment * 3) + 3, ...)
r2, g2, b2 = select((segment * 3) + 4, ...), select((segment * 3) + 5, ...), select((segment * 3) + 6, ...)
if not r2 or not g2 or not b2 then
return r1, g1, b1
else
return r1 + (r2 - r1) * relperc, g1 + (g2 - g1) * relperc, b1 + (b2 - b1) * relperc
end
if (perc == 1)
r, g, b = select(num - 2, ...), select(num - 1, ...), select(num, ...)
else
num = num / 3
local segment, relperc = math.modf(perc * (num - 1))
end
return r, g, b
end
local count = 0
f:SetScript("OnUpdate", function(self, elapsed)
local px, py = GetPlayerMapPosition("player")
px, py = px * 100, py * 100
local cell
local unit = string.format("party%d", 1)
if (UnitExists(unit)) then
local ux, uy = GetPlayerMapPosition(unit)
ux, uy = ux * 100, uy * 100
local udist = GetDistance(px, ux, py, uy)
if (udist < 0.02) then
if (self.down) then
self.arrow:SetHeight(70)
self.arrow:SetWidth(53)
self.arrow:SetTexture("Interface\\AddOns\\TomTom\\Images\\Arrow-UP")
self.arrow:SetVertexColor(0, 1, 0)
self.down = false
end
count = count + 1
if count >= 55 then count = 0 end
cell = count
local col = cell % 9
local row = floor(cell / 9)
self.arrow:SetTexCoord((col * 53) / 512, ((col + 1) * 53) / 512, (row * 70) / 512, ((row + 1) * 70) / 512)
else
if (not self.down) then
self.arrow:SetHeight(56)
self.arrow:SetWidth(42)
self.arrow:SetTexture("Interface\\AddOns\\TomTom\\Images\\Arrow")
self.down = true
end
local angle = GetDir(ux, uy, px, py)
self.arrow:SetVertexColor(CGrad(math.abs((math.pi - math.abs(angle)) / math.pi), 1, 0, 0, 1, 1, 0, 0, 1, 0))
cell = floor(angle / (math.pi * 2) * 108 + 0.5) % 108
local col = cell % 9
local row = floor(cell / 9)
self.arrow:SetTexCoord((col * 56) / 512, ((col + 1) * 56) / 512, (row * 42) / 512, ((row + 1) * 42) / 512)
end
end
end)