+-- Coords.lua
+local _;
+local CTimerAfter = C_Timer.After;
+
+local updating = false;
+local zoneChanged = true;
+
+local frame = CreateFrame("Frame", "OmaCoords", UIParent);
+frame:SetPoint("CENTER", UIParent, "CENTER", 0, 60);
+frame:SetWidth(1);
+frame:SetHeight(1);
+frame.text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
+frame.text:SetPoint("CENTER");
+frame:SetScript("OnEvent", function() zoneChanged = true end);
+frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
+frame:Hide();
+
+local function update()
+ if updating then
+ if zoneChanged then
+ SetMapToCurrentZone();
+ zoneChanged = false;
+ end
+ local x, y = GetPlayerMapPosition("player");
+ frame.text:SetFormattedText("%.1f, %.1f", (x or 0)*100, (y or 0)*100);
+ CTimerAfter(0.2, update);
+ end
+end
+
+SLASH_OMACOORDS1 = "/coords";
+function SlashCmdList.OMACOORDS()
+ if frame:IsShown() then
+ updating = false;
+ frame:Hide();
+ else
+ updating = true;
+ update();
+ frame:Show();
+ end
+end