diff --git a/GroupLeader.lua b/GroupLeader.lua
index df98167..8fba184 100755
--- a/GroupLeader.lua
+++ b/GroupLeader.lua
@@ -72,9 +72,9 @@ local function MapCallback(pinManager)
for k, v in pairs(trackers) do
if v.tag and v.name and v.symbol and v.color and not (v.X == 0 and v.Y == 0) then
if k == 'leader' and db.leaderEnabled and v.name ~= playerName then
- pinManager:CreatePin(_G[mapPinType .. v.symbol .. v.color], v.name, v.X, v.Y)
+ pinManager:CreatePin(_G[mapPinType .. v.name], v.name, v.X, v.Y)
else
- pinManager:CreatePin(_G[mapPinType .. v.symbol .. v.color], v.name, v.X, v.Y)
+ pinManager:CreatePin(_G[mapPinType .. v.name], v.name, v.X, v.Y)
end
end
end
@@ -90,9 +90,9 @@ local function CompassPinCallback(pinManager)
for k, v in pairs(trackers) do
if v.tag and v.name and v.symbol and v.color and not (v.X == 0 and v.Y == 0) then
if k == 'leader' and db.leaderEnabled and v.name ~= playerName then
- pinManager:CreatePin(compassPinType .. v.symbol .. v.color, v.name, v.X, v.Y)
+ pinManager:CreatePin(compassPinType .. v.name, v.name, v.X, v.Y)
else
- pinManager:CreatePin(compassPinType .. v.symbol .. v.color, v.name, v.X, v.Y)
+ pinManager:CreatePin(compassPinType .. v.name, v.name, v.X, v.Y)
end
end
end
@@ -106,7 +106,7 @@ end
local function AddMapPin(pinType, pinTypeAddCallback, pinTypeOnResizeCallback, pinLayoutData, pinTooltipCreator)
ZO_WorldMap_AddCustomPin(pinType, pinTypeAddCallback, pinTypeOnResizeCallback, pinLayoutData, pinTooltipCreator)
ZO_WorldMap_SetCustomPinEnabled(_G[pinType], true)
- --RefreshMapPins(pinType)
+ RefreshMapPins(pinType)
end
-- Slash command handlers
@@ -196,6 +196,17 @@ local function CommandHandler(text)
return
end
end
+ local mapPinLayout = {
+ level = 200,
+ texture = textures[symbol] .. colors[color],
+ size = 40,
+ }
+ local compassPinLayout = {
+ maxDistance = db.compassMaxDistance,
+ texture = textures[symbol] .. colors[color],
+ }
+ AddMapPin(mapPinType .. name, MapCallback, nil, mapPinLayout, pinTooltipCreator)
+ COMPASS_PINS:AddCustomPin(compassPinType .. name, CompassPinCallback, compassPinLayout)
table.insert(trackers, {tag=unitTag, name=name, symbol=symbol, color=color, X=0, Y=0})
ChatMessage("Now tracking " .. name)
else
@@ -218,6 +229,7 @@ local function CommandHandler(text)
deleted = true
end
end
+ -- TODO: delete the map/compass pins if possible (and other places where tracking removed)
if deleted then
ChatMessage("Deleted " .. name .. " from tracking list")
else
@@ -274,21 +286,9 @@ end
-- Refresh the compass and map with the chosen texture
local function RefreshAllPins()
- RefreshMapPins(mapPinType .. 'StarWhite')
- RefreshMapPins(mapPinType .. 'StarBlack')
- RefreshMapPins(mapPinType .. 'StarRed')
- RefreshMapPins(mapPinType .. 'StarGreen')
- RefreshMapPins(mapPinType .. 'StarBlue')
- RefreshMapPins(mapPinType .. 'PlusWhite')
- RefreshMapPins(mapPinType .. 'PlusBlack')
- RefreshMapPins(mapPinType .. 'PlusRed')
- RefreshMapPins(mapPinType .. 'PlusGreen')
- RefreshMapPins(mapPinType .. 'PlusBlue')
- RefreshMapPins(mapPinType .. 'CircleWhite')
- RefreshMapPins(mapPinType .. 'CircleBlack')
- RefreshMapPins(mapPinType .. 'CircleRed')
- RefreshMapPins(mapPinType .. 'CircleGreen')
- RefreshMapPins(mapPinType .. 'CircleBlue')
+ for k, v in pairs(trackers) do
+ RefreshMapPins(mapPinType .. v.name)
+ end
COMPASS_PINS:RefreshPins()
end
@@ -384,189 +384,18 @@ local function AddonSetup(eventCode, addOnName)
trackers['leader'].symbol = db.leaderSymbol
trackers['leader'].color = db.leaderColor
- local mapPinLayout = nil
- local compassPinLayout = nil
-
- mapPinLayout = {
- level = 200,
- texture = textures['Star'] .. colors['White'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Star'] .. colors['White'],
- }
- AddMapPin(mapPinType .. 'StarWhite', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'StarWhite', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Star'] .. colors['Black'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Star'] .. colors['Black'],
- }
- AddMapPin(mapPinType .. 'StarBlack', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'StarBlack', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Star'] .. colors['Red'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Star'] .. colors['Red'],
- }
- AddMapPin(mapPinType .. 'StarRed', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'StarRed', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
+ local mapPinLayout = {
level = 200,
- texture = textures['Star'] .. colors['Green'],
+ texture = textures[db.leaderSymbol] .. colors[db.leaderColor],
size = 40,
}
- compassPinLayout = {
+ local compassPinLayout = {
maxDistance = db.compassMaxDistance,
- texture = textures['Star'] .. colors['Green'],
+ texture = textures[db.leaderSymbol] .. colors[db.leaderColor],
}
- AddMapPin(mapPinType .. 'StarGreen', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'StarGreen', CompassPinCallback, compassPinLayout)
+ AddMapPin(mapPinType .. 'leader', MapCallback, nil, mapPinLayout, pinTooltipCreator)
+ COMPASS_PINS:AddCustomPin(compassPinType .. 'leader', CompassPinCallback, compassPinLayout)
- mapPinLayout = {
- level = 200,
- texture = textures['Star'] .. colors['Blue'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Star'] .. colors['Blue'],
- }
- AddMapPin(mapPinType .. 'StarBlue', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'StarBlue', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Plus'] .. colors['White'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Plus'] .. colors['White'],
- }
- AddMapPin(mapPinType .. 'PlusWhite', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'PlusWhite', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Plus'] .. colors['Black'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Plus'] .. colors['Black'],
- }
- AddMapPin(mapPinType .. 'PlusBlack', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'PlusBlack', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Plus'] .. colors['Red'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Plus'] .. colors['Red'],
- }
- AddMapPin(mapPinType .. 'PlusRed', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'PlusRed', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Plus'] .. colors['Green'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Plus'] .. colors['Green'],
- }
- AddMapPin(mapPinType .. 'PlusGreen', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'PlusGreen', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Plus'] .. colors['Blue'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Plus'] .. colors['Blue'],
- }
- AddMapPin(mapPinType .. 'PlusBlue', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'PlusBlue', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Circle'] .. colors['White'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Circle'] .. colors['White'],
- }
- AddMapPin(mapPinType .. 'CircleWhite', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'CircleWhite', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Circle'] .. colors['Black'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Circle'] .. colors['Black'],
- }
- AddMapPin(mapPinType .. 'CircleBlack', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'CircleBlack', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Circle'] .. colors['Red'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Circle'] .. colors['Red'],
- }
- AddMapPin(mapPinType .. 'CircleRed', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'CircleRed', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Circle'] .. colors['Green'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Circle'] .. colors['Green'],
- }
- AddMapPin(mapPinType .. 'CircleGreen', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'CircleGreen', CompassPinCallback, compassPinLayout)
-
- mapPinLayout = {
- level = 200,
- texture = textures['Circle'] .. colors['Blue'],
- size = 40,
- }
- compassPinLayout = {
- maxDistance = db.compassMaxDistance,
- texture = textures['Circle'] .. colors['Blue'],
- }
- AddMapPin(mapPinType .. 'CircleBlue', MapCallback, nil, mapPinLayout, pinTooltipCreator)
- COMPASS_PINS:AddCustomPin(compassPinType .. 'CircleBlue', CompassPinCallback, compassPinLayout)
-
SLASH_COMMANDS["/groupleader"] = CommandHandler
SLASH_COMMANDS["/gl"] = CommandHandler