Question: Is there any other library/addon besides LibGuildPosition-1.0 which does this?
LibGuildPosition-1.0 fires a callback of the following form:
-- somehere in addon:OnEnable LibGuildPositions.RegisterCallback(self, 'Position', function(...) self:OnGuildPositionChange(...) end) function addon:OnGuildPositionChange(event, unitName, zoneX, zoneY, zone) -- do stuff end
Where event will be the string "Position", unitName will be the name of a guild member, zoneX and zoneY range from 0 to 1 and zone will be the map texture name of a zone, for example "StormwindCity" as returned by GetMapInfo.
Question: Is there an easy way to translate the texturename to a areaID (as returned by GetCurrentMapAreaID
The only approach, besides hard coding, that comes to mind is to iterate over every map with SetMapByID and compare the result of GetMapInfo.
-- [...] function addon:OnEnable() -- [...] LibGuildPositions.RegisterCallback(self, 'Position', function(...) self:Debug("Position") self:OnGuildPositionChange(...) end) -- [...] self:Debug("LibGuildPositions-1.0 callbacks registered.") end -- [...] function addon:OnGuildPositionChange(event, unitName, zoneX, zoneY, zone) self:Debug(("OnGuildPositionChange(unitName=%s, zoneX=%f, zoneY=%f, zone=%s)"):format(unitName, zoneX, zoneY, tostring(zone))) error("why is this never executed?") -- [...] end
I can see that registration was done ("LibGuildPositions-1.0 callbacks registered." appears in chat).
Question: Why is neither "Position" nor the other debug mesage ever printed. And why does the error never occur?
I can not totally exclude the possibility that my guild members are doing something wrong. However, at least two have the library stand alone installed.
Edit: After additional testing it seems that LibGuildPositions-1.0 does not work standalone. Or my guild mates failed to install it stand alone. Embedded in my addon it works.