local addon, ns = ...
local C = ns.shared.color
local L = ns.L
local location_onupdate_interval = 1
local GetPlayerMapPosition = GetPlayerMapPosition


local location_onclick = function()
	if GUILockDown == nil then 
		ToggleFrame(WorldMapFrame)
	elseif GUILockDown == 1 then 
		return 
	end
end


local location_tooltip = function(t)
	t:AddLine(L["Location Information"])
	t:AddLine(C.dkgreen(L["Hint: Click to open the World Map."]))
end


local location_onupdate = function(self)
	local x, y = GetPlayerMapPosition("player")
	self.obj.text = string.format ("%.1f/%.1f", x * 100, y * 100)
end


Broker_Everything:Register(L["Location"],
	"Interface\\Addons\\Broker_Everything\\media\\gps", --GetItemIcon(11105),
	0,
	0,
	0,
	location_onclick,
	location_tooltip,
	location_onupdate,
	location_onupdate_interval)
