Compare with Previous | Blame | View Log
local function CreateText(offset) local text = WorldMapButton:CreateFontString(nil, 'ARTWORK') text:SetPoint('TOPLEFT', WorldMapButton, 0, offset) text:SetFontObject('GameFontNormal') text:SetJustifyH('LEFT') return text end local function OnUpdate(player, cursor) local centerx, centery = WorldMapDetailFrame:GetCenter() local px, py = GetPlayerMapPosition('player') local x, y = GetCursorPosition() x = ((x / WorldMapFrame:GetScale()) - (centerx - (WorldMapDetailFrame:GetWidth() / 2))) / 10 y = (((centery + (WorldMapDetailFrame:GetHeight() / 2)) - (y / WorldMapFrame:GetScale())) / WorldMapDetailFrame:GetHeight()) * 100 player:SetFormattedText('Player X,Y: %.2d,%.2d', px * 100, py * 100) if(x >= 100 or y >= 100 or x <= 0 or y <= 0) then cursor:SetText('Cursor X,Y: |cffff0000Out of bounds!') else cursor:SetFormattedText('Cursor X,Y: %.2d,%.2d', x, y) end end local function OnEvent(self) if(not IsAddOnLoaded('TomTom')) then local player = CreateText(40) local cursor = CreateText(20) local elapsed = 0 self:SetScript('OnUpdate', function(self, u) elapsed = elapsed + u if(elapsed > 0.1) then OnUpdate(player, cursor) elapsed = 0 end end) end UIPanelWindows['WorldMapFrame'] = {area = 'center', pushable = 9} hooksecurefunc(WorldMapFrame, 'Show', function(self) self:SetScale(0.75) self:EnableKeyboard(false) self:EnableMouse(false) BlackoutWorld:Hide() end) WorldMapZoneMinimapDropDown:Hide() WorldMapZoomOutButton:Hide() end local addon = CreateFrame('Frame') addon:SetScript('OnEvent', OnEvent) addon:RegisterEvent('PLAYER_LOGIN')