/TomTom_FF
local lastx,lasty,total = 0,0,0 |
local instance = select(2,IsInInstance()) |
function getposition() |
local c,z = GetCurrentMapContinent(), GetCurrentMapZone() |
local x,y = GetPlayerMapPosition("player") |
x,y = floor(x * 10000)/100,floor(y * 10000)/100 |
return c,z,x,y |
end |
local function onUpdate(self,elapsed) |
total = total + elapsed |
if total >= 2 then |
if (instance == "pvp" or instance == "none") and UnitExists(TTFF) and UnitIsConnected(TTFF) then |
local c,z = GetCurrentMapContinent(), GetCurrentMapZone() |
local x,y = GetPlayerMapPosition("player") |
x,y = floor(x * 10000)/100,floor(y * 10000)/100 |
local data = {c,z,x,y} |
local c,z,x,y = getposition() |
local data = c.."!"..z.."!"..x.."!"..y |
if x ~= lastx and y ~= lasty then |
SendAddonMessage("TTFF", data, "WHISPER", TTFF) |
lastx,lasty = x,y |
if TTFF == 0 and prefix == "TTFF" and message == "TARGET" then |
TTFF = sender |
f:SetScript("OnUpdate", onUpdate) |
print("TTFF: "..arg1.." has set you as friend, set him as mine too.") |
print("TTFF: "..arg1.." has set you as friend, set him as mine too.") |
end |
if prefix == "TTFF" and UnitExists(TTFF) then |
local c,z,x,y = unpack(message) |
TomTom:AddZWaypoint(c, z, x, y, sender, false, false, false, nil, true, true) |
local c,z,x,y = string.split("!",message) |
c,z,x,y = tonumber(c),tonumber(z),tonumber(x),tonumber(y) |
if GetCurrentMapContinent() == c then |
if c and z and x and y then TomTom:AddZWaypoint(c, z, x, y, sender, false, false, false, nil, true, true) end |
end |
end |
end) |
if UnitExists(arg1) and UnitIsConnected(arg1) then |
SendAddonMessage("TTFF", "TARGET", "WHISPER", arg1) |
TTFF = arg1 |
print("TTFF: friend sent to "..arg1) |
local c,z,x,y = getposition() |
local data = c.."!"..z.."!"..x.."!"..y |
SendAddonMessage("TTFF", data, "WHISPER", TTFF) |
f:SetScript("OnUpdate", onUpdate) |
print("TTFF: friend sent to "..arg1) |
end |
end |
end |