commit d15e7273f1cfc4293d5b2e6589952bbdb23442a9 Author: Robin Date: Wed Jan 13 16:13:33 2021 +0100 Init diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..34950ac --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Common"] + path = Common + url = https://git.grml.de/rilgamon/Common.git diff --git a/Bindings.xml b/Bindings.xml new file mode 100644 index 0000000..1093cb9 --- /dev/null +++ b/Bindings.xml @@ -0,0 +1,3 @@ + + zzCoords_MinimapToggle() + diff --git a/Common b/Common new file mode 160000 index 0000000..762c59c --- /dev/null +++ b/Common @@ -0,0 +1 @@ +Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed diff --git a/core.lua b/core.lua new file mode 100644 index 0000000..c6f2076 --- /dev/null +++ b/core.lua @@ -0,0 +1,188 @@ +local name, addon = ... +local childName = "zz_Coords" + +local defaults = { + ["colorLDB"] = true, + ["ShowZone"] = false, + ["ShowSubZone"] = true, + ["ShowTooltip"] = false, + ["windowX"] = 10, + ["windowY"] = 5 +} +local options = { +} +local ldb = LibStub:GetLibrary("LibDataBroker-1.1") +local ldbicon = LibStub("LibDBIcon-1.0") +local db, playerCoords, zoneText, coordsline +local L = LibStub("AceLocale-3.0"):GetLocale(childName, true) +local delayOnUpdate = .5 + +function addon:GetPlayerCoords() + return playerCoords +end +local function setPlayerCoords() + playerCoords = "-, -" + local mapID = C_Map.GetBestMapForUnit("player") + if(mapID) then + local pmp = C_Map.GetPlayerMapPosition(mapID,"player") + if(pmp) then + local x,y = pmp:GetXY() + if(x and y) then + playerCoords = format("%.1f, %.1f", x*100, y*100) + end + end + end +end +local colorlist = { + ['friendly'] = "00ff00", + ['arena'] = "ffff00", + ['sanctuary'] = "9999ff", +} +local function pvpColor(txt) + local col + local pvpType, isFFA, faction = GetZonePVPInfo() + if(colorlist[pvpType]) then + col = colorlist[pvpType] + elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then + col = faction == select(2,UnitFactionGroup('player')) and "886600" or "ff0000" + else + return txt + end + return addon:colorize(txt, col) +end + +local function OnText(message) + addon:OnText(childName, message or "") +end + +local function OnTooltip(tip) + local p = tip:GetParent() + if(p.tooltip) then + tip = p.tooltip + end + tip:AddLine(childName) + tip:AddLine(GetRealZoneText()) + tip:AddLine(GetSubZoneText()) + tip:AddLine(format("%s: %s",childName,tostring(playerCoords))) + tip:AddLine(L['HINT']) + tip:AddLine(L['HINT2']) + tip:AddLine(L['HINT3']) + tip:AddLine(L['HINT4']) +end + +local function OnButton(self, button) + if(button == 'RightButton') then + if(IsShiftKeyDown()) then + zzCoords_MinimapToggle() + else + InterfaceOptionsFrame_OpenToCategory(childName) + InterfaceOptionsFrame_OpenToCategory(childName) + end + elseif(button == "LeftButton") then + if(IsShiftKeyDown()) then + local db = addon['db']['global']['ldbicons'] + db[childName]['hide'] = not db[childName]['hide'] + if(ldbicon) then + if(db[childName]['hide']) then + ldbicon:Hide(childName) + else + ldbicon:Show(childName) + end + end + else + ToggleFrame(WorldMapFrame) + end + end +end + +local function OnDataUpdate() + setPlayerCoords() + if(zoneText and zoneText~="") then + if(db['hideLDBCoords']) then + coordsline = "%s" + else + coordsline = "%s (%s)" + end + OnText(format(coordsline,(db['colorLDB'] and pvpColor(zoneText) or zoneText) or "", playerCoords or "")) + else + if(db['hideLDBCoords']) then + OnText("") + else + OnText(playerCoords or "") + end + end + C_Timer.After(delayOnUpdate, OnDataUpdate) +end + +local function limitLength(info, maxlength) + if(info and maxlength) then + if(maxlength > 0 and info:len() > maxlength) then + info = info:sub(1,maxlength).."~" + end + end + return info +end + +local function ZONED() + zoneText = db['ShowZone'] and GetRealZoneText() or "" + if(db['ShowSubZone']) then + if(GetSubZoneText() and GetSubZoneText()~="") then + if(db['ShowZone']) then + zoneText = zoneText ~= GetSubZoneText() and format("%s, %s",zoneText,GetSubZoneText()) or zoneText + else + zoneText = GetSubZoneText() + end + elseif(not db['ShowZone']) then + zoneText = GetRealZoneText() + end + end + zoneText = limitLength(zoneText,db['maxLength']) + if(not db['hideMapCoords']) then + addon['mapframe']:Show() + else + addon['mapframe']:Hide() + end +end + +local function getPref(pref) + return db[pref[#pref]] +end + +local function setPref(pref,value) + db[pref[#pref]] = value + ZONED() +end + +local function init() + options = addon:InitConfig(childName, true, { + ['type'] = "data source", + ['OnTooltipShow'] = OnTooltip, + ['OnClick'] = OnButton, + }, getPref, setPref) + db = addon['db']['profile'][childName] + C_Timer.After(delayOnUpdate, OnDataUpdate) + BINDING_HEADER_COORDS = childName + BINDING_NAME_COORDS_TOGGLE = L["Toggle Minimap"] + + addon:AddConfigEntry(childName,"toggle","hideLDBCoords",L['Hide LDB coords'],L['This hides the coords-display in your broker display'],2,nil,nil,nil,nil,options['args'][childName]) + addon:AddConfigEntry(childName,"toggle","colorLDB",L['Colorized Zone'],L['Show PvP informations about current area'],1,nil,nil,nil,nil,options['args'][childName]) + addon:AddConfigEntry(childName,"toggle","hideMapCoords",L['Hide Map coords'],L['This hides the coords-display at the bottom of your map'],2,nil,nil,nil,nil,options['args'][childName]) + addon:AddConfigEntry(childName,"toggle","ShowZone",L['Show Zone'],nil,1,nil,nil,nil,nil,options['args'][childName]) + addon:AddConfigEntry(childName,"toggle","ShowSubZone",L['Show Subzone'],nil,1,nil,nil,nil,nil,options['args'][childName]) + addon:AddConfigEntry(childName,"toggle","ShowMapID",L['Show MapID'],nil,2,nil,nil,nil,nil,options['args'][childName]) + addon:AddConfigEntry(childName,"range","maxLength",L['Max Length'],L['Limits the maximum length of the zone'],1,0,255,1,false,options['args'][childName]) + addon:AddConfigEntry(childName,"header",'windowXY',L['Mapcoords Window'],nil,6,nil,nil,nil,nil,options['args'][childName]) + addon:AddConfigEntry(childName,"range","windowX",L['Window X'],L['Adjusts the X-Offset on windowed map'],7,-512,512,1,false,options['args'][childName]) + addon:AddConfigEntry(childName,"range","windowY",L['Window Y'],L['Adjusts the Y-Offset on windowed map'],8,-512,512,1,false,options['args'][childName]) + addon:RegisterFunc({"ZONE_CHANGED_NEW_AREA","ZONE_CHANGED","ZONE_CHANGED_INDOORS","NEW_WMO_CHUNK"},"OnEvent", ZONED) + ZONED() +end + +function zzCoords_MinimapToggle() + if(MinimapCluster:IsVisible()) then + MinimapCluster:Hide() + else + MinimapCluster:Show() + end +end +addon:startup(name, childName, init, true, defaults) diff --git a/icon2.tga b/icon2.tga new file mode 100644 index 0000000..287f9e4 Binary files /dev/null and b/icon2.tga differ diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..6d2e364 --- /dev/null +++ b/license.txt @@ -0,0 +1,6 @@ +The following license excludes the libraries (Libs) included. See the libraries directory or website. + +This AddOn is public domain. That means you can change it, rename it or paint it yellow. +My name (Rilgamon) is valid only for WoWInterface.com and curse.com. +If you use/offer this addon on another website please remove my name. +If you want to give me credit you can replace it with a link to my profile on WoWInterface.com. \ No newline at end of file diff --git a/locale_deDE.lua b/locale_deDE.lua new file mode 100644 index 0000000..e88e141 --- /dev/null +++ b/locale_deDE.lua @@ -0,0 +1,43 @@ +local addonname, addon = ... +local name = "zz_Coords" +local L = LibStub("AceLocale-3.0"):NewLocale(name, "deDE", false) +if L then + L[name] = name + L[name..' Settings'] = name..' Settings' + L['Hide Map coords'] = "Verstecke Map-Koordinaten" + L['Show MapID'] = "Zeige MapID auf der Weltkarte" + L['This hides the coords-display at the bottom of your map'] = "Deaktiviert die Anzeige der Koordinaten auf der Map" + L['outbound'] = "Zeiger: - -- Spieler: " + L['Player'] = "Spieler" + L['Cursor'] = "Zeiger" + L['COORDFMTSTRING'] = function(self,x,y) return format("Zeiger: %.1f, %.1f -- Spieler: ",addon:round(x,1),addon:round(y,1)) end + L['HINT'] = "|c0000ff00Linksklick|r |c00ffffff\195\182ffnet die Karte|r" + L['HINT2'] = "|c0000ff00Rechtsklick|r |c00ffffff\195\182ffnet Einstellungen|r" + L['HINT3'] = "|c0000ff00Shift-Linksklick|r |c00ffffffschaltet Minimapicon an/aus|r" + L['HINT4'] = "|c0000ff00Shift-Rechtsklick|r |c00ffffffschaltet Minimap an/aus|r" + L['Show Zone'] = "Zeige Zone" + L['Show Subzone'] = "Zeige Subzone" + L["Toggle Minimap"] = "Minimap ein-/ausschalten" + L['Max Length'] = "Max. L\195\164nge" + L['Limits the maximum length of the zone'] = "Limitiert die Anzeigel\195\164nge der Zone" + L['Mapcoords Screen'] = "Kartenkoordinaten Vollbild" + L['Mapcoords Window'] = "Kartenkoordinaten Fenster" + L['Screen X'] = "Vollbild X" + L['Adjusts the X-Offset on fullscreenmap'] = "Positioniert die X-Kartenkoordinate im Vollbild" + L['Screen Y'] = "Vollbild Y" + L['Adjusts the Y-Offset on fullscreenmap'] = "Positioniert die Y-Kartenkoordinate im Vollbild" + L['Window X'] = "Fenster X" + L['Adjusts the X-Offset on windowed map'] = "Positioniert die Y-Kartenkoordinate im Fenstermodus" + L['Window Y'] = "Fenster Y" + L['Adjusts the Y-Offset on windowed map'] = "Positioniert die Y-Kartenkoordinate im Fenstermodus" + L['Hide LDB coords'] = "Verstecke LDB-Koordinaten" + L['This hides the coords-display in your broker display'] = "Zeigt die Koordinaten im Display-Broker nicht an" + L['Colorized Zone'] = "Farbige Zone" + L['Show PvP informations about current area'] = "Zeigt PvP Informationen zur Zone farblich an" +end + +-- ö \195\182 ß \195\159 +-- ü \195\188 ä \195\164 +-- Ä \195\132 +-- ö \195\182 +-- Ü \195\156 \ No newline at end of file diff --git a/locale_enUS.lua b/locale_enUS.lua new file mode 100644 index 0000000..fb74f45 --- /dev/null +++ b/locale_enUS.lua @@ -0,0 +1,37 @@ +local addonname, addon = ... +local name = "zz_Coords" +local L = LibStub("AceLocale-3.0"):NewLocale(name, "enUS", true) +if L then + L[name] = name + L[name..' Settings'] = format("%s Settings",name) + L['Hide Map coords'] = true + L['Show MapID'] = "Show MapID on worldmap" + L['This hides the coords-display at the bottom of your map'] = true + L['outbound'] = "Cursor: - -- Player: " + L['Player'] = true + L['Cursor'] = true + L['COORDFMTSTRING'] = function(self,x,y) return format("Cursor: %.1f, %.1f -- Player: ",addon:round(x,1),addon:round(y,1)) end + L['HINT'] = "|c0000ff00Leftclick|r |c00ffffffto open the world map|r" + L['HINT2'] = "|c0000ff00Rightclick|r |c00ffffffto open preferences|r" + L['HINT3'] = "|c0000ff00Shift-Leftclick|r |c00fffffftoggles minimap icon|r" + L['HINT4'] = "|c0000ff00Shift-Rightclick|r |c00fffffftoggles minimap|r" + L['Show Zone'] = true + L['Show Subzone'] = true + L["Toggle Minimap"] = true + L['Max Length'] = true + L['Limits the maximum length of the zone'] = true + L['Mapcoords Screen'] = true + L['Mapcoords Window'] = true + L['Screen X'] = true + L['Adjusts the X-Offset on fullscreenmap'] = true + L['Screen Y'] = true + L['Adjusts the Y-Offset on fullscreenmap'] = true + L['Window X'] = true + L['Adjusts the X-Offset on windowed map'] = true + L['Window Y'] = true + L['Adjusts the Y-Offset on windowed map'] = true + L['Hide LDB coords'] = true + L['This hides the coords-display in your broker display'] = true + L['Colorized Zone'] = true + L['Show PvP informations about current area'] = true +end \ No newline at end of file diff --git a/pack.xml b/pack.xml new file mode 100644 index 0000000..3960488 --- /dev/null +++ b/pack.xml @@ -0,0 +1,6 @@ + +