Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FyrMM = {}
- FyrMM.Panel = {}
- FyrMM.Options = {}
- FyrMM.noMap = false
- FyrMM.Visible = true
- FyrMM.AutoHidden = false
- FyrMM.FpsTest = false
- FyrMM.Fps = 0
- FyrMM.FpsRaw = 0
- FyrMM.Initialized = false
- FyrMM.pScale = 75
- FyrMM.pScalePercent = 0.75
- FyrMM.questPinCount = 0
- FyrMM.currentLocationsCount = 0
- FyrMM.currentPOICount = 0
- FyrMM.currentForwardCamps = 0
- FyrMM.currentWayshrineCount = 0
- FyrMM.AfterCombatUnhidePending = false
- FyrMM.AfterCombatUnhideTimeStamp = 0
- FyrMM.LastQuestPinRequest = 0
- FyrMM.MovementSpeed = 0
- FyrMM.MovementSpeedPrevious = 0
- FyrMM.MovementSpeedMax = 0
- FyrMM.UseOriginalFunctions = true
- FyrMM.MeasureMaps = true
- FyrMM.DistanceMeasurementStarted = false
- FyrMM.InitialPreloadTimeStamp = nil
- FyrMM.currentMap = {}
- FyrMM.currentMap.MapId = 0
- FyrMM.currentMap.PlayerNX = 0
- FyrMM.currentMap.PlayerNY = 0
- FyrMM.currentMap.mapBuilt = false
- FyrMM.currentMap.PlayerMounted = false
- FyrMM.currentMap.PlayerSwimming = false
- FyrMM.currentMap.movedTimeStamp = 0
- FyrMM.currentMap.ZoneIndex = 0
- FyrMM.currentMap.MapContent = GetMapContentType()
- FyrMM.CheckingZone = false
- FyrMM.CustomPinList = {}
- FyrMM.CustomPinCheckList = {}
- FyrMM.LoadingCustomPins = {}
- FyrMM.UpdatingCustomPins = {}
- FyrMM.CustomPinsEnabled = true
- FyrMM.CustomWaypointsList = {}
- FyrMM.IsGroup = false
- FyrMM.IsWaypoint = false
- FyrMM.Waypoint = nil
- FyrMM.IsRally = false
- FyrMM.Rally = nil
- FyrMM.IsPing = false
- FyrMM.Ping = nil
- FyrMM.OverMiniMap = false
- FyrMM.OverMenu = false
- FyrMM.MenuFadingIn = false
- FyrMM.MenuFadingOut = false
- FyrMM.DisableSubzones = false
- FyrMM.Halted = false
- FyrMM.HaltTimeOffset = 0
- FyrMM.LastReload = 0
- FyrMM.DebugMode = false
- FyrMM.MapAPI0Present = false
- FyrMM.FadingEdges = false
- FyrMM.KeepRefreshNeeded = true
- FyrMM.GroupRefreshNeeded = true
- FyrMM.CustomPinCount = 0
- FyrMM.AvailableQuestGivers = {}
- FYRMM_ZOOM_MAX = 50
- FYRMM_ZOOM_MIN = 1
- FYRMM_DEFAULT_ZOOM_LEVEL = 10
- FYRMM_ZOOM_INCREMENT_AMOUNT = nil
- FYRMM_QUEST_PIN_REQUEST_TIMEOUT = 10000 -- Time in miliseconds to wait for quest pin data
- FYRMM_QUEST_PIN_REQUEST_MINIMUM_DELAY = 1000 -- Time in miliseconds to be passed before requesting quest pins again
- MM_GetNumMapLocations = GetNumMapLocations -- Location pin count
- MM_IsMapLocationVisible = IsMapLocationVisible -- is Location visible
- MM_GetMapLocationIcon = GetMapLocationIcon -- Location pin texture
- MM_GetNumPOIs = GetNumPOIs -- POI pin count
- MM_GetPOIMapInfo = GetPOIMapInfo -- POI pin info
- FyrMM.QuestPins = {}
- FyrMM.RequestedQuestPins = {}
- FyrMM.currentDigSiteCount = 0
- FyrMM.TimeFormat = 0
- FyrMM.pinZoomScale = 1
- local QuestPins = FyrMM.QuestPins
- local RequestedQuestPins = FyrMM.RequestedQuestPins
- local FreeQuestPinIndex = {}
- local CurrentTasks = {}
- local NeedQuestPinUpdate = true
- local QuestPinsUpdating = false
- local QuestTasksPending = false
- local CustomPinsCopying = false
- local PinRef = nil
- local PRCustomPins = nil
- local PRMap = nil -- data is put into this variable but never used.
- local LastQuestPinIndex = 0
- local CurrentMap = FyrMM.currentMap
- local CurrentMapId = 0
- local CurrentTasks = CurrentTasks
- local CWSTimeStamp = 0 -- never used
- local AQGTimeStamp = 0 -- never used
- local CleanPOIs = 0
- local CustomPinIndex = {}
- local CustomPinKeyIndex = {}
- local FreeCustomPinIndex = {}
- local LastCustomPinIndex = 0
- local CustomPinMapId = 0
- local PinsList = {}
- local PinsIndex = {} -- never used
- local Wayshrines = {}
- local WayshrineDistancesTimeStamp = 0
- local KeepIndex = {}
- local PositionLog3D = {}
- local PositionLogCounter = 0
- local Treasures = {}
- local DragonNextLocation = {}
- local Digsites = {}
- local AQGList = {}
- local AQGListFull = {}
- local wuthreads = 0 -- never used
- local ruthreads = 0 -- never used
- local MenuAnimation
- local wrc = 0 -- never used
- local mapContentType = 0 -- never used
- local ZOpinData = ZO_MapPin.PIN_DATA
- local pi = math.pi
- local detectedNewCustomPin = false
- local CustomPinCrossReference = {}
- local IsCompanionAround = false
- local ASSISTED_PIN_TYPES = ZO_MapPin.ASSISTED_PIN_TYPES
- local QUEST_PIN_TYPES = ZO_MapPin.QUEST_PIN_TYPES
- local questPinTextures = {
- [MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION] = "EsoUI/Art/Compass/quest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/quest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ENDING] = "EsoUI/Art/Compass/quest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_REPEATABLE_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_REPEATABLE_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_REPEATABLE_ENDING] = "EsoUI/Art/Compass/repeatableQuest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ZONE_STORY_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ZONE_STORY_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ZONE_STORY_ENDING] = "EsoUI/Art/Compass/zoneStoryQuest_icon_assisted.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_CONDITION] = "EsoUI/Art/Compass/quest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/quest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ENDING] = "EsoUI/Art/Compass/quest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_REPEATABLE_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_REPEATABLE_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_REPEATABLE_ENDING] = "EsoUI/Art/Compass/repeatableQuest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ZONE_STORY_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ZONE_STORY_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ZONE_STORY_ENDING] = "EsoUI/Art/Compass/zoneStoryQuest_icon.dds",
- [MAP_PIN_TYPE_QUEST_CONDITION] = "EsoUI/Art/Compass/quest_icon.dds",
- [MAP_PIN_TYPE_QUEST_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/quest_icon.dds",
- [MAP_PIN_TYPE_QUEST_ENDING] = "EsoUI/Art/Compass/quest_icon.dds",
- [MAP_PIN_TYPE_QUEST_REPEATABLE_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon.dds",
- [MAP_PIN_TYPE_QUEST_REPEATABLE_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon.dds",
- [MAP_PIN_TYPE_QUEST_REPEATABLE_ENDING] = "EsoUI/Art/Compass/repeatableQuest_icon.dds",
- [MAP_PIN_TYPE_QUEST_ZONE_STORY_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon.dds",
- [MAP_PIN_TYPE_QUEST_ZONE_STORY_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon.dds",
- [MAP_PIN_TYPE_QUEST_ZONE_STORY_ENDING] = "EsoUI/Art/Compass/zoneStoryQuest_icon.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_OFFER_ZONE_STORY] = "EsoUI/Art/Compass/zoneStoryQuest_available_icon.dds"
- }
- local breadcrumbQuestPinTextures = {
- [MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION] = "EsoUI/Art/Compass/quest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/quest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ENDING] = "EsoUI/Art/Compass/quest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_REPEATABLE_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_REPEATABLE_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_REPEATABLE_ENDING] = "EsoUI/Art/Compass/repeatableQuest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ZONE_STORY_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ZONE_STORY_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_ASSISTED_QUEST_ZONE_STORY_ENDING] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door_assisted.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_CONDITION] = "EsoUI/Art/Compass/quest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/quest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ENDING] = "EsoUI/Art/Compass/quest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_REPEATABLE_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_REPEATABLE_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_REPEATABLE_ENDING] = "EsoUI/Art/Compass/repeatableQuest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ZONE_STORY_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ZONE_STORY_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_ZONE_STORY_ENDING] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_CONDITION] = "EsoUI/Art/Compass/quest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/quest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_ENDING] = "EsoUI/Art/Compass/quest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_REPEATABLE_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_REPEATABLE_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/repeatableQuest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_REPEATABLE_ENDING] = "EsoUI/Art/Compass/repeatableQuest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_ZONE_STORY_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_ZONE_STORY_OPTIONAL_CONDITION] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door.dds",
- [MAP_PIN_TYPE_QUEST_ZONE_STORY_ENDING] = "EsoUI/Art/Compass/zoneStoryQuest_icon_door.dds",
- [MAP_PIN_TYPE_TRACKED_QUEST_OFFER_ZONE_STORY] = "EsoUI/Art/Compass/zoneStoryQuest_available_icon_door.dds"
- }
- local ZONE_EXPLORATION_PIN_TYPES = ZO_MapPin.SUGGESTION_PIN_TYPES -- showsPinAndArea = true is forward camps and SUGGESTION_PIN_TYPES
- local OBJECTIVE_PIN_TYPES = ZO_MapPin.OBJECTIVE_PIN_TYPES
- local CustomWaypoints = ZO_MapPin.MAP_PING_PIN_TYPES
- ----------------------------------------------------------------
- local function GetQuestPinCount()
- return FyrMM.questPinCount
- end
- local function AvailableCustomPins()
- local count = 0
- for _, b in pairs(FyrMM.CustomPinList) do
- count = count + #b
- end
- return count
- end
- local function IsCustomPinsLoading()
- for _, b in pairs(FyrMM.LoadingCustomPins) do
- if b then
- return b
- end
- end
- return false
- end
- local function GetQuestFreePinIndex()
- local index = LastQuestPinIndex
- if not IsTableEmpty(FreeQuestPinIndex) then
- index = table.remove(FreeQuestPinIndex)
- return index
- end
- index = index + 1
- LastQuestPinIndex = index
- return index
- end
- FyrMM.RequestJournalQuestConditionAssistance = RequestJournalQuestConditionAssistance
- function RequestJournalQuestConditionAssistance(questIndex, stepIndex, conditionIndex, assisted)
- local taskId = FyrMM.RequestJournalQuestConditionAssistance(questIndex, stepIndex, conditionIndex, assisted)
- local tag = ZO_MapPin.CreateQuestPinTag(questIndex, stepIndex, conditionIndex)
- local currentTime = GetGameTimeMilliseconds()
- if currentTime - FyrMM.LastQuestPinRequest > FYRMM_QUEST_PIN_REQUEST_MINIMUM_DELAY then
- FyrMM.questPinCount = GetQuestPinCount()
- QuestPinsUpdating = true
- end
- if taskId and not FyrMM.Halted then
- FyrMM.LastQuestPinRequest = currentTime
- local currentTask = {}
- currentTask = tag
- currentTask.RequestTimeStamp = FyrMM.LastQuestPinRequest
- currentTask.MapId = CurrentMap.MapId
- currentTask.Fetched = true
- currentTask.ZO_MapVisible = ZO_WorldMap:IsHidden()
- CurrentTasks[taskId] = currentTask
- end
- return taskId
- end
- FyrMM.CancelRequestJournalQuestConditionAssistance = CancelRequestJournalQuestConditionAssistance
- function CancelRequestJournalQuestConditionAssistance(taskId)
- if taskId and CurrentTasks[taskId] and CurrentTasks[taskId].Fetched then
- CurrentTasks[taskId] = nil
- FyrMM.CancelRequestJournalQuestConditionAssistance(taskId)
- end
- end
- -----------------------------------------------------------------
- -- Utility functions
- -----------------------------------------------------------------
- function IsTableEmpty(tbl)
- return next(tbl) == nil
- end
- local function CancelUpdates()
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapDelayedRegister")
- -- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapZoneCheck")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapPOIPins")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapLocationsPins")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapWayshrinesPins")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapCustomPins")
- -- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapPOIPinsD")
- -- EVENT_MANAGER:UnregisterForUpdate("OnFyrMiniMapInitialPreload")
- EVENT_MANAGER:UnregisterForUpdate("OnFyrMiniMapCustomPinGroupAll")
- FyrMM.UpdatingCustomPins = {}
- FyrMM.LoadingCustomPins = {}
- if PinRef then
- for i, n in pairs(PRCustomPins) do
- if i > MAP_PIN_TYPE_INVALID then
- EVENT_MANAGER:UnregisterForUpdate("OnFyrMiniMapCustomPinGroup" .. tostring(i))
- end
- end
- end
- end
- local function IsCurrentLocation(pin)
- if not pin then
- return
- end
- local x, y = CurrentMap.PlayerNX, CurrentMap.PlayerNY -- GetMapPlayerPosition("player")
- local nX = pin.nX or pin.normalizedX
- local nY = pin.nY or pin.normalizedY
- if not (nX and nY and CurrentMap.TrueMapSize) then
- return false
- end
- local distance = zo_round(CurrentMap.TrueMapSize * math.sqrt(((x - nX) ^ 2) + ((y - nY) ^ 2)) * 7.55) / 10 -- assumed size is 1.325 times larger than approximate effective skill distance in meters.
- local message = GetString(SI_MM_STRING_DISTANCE) .. " " .. tostring(distance) .. " m"
- if not InformationTooltip:IsHidden() then
- InformationTooltip:AddLine(message, "", ZO_HIGHLIGHT_TEXT:UnpackRGB())
- end
- if not ZO_MapLocationTooltip:IsHidden() then
- ZO_MapLocationTooltip:AddLine(message, "", ZO_HIGHLIGHT_TEXT:UnpackRGB())
- end
- return CurrentMap.TrueMapSize * math.sqrt((x - nX) ^ 2 + (y - nY) ^ 2) < 14 -- Approximate distance to use a wayshrine
- end
- local function IsCraftingService(pin)
- if not pin then
- return false
- end
- local tooltipIndex = pin.locationIndex
- if not tooltipIndex then
- return false
- end
- for _, v in pairs(FyrMM.CSProviders) do
- if v then
- for j = 1, GetNumMapLocationTooltipLines(tooltipIndex) do
- local _, tooltipLineText = GetMapLocationTooltipLineInfo(tooltipIndex, j)
- if tooltipLineText:find(v) then
- return true
- end
- end
- end
- end
- return false
- end
- local function SetTooltipMessage(pin)
- if not pin then
- return
- end
- if pin:IsFastTravelWayShrine() then
- local nodeIndex = pin:GetFastTravelNodeIndex()
- local known, name = GetFastTravelNodeInfo(nodeIndex)
- if not known then
- name = name .. " (undiscovered)"
- end
- InformationTooltip:AddLine(zo_strformat(SI_WORLD_MAP_LOCATION_NAME, name), "",
- ZO_TOOLTIP_DEFAULT_COLOR:UnpackRGB()) -- Wayshrine name
- if IsCurrentLocation(pin) then
- InformationTooltip:AddLine(GetString(SI_TOOLTIP_WAYSHRINE_CURRENT_LOC), "", ZO_HIGHLIGHT_TEXT:UnpackRGB()) -- Player is near wayshrine
- else
- if IsInAvAZone() then
- InformationTooltip:AddLine(GetString(SI_TOOLTIP_WAYSHRINE_CANT_RECALL_AVA), "",
- ZO_ERROR_COLOR:UnpackRGB()) -- Can't travel to a wayshrine in Cyrodiil
- else
- local _, premiumTimeLeft = GetRecallCooldown()
- if premiumTimeLeft == 0 then
- InformationTooltip:AddLine(GetString(SI_TOOLTIP_WAYSHRINE_CLICK_TO_RECALL), "",
- ZO_HIGHLIGHT_TEXT:UnpackRGB()) -- Recall text line
- local cost = GetRecallCost()
- if cost > 0 then
- if cost <= GetCurrentMoney() then
- ZO_ItemTooltip_AddMoney(InformationTooltip, cost, SI_TOOLTIP_RECALL_COST,
- CURRENCY_HAS_ENOUGH)
- else
- ZO_ItemTooltip_AddMoney(InformationTooltip, cost, SI_TOOLTIP_RECALL_COST,
- CURRENCY_NOT_ENOUGH)
- end
- end
- else
- local cooldownText = zo_strformat(SI_TOOLTIP_WAYSHRINE_RECALL_COOLDOWN, ZO_FormatTimeMilliseconds(
- premiumTimeLeft, TIME_FORMAT_STYLE_DESCRIPTIVE, TIME_FORMAT_PRECISION_SECONDS))
- InformationTooltip:AddLine(cooldownText, "", ZO_HIGHLIGHT_TEXT:UnpackRGB())
- end
- end
- end
- else
- local poiIndex = pin:GetPOIIndex()
- local zoneIndex = pin:GetPOIZoneIndex()
- local poiName, _, poiStartDesc, poiFinishedDesc = GetPOIInfo(zoneIndex, poiIndex)
- InformationTooltip:AddLine(zo_strformat(SI_WORLD_MAP_LOCATION_NAME, poiName), "",
- ZO_TOOLTIP_DEFAULT_COLOR:UnpackRGB())
- local pinType = select(3, MM_GetPOIMapInfo(zoneIndex, poiIndex))
- if not (ZO_MapPin.POI_PIN_TYPES[pinType]) then
- InformationTooltip:AddLine("(undiscovered)", "", ZO_HIGHLIGHT_TEXT:UnpackRGB())
- end
- if pinType == MAP_PIN_TYPE_POI_COMPLETE then
- if poiFinishedDesc ~= "" then
- InformationTooltip:AddLine(poiFinishedDesc, "", ZO_HIGHLIGHT_TEXT:UnpackRGB())
- end
- else
- if poiStartDesc ~= "" then
- InformationTooltip:AddLine(poiStartDesc, "", ZO_HIGHLIGHT_TEXT:UnpackRGB())
- end
- end
- end
- end
- function GetCurrentMapTextureFileInfo()
- local tileTexture = (GetMapTileTexture()):lower()
- if tileTexture == nil or tileTexture == "" then
- return "tamriel_0", "tamriel_", "art/maps/tamriel/"
- end
- local pos = select(2, tileTexture:find("maps/([%w%-]+)/"))
- if pos == nil then
- return "tamriel_0", "tamriel_", "art/maps/tamriel/"
- end
- pos = pos + 1
- return string.gsub(string.sub(tileTexture, pos), ".dds", ""),
- string.gsub(string.sub(tileTexture, pos), "0.dds", ""), tileTexture:sub(1, pos - 1)
- end
- local function GetTrueMapSize() -- never used
- local currentMapId = CurrentMap.MapId
- local size = FyrMM.MapSizes[currentMapId] or 1
- return currentMapId, size
- end
- function FyrMM.GetMapTextureFileInfo(mapId)
- local tileTexture = GetMapTileTextureForMapId(mapId, 1)
- if tileTexture == nil or tileTexture == "" then
- return "tamriel_0", "tamriel_", "art/maps/tamriel/"
- end
- local _, pos = tileTexture:find("maps/([%w%-]+)/")
- if not pos then
- return "tamriel_0", "tamriel_", "art/maps/tamriel/"
- end
- return string.gsub(string.sub(tileTexture, pos + 1), ".dds", "")
- end
- function FyrMM.GetMapId()
- return GetCurrentMapId()
- end
- local function SetMapToZone()
- if FyrMM.DisableSubzones == true and GetMapType() == 1 and not IsUnitInDungeon("player") and not IsPlayerInRaid() and
- not IsActiveWorldBattleground() and not IsInAvAZone() then
- MapZoomOut()
- FyrMM.UpdateLabels()
- end
- end
- function FyrMM.MapHalfDiagonal()
- FyrMM.DiagonalND = math.sqrt((Fyr_MM_Player:GetRight() - Fyr_MM:GetRight()) ^ 2 +
- (Fyr_MM_Player:GetTop() - Fyr_MM:GetTop()) ^ 2)
- return FyrMM.DiagonalND
- end
- local function IsSubmap() -- never used
- return CurrentMap.MapContent == MAP_CONTENT_DUNGEON or GetMapType() == MAPTYPE_SUBZONE
- end
- local function GetQuestJournalMaxValidIndex()
- local index = 0
- for i = 1, MAX_JOURNAL_QUESTS do
- if (IsValidQuestIndex(i)) and index < i then
- index = i
- end
- end
- return index
- end
- local function IsAssisted(pinType)
- return ASSISTED_PIN_TYPES[pinType] ~= nil -- non-existent key = nil
- end
- local function IsQuestType(pinType) -- never used
- return QUEST_PIN_TYPES[pinType] ~= nil -- non-existent key = nil
- end
- local function valueExists(i, x)
- for j = 1, #x do -- instead of ipairs to avoid overhead
- if x[j] == i then
- return true
- end
- end
- return false
- end
- local function questpinDataExists(pinData, array)
- -- Avoid continuous table lookups localize the values instead
- local questIndex, questName, conditionText, conditionIndex, normX, normY, radius, stepIndex = pinData.questIndex,
- pinData.questName, pinData.conditionText, pinData.conditionIndex, pinData.normalizedX, pinData.normalizedY,
- pinData.radius, pinData.stepIndex
- for i, v in pairs(array) do
- if v.questIndex == questIndex and v.questName == questName and v.conditionText == conditionText and
- v.conditionIndex == conditionIndex and v.normalizedX == normX and v.normalizedY == normY and v.radius ==
- radius and v.stepIndex == stepIndex then
- return i
- end
- end
- return nil
- end
- function FyrMM.SetTargetScale(pin, targetScale)
- if not pin or not targetScale or not ((pin.targetScale and targetScale ~= pin.targetScale) or
- (pin.targetScale == nil and targetScale ~= pin:GetScale())) then
- return
- end
- local primaryPin, secondaryPin, tertiaryPin = pin.primaryPin, pin.secondaryPin, pin.tertiaryPin
- local newScale
- pin.targetScale = targetScale
- for i = 1, 50 do
- zo_callLater(function()
- newScale = zo_deltaNormalizedLerp(pin:GetScale(), targetScale, 0.1)
- if (zo_abs(newScale - targetScale) < 0.01) then
- pin:SetScale(targetScale)
- if primaryPin then
- pin.primaryPin:SetScale(targetScale)
- end
- if secondaryPin then
- pin.secondaryPin:SetScale(targetScale)
- end
- if tertiaryPin then
- pin.tertiaryPin:SetScale(targetScale)
- end
- pin.targetScale = nil
- return
- end
- pin:SetScale(newScale)
- if primaryPin then
- pin.primaryPin:SetScale(newScale)
- end
- if secondaryPin then
- pin.secondaryPin:SetScale(newScale)
- end
- if tertiaryPin then
- pin.tertiaryPin:SetScale(newScale)
- end
- end, i * 5)
- end
- end
- local function AfterCombatShow()
- if not FyrMM.AfterCombatUnhidePending then
- return
- end
- if GetFrameTimeMilliseconds() - FyrMM.AfterCombatUnhideTimeStamp < 1000 * (FyrMM.SV.AfterCombatUnhideDelay - 1) then
- return
- end
- FyrMM.AfterCombatUnhidePending = false
- if not IsUnitActivelyEngaged("player") then
- FyrMM.AutoHidden = false
- FyrMM.Visible = true
- end
- end
- local function WayshrineDistances(nDistance)
- if not (FyrMM.SV.BorderPins and FyrMM.SV.BorderWayshrine) or FyrMM.currentWayshrineCount == 0 then
- return
- end
- if CurrentMap.movedTimeStamp == WayshrineDistancesTimeStamp and WayshrineDistancesTimeStamp ~= 0 then
- return
- end
- WayshrineDistancesTimeStamp = CurrentMap.movedTimeStamp
- local gameTime = GetGameTimeMilliseconds()
- local wDi, wDmi, minWD, owDmi = 1, 1, 1, 1
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "WayshrineDistances Start:" .. tostring(FyrMM.currentWayshrineCount))
- end
- if FyrMM.currentWayshrineCount == 1 then
- Wayshrines[1].Closest = Wayshrines[1].isRealWayshrine
- return
- end
- EVENT_MANAGER:RegisterForUpdate("OnFyrMiniMapDistances", 100, -- 150 ~8s 50 ~6s -- 100 ~ loads about the same as 50 on initial load.
- function()
- local playerX, playerY = CurrentMap.PlayerNX, CurrentMap.PlayerNY
- if Wayshrines[wDi] and Wayshrines[wDi].isRealWayshrine then
- Wayshrines[wDi].nDistance =
- math.sqrt((playerX - Wayshrines[wDi].nX) ^ 2 + (playerY - Wayshrines[wDi].nY) ^ 2)
- if Wayshrines[wDi].nDistance < minWD then
- minWD = Wayshrines[wDi].nDistance
- wDmi = wDi
- end
- end
- if wDi <= FyrMM.currentWayshrineCount then
- wDi = wDi + 1
- return
- end
- for i, _ in pairs(Wayshrines) do
- Wayshrines[i].Closest = (i == wDmi)
- Wayshrines[i].pin.Closest = (i == wDmi)
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "WayshrineDistances Done. (" .. tostring(wDmi) .. ") " ..
- tostring(GetGameTimeMilliseconds() - gameTime))
- end
- EVENT_MANAGER:UnregisterForUpdate("OnFyrMiniMapDistances")
- end)
- end
- local function sort(a, b)
- local typeA, typeB = type(a.index), type(b.index) -- avoid repeated calls to the type function
- if typeA == "number" and typeB == "number" then
- return a.index < b.index
- end
- if typeA == "number" and typeB ~= "number" then
- return true
- end
- if typeA ~= "number" and typeB == "number" then
- return false
- end
- return a.index and b.index and tostring(a.index) < tostring(b.index)
- end
- local function FirstKey(Table, offset) -- never used
- if IsTableEmpty(Table) then
- return nil
- end
- if offset == nil then
- offset = 0
- end
- local key = next(Table, offset)
- while key ~= nil do
- if Table[key] ~= nil then
- return key
- end
- key = next(Table, key)
- end
- return nil
- end
- local function QuestGiverDistances()
- if not (FyrMM.SV.BorderPins and FyrMM.SV.BorderQuestGivers) or #FyrMM.AvailableQuestGivers == 0 then
- return
- end
- local gameTime = GetGameTimeMilliseconds()
- local x, y = CurrentMap.PlayerNX, CurrentMap.PlayerNY -- GetMapPlayerPosition("player")
- AQGListFull = {}
- local multiplier = Fyr_MM:GetWidth()
- for _, v in ipairs(FyrMM.AvailableQuestGivers) do
- if v.nX == nil and v.mpin.normalizedX ~= nil then -- workaround just in case
- v.nX = v.mpin.normalizedX
- v.nY = v.mpin.normalizedY
- end
- if v.nX and v.nY then
- v.nDistance = math.sqrt((x - v.nX) * (x - v.nX) + (y - v.nY) * (y - v.nY))
- AQGListFull[#AQGListFull + 1] = {
- index = math.floor(multiplier * v.nDistance),
- data = v
- }
- end
- end
- table.sort(AQGListFull, sort)
- AQGList = {}
- if FyrMM.ZoneStoryPin then
- AQGList[#AQGList + 1] = FyrMM.ZoneStoryPin
- end
- for i, n in ipairs(AQGListFull) do
- if i > 5 then
- break
- end
- AQGList[#AQGList + 1] = n.data
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "QuestGiverDistances " .. tostring(GetGameTimeMilliseconds() - gameTime))
- end
- end
- function FyrMM.MenuTooltip(button, message)
- -- Fyr_MM_Menu:SetAlpha(1)
- FyrMM.OverMenu = true
- Fyr_MM_Close:SetAlpha(1)
- if not message or not button then
- return
- end
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 38, button:GetTop())
- InformationTooltip:AddLine(message, "", ZO_TOOLTIP_DEFAULT_COLOR:UnpackRGB())
- end
- function FyrMM.TooltipExit()
- FyrMM.OverMenu = false
- -- Fyr_MM_Menu:SetAlpha(0.1)
- Fyr_MM_Close:SetAlpha(0)
- ClearTooltip(InformationTooltip)
- end
- function FyrMM.PinToggle(value)
- MM_SetLockPosition(value)
- MM_RefreshPanel()
- end
- function FyrMM.OpenSettingsPanel()
- FyrMM.LAM:OpenToPanel(FyrMM.CPL)
- end
- function FyrMM.API_Check()
- if FyrMM.SV.UseOriginalAPI then -- if Community Leveling Guides is active and original functions to be used
- if _IsMapLocationVisible then
- MM_IsMapLocationVisible = _IsMapLocationVisible
- end
- if _GetMapLocationIcon then
- MM_GetNumMapLocations = _GetNumMapLocations
- end
- if _GetMapLocationIcon then
- MM_GetMapLocationIcon = _GetMapLocationIcon
- end
- if _G.GetPOIMapInfo then -- _GetPOIMapInfo_ORIG_ZGV
- MM_GetPOIMapInfo = _G.GetPOIMapInfo -- _GetPOIMapInfo_ORIG_ZGV
- end
- if _GetNumMapLocations ~= nil then -- _0GetNumMapLocations
- FyrMM.MapAPI0Present = true
- MM_GetNumMapLocations = _GetNumMapLocations -- _0GetNumMapLocations
- end
- if _IsMapLocationVisible ~= nil then -- _0IsMapLocationVisible
- MM_IsMapLocationVisible = _IsMapLocationVisible -- _0IsMapLocationVisible
- end
- if _GetMapLocationIcon ~= nil then -- _0GetMapLocationIcon
- MM_GetMapLocationIcon = _GetMapLocationIcon -- _0GetMapLocationIcon
- end
- if _G.GetNumPOIs ~= nil then -- _0GetNumPOIs
- MM_GetNumPOIs = _G.GetNumPOIs -- _0GetNumPOIs
- end
- if _G.GetPOIMapInfo ~= nil then -- _0GetPOIMapInfo
- MM_GetPOIMapInfo = _G.GetPOIMapInfo -- _0GetPOIMapInfo
- end
- else
- MM_GetNumMapLocations = GetNumMapLocations
- MM_IsMapLocationVisible = IsMapLocationVisible
- MM_GetMapLocationIcon = GetMapLocationIcon
- MM_GetPOIMapInfo = GetPOIMapInfo
- end
- end
- function GetCurrentMapSize()
- return CurrentMap and CurrentMap.TrueMapSize or nil -- Returns assumed calculated map size in feet, returns nil no calculated size or not possible to do so
- end
- local function GetRotatedPosition(x, y) -- Inspired by DeathAngel's RadarMiniMap
- if not CurrentMap.Heading then
- return
- end
- if not (x or CurrentMap.PlayerX) then
- return x, y
- end
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- local ix, iy = (x * mWidth) - CurrentMap.PlayerX, (y * mHeight) - CurrentMap.PlayerY
- local rx = math.cos(-CurrentMap.Heading) * ix - math.sin(-CurrentMap.Heading) * iy
- local ry = math.sin(-CurrentMap.Heading) * ix + math.cos(-CurrentMap.Heading) * iy
- return zo_round(rx), zo_round(ry)
- end
- local function GetNorthFacingPosition(x, y)
- if not (x and y) then
- return x, y
- end
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- return math.floor(mWidth * x), math.floor(mHeight * y) -- math.floor is faster than zo_round
- end
- local function Is_PinInsideWheel(pin)
- if pin.nX == nil and pin.nY == nil and pin.normalizedX == nil and pin.normalizedY == nil then
- return false
- end
- local di = Fyr_MM:GetWidth()
- local x, y = pin:GetCenter()
- local x1, y1 = Fyr_MM_Player:GetCenter()
- local width = pin:GetWidth()
- local distance = math.sqrt((x - x1) ^ 2 + (y - y1) ^ 2)
- if (pin.radius and pin.radius > 0) or pin.borderInformation then
- return distance < di / 2 - ((30 / 512) * di) + width / 2 - 10
- end
- return distance < di / 2 - ((30 / 512) * di)
- end
- local function smoothHeadingRotation() -- added by @Masteroshi430
- local x, y, pheading = CurrentMap.PlayerNX, CurrentMap.PlayerNY,
- CurrentMap.PlayerHeading or GetMapPlayerPosition("player")
- local headingTo = math.abs(pheading - pi * 2)
- if not FyrMM.SV.RotateMap then
- return headingTo
- end
- local heading = CurrentMap.Heading or 0
- local diff = ((headingTo - heading) + pi) % (pi * 2) - pi
- local currentHeading = (heading + (diff / 10)) % (pi * 2)
- if currentHeading < 0 then
- currentHeading = currentHeading + (pi * 2)
- end
- return currentHeading
- end
- local function SetDigSitePoints(digSite)
- local borderInformation = digSite.borderInformation
- local RotateMap = FyrMM.SV.RotateMap
- digSite:ClearPoints()
- local heading = CurrentMap.Heading
- if not (RotateMap and heading and CurrentMap.PlayerNX) then
- for i = 1, #borderInformation.borderPoints do
- digSite:AddPoint(borderInformation.borderPoints[i].x, borderInformation.borderPoints[i].y)
- end
- return
- end
- local math_sin = math.sin
- local math_cos = math.cos
- local points = borderInformation.borderPoints
- for i = 1, #points do
- local point = points[i]
- local ix = point.x - 0.5
- local iy = point.y - 0.5
- local sine = math_sin(-heading)
- local cosine = math_cos(-heading)
- local rx = cosine * ix - sine * iy
- local ry = sine * ix + cosine * iy
- digSite:AddPoint(rx, ry)
- end
- end
- local function SetPinFunctions(pin)
- if pin.UpdateWheelVisibility == nil then
- pin.UpdateWheelVisibility = function(self)
- if FyrMM.SV.WheelMap then
- self:SetHidden(not Is_PinInsideWheel(self))
- end
- end
- end
- if pin.RefreshAnchor then
- return
- end
- pin.RefreshAnchor = function(self)
- local x = self.nX or self.normalizedX
- local y = self.nY or self.normalizedY
- if not (x and y) then
- return
- end
- self:ClearAnchors()
- if FyrMM.SV.RotateMap then
- if pin.borderInformation then
- SetDigSitePoints(pin)
- self:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(x, y))
- return
- end
- self:SetAnchor(CENTER, Fyr_MM_Scroll, CENTER, GetRotatedPosition(x, y))
- return
- end
- if FyrMM.SV.WheelMap then
- self:SetAnchor(CENTER, Fyr_MM_Scroll_Map_Pins, TOPLEFT, GetNorthFacingPosition(x, y))
- if pin.borderInformation then
- self:SetParent(FyrMM.GetScrollObject(self))
- end
- return
- end
- self:SetAnchor(CENTER, self:GetParent(), TOPLEFT, GetNorthFacingPosition(x, y))
- end
- end
- function FyrMM.AxisPosition(angle)
- local mapWidth, mapHeight = Fyr_MM:GetDimensions() or FyrMM.SV.MapWidth, FyrMM.SV.MapHeight
- local halfPi = pi * 0.5
- local doublePi = pi * 2.0
- mapWidth = mapWidth / 2
- mapHeight = mapHeight / 2
- local northAngle = math.atan(mapWidth / mapHeight)
- local southAngle = halfPi - northAngle
- local northPos, eastPos, southPos, westPos
- local aMinusNorth = angle - northAngle
- local aPlusNorth = angle + northAngle
- if aPlusNorth >= doublePi or aMinusNorth <= 0 then -- Upper border line
- if aMinusNorth <= 0 then
- northPos = mapWidth + mapHeight * math.sin(angle) / math.sin(halfPi - angle)
- else
- northPos = mapWidth - mapHeight * math.sin(doublePi - angle) / math.sin(halfPi - (doublePi - angle))
- end
- return northPos, 0
- end
- local doubleSouthAngle = southAngle * 2
- if aMinusNorth > 0 and aMinusNorth < doubleSouthAngle then -- Right border line
- if aMinusNorth > southAngle then
- eastPos = mapHeight + mapWidth * math.sin(aMinusNorth - southAngle) /
- math.sin(halfPi - (aMinusNorth - southAngle))
- else
- eastPos = mapWidth * math.sin(aMinusNorth) / math.sin(halfPi - aMinusNorth)
- end
- return mapWidth * 2, eastPos
- end
- if aMinusNorth >= doubleSouthAngle and angle <= 3 * northAngle + doubleSouthAngle then -- Bottom border line
- if aMinusNorth - northAngle > doubleSouthAngle then
- southPos = mapWidth - mapHeight * math.sin(angle - 2 * northAngle - doubleSouthAngle) /
- math.sin(halfPi - (angle - 2 * northAngle - doubleSouthAngle))
- else
- southPos = mapWidth * 2 - mapHeight * math.sin(aMinusNorth - doubleSouthAngle) /
- math.sin(halfPi - (aMinusNorth - doubleSouthAngle))
- end
- return southPos, mapHeight * 2
- end
- if aPlusNorth > doublePi - doubleSouthAngle and aPlusNorth < doublePi then -- Left border line
- if aMinusNorth > southAngle then
- westPos = mapHeight - mapWidth * math.sin(angle - 3 * northAngle - 3 * southAngle) /
- math.sin(halfPi - (angle - 3 * northAngle - 3 * southAngle))
- else
- westPos = mapHeight - mapWidth * math.sin(angle - 3 * northAngle - doubleSouthAngle) /
- math.sin(halfPi - (angle - 3 * northAngle - doubleSouthAngle))
- end
- return 0, westPos
- end
- end
- local function RoundArc(angle) -- return angle % (math.pi * 2) faster for loops higher than ~100 of this function
- return (angle > pi * 2) and angle - pi * 2 or angle -- return angle if angle is not less than double pi
- end
- local function CanDrawCardinalForRotateWheelmap(x, y)
- if not FyrMM.SV.WheelMap then
- return true
- end
- if not FyrMM.SV.CardinalPoints then
- return false
- end
- local margin = Fyr_MM:GetWidth() / 3.5
- return (y == Fyr_MM:GetTop()) and (x >= Fyr_MM:GetLeft() + margin) and (x <= Fyr_MM:GetRight() - margin) -- twice as fas
- end
- local function AxisSwitch()
- local rotateMap = FyrMM.SV.RotateMap
- for i = 1, Fyr_MM_Axis_Textures:GetNumChildren() do
- local texture = Fyr_MM_Axis_Textures:GetChild(i)
- if texture then
- texture:ClearAnchors()
- local x, y = texture:GetCenter()
- texture:SetHidden(not rotateMap or not CanDrawCardinalForRotateWheelmap(x, y))
- local name = texture:GetName()
- name = string.gsub(name, "Fyr_MM_Axis_", "")
- texture:SetDimensions(#name == 1 and 24 or 32, 24)
- end
- end
- for i = 1, Fyr_MM_Axis_Labels:GetNumChildren() do
- local label = Fyr_MM_Axis_Labels:GetChild(i)
- if label then
- label:ClearAnchors()
- local x, y = label:GetCenter()
- label:SetHidden(not rotateMap or not CanDrawCardinalForRotateWheelmap(x, y))
- end
- end
- end
- function FyrMM.AxisPins()
- if FyrMM.SV.WheelMap and FyrMM.SV.RotateMap and FyrMM.SV.CardinalPoints then
- AxisSwitch()
- elseif (FyrMM.SV.WheelMap and not Fyr_MM_Axis_N:IsHidden()) or
- not (FyrMM.SV.RotateMap and not Fyr_MM_Axis_N:IsHidden()) then
- AxisSwitch()
- return
- end
- if not FyrMM.SV.RotateMap or not CurrentMap.Heading then
- return
- end
- -- Fyr_MM_Axis_Control:SetTopmost(true)
- local angles = { {
- pin = Fyr_MM_Axis_N,
- label = Fyr_MM_Axis_N_Label
- }, {
- pin = Fyr_MM_Axis_NE,
- label = Fyr_MM_Axis_NE_Label
- }, {
- pin = Fyr_MM_Axis_E,
- label = Fyr_MM_Axis_E_Label
- }, {
- pin = Fyr_MM_Axis_SE,
- label = Fyr_MM_Axis_SE_Label
- }, {
- pin = Fyr_MM_Axis_S,
- label = Fyr_MM_Axis_S_Label
- }, {
- pin = Fyr_MM_Axis_SW,
- label = Fyr_MM_Axis_SW_Label
- }, {
- pin = Fyr_MM_Axis_W,
- label = Fyr_MM_Axis_W_Label
- }, {
- pin = Fyr_MM_Axis_NW,
- label = Fyr_MM_Axis_NW_Label
- } }
- local n = pi * 2 - CurrentMap.Heading
- for i, angle in ipairs(angles) do
- local angleValue = RoundArc(n + pi * (i * 0.25))
- angle.pin:ClearAnchors()
- angle.label:ClearAnchors()
- angle.pin:SetAnchor(CENTER, Fyr_MM_Axis_Control, TOPLEFT, FyrMM.AxisPosition(angleValue))
- angle.label:SetAnchor(CENTER, Fyr_MM_Axis_Control, TOPLEFT, FyrMM.AxisPosition(angleValue))
- end
- end
- local function IsCoordinateInRange(x, y)
- if not CurrentMap.TrueMapSize or not CurrentMap.PlayerNX or not FyrMM.SV.CustomPinViewRange or
- not FyrMM.SV.ViewRangeFiltering then
- return true
- end
- return CurrentMap.TrueMapSize *
- math.sqrt(
- (x - CurrentMap.PlayerNX) * (x - CurrentMap.PlayerNX) + (y - CurrentMap.PlayerNY) *
- (y - CurrentMap.PlayerNY)) <= FyrMM.SV.CustomPinViewRange
- end
- function FyrMM.SetPinSize(pin, size, _)
- local properSize = math.floor(size / 2) * 2
- if (not pin.radius or pin.radius == 0) and CurrentMap.MapId ~= 16 and CurrentMap.MapId ~= 660 and
- GetMapContentType() ~= MAP_CONTENT_BATTLEGROUND and properSize > 42 then
- properSize = 42
- end
- if (not pin.radius or pin.radius == 0) and CurrentMap.MapId ~= 16 and CurrentMap.MapId ~= 660 and
- GetMapContentType() ~= MAP_CONTENT_BATTLEGROUND and properSize < 23 then
- properSize = 23
- end
- pin:SetDimensions(properSize, properSize)
- end
- function FyrMM.SetPinAnchor(pin, x, y, AnchorToControl, hidden)
- local newX, newY, currentX, currentY, currentObject, _
- if pin == nil then
- return
- end
- SetPinFunctions(pin)
- if pin.nX == nil and pin.nY == nil and pin.normalizedX == nil and pin.normalizedY == nil then
- PinsList[pin:GetName()] = nil
- pin:ClearAnchors()
- pin:SetHidden()
- return
- end
- if x and y and AnchorToControl then
- _, _, currentObject, _, currentX, currentY = pin:GetAnchor()
- if PinsList[pin:GetName()] == nil then
- PinsList[pin:GetName()] = pin
- end
- if FyrMM.SV.RotateMap then
- newX, newY = GetRotatedPosition(x, y)
- AnchorToControl = Fyr_MM_Scroll
- else
- newX, newY = GetNorthFacingPosition(x, y)
- end
- if newX ~= currentX or newY ~= currentY or currentObject ~= AnchorToControl then
- pin:ClearAnchors()
- if FyrMM.SV.RotateMap then
- if pin.borderInformation then
- pin:SetAnchor(TOPLEFT, AnchorToControl, CENTER, newX, newY)
- else
- pin:SetAnchor(CENTER, AnchorToControl, CENTER, newX, newY)
- end
- else
- pin:SetAnchor(CENTER, AnchorToControl, TOPLEFT, newX, newY)
- end
- end
- end
- if hidden then
- pin:SetHidden(true)
- return
- end
- if FyrMM.SV.WheelMap and x and y then
- pin:SetHidden(not Is_PinInsideWheel(pin))
- end
- end
- local function RescaleLinks()
- if not IsInAvAZone() then
- return
- end
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- local Count, mapLink, startX, startY, endX, endY
- for i = 1, 100 do
- mapLink = GetControl("Fyr_MM_Scroll_Map_Links_Link" .. tostring(i))
- if mapLink then
- if FyrMM.SV.WheelMap then
- mapLink:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- else
- mapLink:SetParent(Fyr_MM_Scroll_Map_Links)
- end
- if FyrMM.SV.RotateMap then
- mapLink:ClearAnchors()
- mapLink:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(mapLink.startNX, mapLink.startNY))
- mapLink:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(mapLink.endNX, mapLink.endNY))
- else
- startX, startY, endX, endY = mapLink.startNX * mWidth - mWidth / 2,
- mapLink.startNY * mHeight - mHeight / 2,
- mapLink.endNX * mWidth - mWidth / 2, mapLink.endNY * mHeight - mHeight / 2
- mapLink:ClearAnchors()
- mapLink:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, zo_round(startX), zo_round(startY))
- mapLink:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, zo_round(endX), zo_round(endY))
- end
- else
- i = 99
- end
- mapLink = GetControl("Fyr_MM_Scroll_Map_LinksNS_Link" .. tostring(i))
- if mapLink then
- if FyrMM.SV.RotateMap then
- mapLink:ClearAnchors()
- mapLink:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(mapLink.startNX, mapLink.startNY))
- mapLink:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(mapLink.endNX, mapLink.endNY))
- else
- startX, startY, endX, endY = mapLink.startNX * mWidth - mWidth / 2,
- mapLink.startNY * mHeight - mHeight / 2,
- mapLink.endNX * mWidth - mWidth / 2, mapLink.endNY * mHeight - mHeight / 2
- mapLink:ClearAnchors()
- mapLink:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, zo_round(startX), zo_round(startY))
- mapLink:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, zo_round(endX), zo_round(endY))
- end
- end
- mapLink = GetControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(i))
- if mapLink then
- if FyrMM.SV.RotateMap then
- mapLink:ClearAnchors()
- mapLink:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(mapLink.startNX, mapLink.startNY))
- mapLink:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(mapLink.endNX, mapLink.endNY))
- else
- startX, startY, endX, endY = mapLink.startNX * mWidth - mWidth / 2,
- mapLink.startNY * mHeight - mHeight / 2,
- mapLink.endNX * mWidth - mWidth / 2, mapLink.endNY * mHeight - mHeight / 2
- mapLink:ClearAnchors()
- mapLink:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, zo_round(startX), zo_round(startY))
- mapLink:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, zo_round(endX), zo_round(endY))
- end
- end
- end
- end
- local function UpdateWheelPins()
- if Fyr_MM:IsHidden() then
- return
- end
- local RotateMap = FyrMM.SV.RotateMap
- local WheelMap = FyrMM.SV.WheelMap
- if not RotateMap and not WheelMap then
- return
- end
- for _, v in pairs(PinsList) do
- if WheelMap then
- v:UpdateWheelVisibility()
- end
- if RotateMap then
- if not v:IsHidden() or v.BorderPin then
- v:RefreshAnchor()
- end
- end
- end
- RescaleLinks()
- end
- function FyrMM.RegisterRWUpdates() -- never called
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapRWUpdate", 100, UpdateWheelPins)
- end
- function FyrMM.UnRegisterRWUpdates() -- never called
- EVENT_MANAGER:UnRegisterForUpdate("FyrMiniMapRWUpdate")
- end
- local function UpdateCustomPinPositions()
- if not FyrMM.Visible or Fyr_MM:IsHidden() or FyrMM.worldMapShowing or CustomPinsCopying then
- return
- end
- -- local currentZone = CurrentMap.MapId
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- local enabled
- for _, p in pairs(PinsList) do
- if p and p.m_PinType then
- if p.m_PinType == 9999 then -- fix attempt 10/10/2022
- p:SetHidden(not IsCoordinateInRange(p.nX, p.nY))
- p:RefreshAnchor()
- elseif p.m_PinType >= MAP_PIN_TYPE_INVALID then
- if PinRef then
- if PRCustomPins then
- enabled = PRCustomPins[p.m_PinType].enabled
- end
- else
- enabled = ZO_WorldMap_IsCustomPinEnabled(p.m_PinType) -- checks filter for custom pin
- end
- if p.nX and p.nY and enabled then
- p:SetHidden(not IsCoordinateInRange(p.nX, p.nY))
- if not p:IsHidden() then
- if p.pinTexture and p.pinTexture ~= p:GetTextureFileName() then
- p:SetTexture(p.pinTexture)
- end
- p:RefreshAnchor()
- end
- end
- end
- end
- end
- end
- local function RescalePinPositions()
- if Fyr_MM:IsHidden() or not CurrentMap.needRescale then
- return
- end
- CurrentMap.needRescale = false
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- for _, v in pairs(PinsList) do
- v:RefreshAnchor()
- if v.borderInformation ~= nil then -- antiquity digging sites
- local width = v.borderInformation.borderWidth * mWidth
- local height = v.borderInformation.borderHeight * mHeight
- v:SetDimensions(width, height)
- elseif FyrMM.SV.autoResizePin and v ~= ZO_WorldMap_GetPinManager():GetPlayerPin() and v.m_textureAnimTimeline ==
- nil and CurrentMap.MapId ~= 16 and CurrentMap.MapId ~= 660 and (v.radius == 0 or v.radius == nil) and
- GetMapContentType() ~= MAP_CONTENT_BATTLEGROUND and not v.noZoomResize then
- if v.m_PinType == 9999 then -- Elder Scroll aura
- local size = 64
- FyrMM.SetPinSize(v, size * FyrMM.pScalePercent)
- elseif v.m_PinType then
- local size = 32
- if ZO_MapPin.FAST_TRAVEL_WAYSHRINE_PIN_TYPES[v.m_PinType] or ZO_MapPin.POI_PIN_TYPES[v.m_PinType] or
- v.m_PinType == MAP_PIN_TYPE_LOCATION then -- scale pin to zoom level only for these types
- FyrMM.SetPinSize(v, size * FyrMM.pScalePercent * FyrMM.pinZoomScale)
- else
- FyrMM.SetPinSize(v, size * FyrMM.pScalePercent)
- end
- end
- elseif v.radius and v.radius > 0 then -- resize area pin in case of zoom
- local size = mHeight * v.radius * 2
- v:SetDimensions(size, size)
- end
- if FyrMM.SV.WheelMap then
- v:SetHidden(not Is_PinInsideWheel(v))
- if v.BorderPin then
- v.BorderPin:SetHidden(not v:IsHidden())
- end
- end
- end
- RescaleLinks()
- FyrMM.UpdateQuestPinPositions()
- FyrMM.PlaceBorderPins()
- end
- local ZoomAnimating = false
- local function AnimateZoom(newzoom)
- if CurrentMap.ZoomLevel == newzoom then
- return
- end
- local step = (newzoom - CurrentMap.ZoomLevel) / 10
- ZoomAnimating = true
- EVENT_MANAGER:RegisterForUpdate("OnFyrMMZoomAnimate", 1, function()
- FyrMM.SetCurrentMapZoom(CurrentMap.ZoomLevel + step)
- if FyrMM.SV.autoResizePin and CurrentMap.MapId ~= 16 and CurrentMap.MapId ~= 660 and GetMapContentType() ~=
- MAP_CONTENT_BATTLEGROUND then
- -- zoom: 1 to 50 default: 10
- -- should be between 0.1 and 5
- FyrMM.pinZoomScale = (CurrentMap.ZoomLevel) / 10
- -- d("pinzoom: "..FyrMM.pinZoomScale)
- else
- FyrMM.pinZoomScale = 1
- end
- if (CurrentMap.ZoomLevel <= newzoom and step < 0) or (CurrentMap.ZoomLevel >= newzoom and step > 0) then
- EVENT_MANAGER:UnregisterForUpdate("OnFyrMMZoomAnimate")
- FyrMM.SetCurrentMapZoom(newzoom)
- -- FyrMM.UpdateMapTiles(true)
- FyrMM.PositionUpdate()
- CurrentMap.needRescale = true
- RescalePinPositions()
- FyrMM.UpdateMapTiles(true)
- ZoomAnimating = false
- else
- -- FyrMM.UpdateMapTiles(true)
- FyrMM.PositionUpdate()
- CurrentMap.needRescale = true
- RescalePinPositions()
- FyrMM.UpdateMapTiles(true)
- end
- end)
- end
- local function GetQuestData(pin)
- return pin.m_PinTag[1], pin.m_PinTag[3], pin.m_PinTag[2]
- end
- local function SetQuestTooltip(pin)
- if pin == nil then
- return
- end
- local tooltipLines = {}
- local line = ""
- local nX = pin.normalizedX
- local nY = pin.normalizedY
- local pinCount = Fyr_MM_Scroll_Map_QuestPins:GetNumChildren()
- for index = 1, pinCount + 10 do
- local questPin = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index))
- if questPin and (not questPin:IsHidden() or FyrMM.SV.WheelMap) then
- line = ""
- if questPin.normalizedX == nX and questPin.normalizedY == nY then
- -- if l.m_PinType == MAP_PIN_TYPE_ASSISTED_QUEST_ENDING or l.m_PinType == MAP_PIN_TYPE_TRACKED_QUEST_ENDING then
- -- line = GenerateQuestEndingTooltipLine(questIndex)
- -- if valueExists(line, tooltipLines) then
- -- line = ""
- -- else
- -- InformationTooltip:AppendQuestEnding(l.m_PinTag[1])
- -- end
- -- end
- if QUEST_PIN_TYPES[questPin.m_PinType] then
- line = GenerateQuestConditionTooltipLine(GetQuestData(questPin))
- if valueExists(line, tooltipLines) then
- line = ""
- else
- InformationTooltip:AppendQuestCondition(GetQuestData(questPin))
- end
- end
- if GetTrackedIsAssisted(TRACK_TYPE_QUEST, questPin.questIndex) then
- questPin:SetMouseEnabled(true)
- else
- questPin:SetMouseEnabled(false)
- end
- end
- if line ~= "" then
- table.insert(tooltipLines, line)
- end
- end
- end
- pin:SetMouseEnabled(true)
- end
- -- local function GetQuestPinById(Id) -- Returns first visible pin by quest Id
- -- for i=1, FyrMM.questPinCount do
- -- local l = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin"..tostring(i))
- -- if l ~= nil then
- -- if l.questIndex == Id and not l:IsHidden() then
- -- return l
- -- end
- -- end
- -- end
- -- return nil
- -- end
- function FyrMM.IsPinVisible(pin) -- Check for pin leaving map limits
- return (pin:GetRight() >= Fyr_MM:GetLeft() + 6 and pin:GetLeft() <= Fyr_MM:GetRight() - 10 and pin:GetBottom() >=
- Fyr_MM:GetTop() + 6 and pin:GetTop() <= Fyr_MM:GetBottom() - 10)
- end
- function FyrMM.IsValidBorderPin(pin)
- if not FyrMM.SV.BorderPins then
- return false
- end
- local Visible, Tracked
- Visible = FyrMM.SV.WheelMap and Is_PinInsideWheel(pin) or FyrMM.IsPinVisible(pin)
- if pin.m_PinType == MAP_PIN_TYPE_GROUP or pin.m_PinType == MAP_PIN_TYPE_GROUP_LEADER then
- if IsUnitOnline(pin.unitTag) then
- if FyrMM.SV.BorderPinsOnlyLeader and not IsUnitGroupLeader("player") and not IsActiveWorldBattleground() then
- Tracked = IsUnitGroupLeader(pin.unitTag) and (GetUnitZone("player") == GetUnitZone(pin.unitTag))
- else
- Tracked = (GetUnitZone("player") == GetUnitZone(pin.unitTag))
- end
- end
- else
- if FyrMM.SV.BorderPinsOnlyAssisted then
- Tracked = GetTrackedIsAssisted(TRACK_TYPE_QUEST, pin.questIndex)
- else
- Tracked = true
- end
- end
- if pin.m_PinType == MAP_PIN_TYPE_ACTIVE_COMPANION then
- Tracked = true
- end
- if CustomWaypoints[pin.m_PinType] then
- Tracked = FyrMM.SV.BorderPinsWaypoint
- end
- if pin.m_Pin then
- if pin.m_Pin:IsFastTravelWayShrine() then
- local index, _ = string.gsub(pin:GetName(), "Fyr_MM_Scroll_Map_WayshrinePins_Pin", "")
- if Wayshrines[tonumber(index)] then
- if Wayshrines[tonumber(index)].Closest and CurrentMap.MapId and CurrentMap.MapId ~= 16 then -- removes wayshrine border pin on Crodiil map
- Tracked = FyrMM.SV.BorderWayshrine
- else
- Tracked = false
- end
- end
- end
- end
- if pin.m_PinType == MAP_PIN_TYPE_LOCATION then
- Tracked = false
- if pin.IsBankPin and FyrMM.SV.BorderPinsBank then
- Tracked = pin.IsBankPin
- end
- if pin.IsStablePin and FyrMM.SV.BorderPinsStables then
- Tracked = pin.IsStablePin
- end
- if pin.IsCraftingServicePin and FyrMM.SV.BorderCrafting then
- Tracked = pin.IsCraftingServicePin
- end
- -- Community Leveling Guides
- if pin.isZGESO then
- Tracked = pin.isZGESO
- end
- end
- -- AVA and Battlegrounds moving pins
- if pin.AVABGtype ~= nil then
- Tracked = true
- end
- -- lost treasure & Map pins treasures & surveys
- if pin.IsTreasure then
- if (pin.pinTexture and string.find(pin.pinTexture, "MapPins/Treasure_")) or
- (PRCustomPins and PRCustomPins[pin.m_PinType] and PRCustomPins[pin.m_PinType].pinTypeString and
- string.find(PRCustomPins[pin.m_PinType].pinTypeString, "LostTreasure")) then
- Tracked = FyrMM.SV.BorderTreasures
- else
- pin.IsTreasure = nil
- Tracked = false
- end
- end
- -- Dragon Next location
- if FyrMM.SV.WorldEvents and pin.IsDragonNextLocation then
- if pin.pinTexture and string.find(pin.pinTexture, "dragonNextLocation") and (pin.nX ~= -1 and pin.nX ~= -1) then
- Tracked = FyrMM.SV.WorldEvents
- else
- pin.IsDragonNextLocation = nil
- Tracked = false
- end
- end
- -- antiquity digging sites
- if pin.borderInformation ~= nil then
- Tracked = FyrMM.SV.BorderTreasures
- end
- -- quest givers and zonestory
- if pin.IsAvailableQuest then
- if pin.m_PinTag ~= nil then
- if pin.m_PinTag.IsAvailableQuest then
- if pin.m_PinTag.isZoneStory and pin == FyrMM.ZoneStoryPin then
- Tracked = FyrMM.SV.BorderQuestGivers
- elseif not pin.m_PinTag.isZoneStory then
- Tracked = FyrMM.SV.BorderQuestGivers
- else
- Tracked = false
- end
- else
- pin.IsAvailableQuest = nil
- end
- else
- pin.IsAvailableQuest = nil
- end
- end
- -- world events -- has to stay on bottom
- if pin.context ~= nil and FyrMM.SV.WorldEvents then
- if pin.weDistance then
- if GetMapType() == MAPTYPE_SUBZONE then -- world events within X subzone map are displayed on border
- local distance = CurrentMap.TrueMapSize or 1
- local weDistance = distance *
- math.sqrt(
- (pin.nX - CurrentMap.PlayerNX) * (pin.nX - CurrentMap.PlayerNX) + (pin.nY - CurrentMap.PlayerNY) * (pin.nY - CurrentMap.PlayerNY))
- Tracked = (weDistance <= distance)
- -- d(CurrentMap.filename.." subzone tms "..distance.." dist "..weDistance)
- else -- world events within zone map / 8 are displayed on border
- local TrueMapSize = CurrentMap.TrueMapSize or 1
- local distance = TrueMapSize / 8
- Tracked = (pin.weDistance <= distance)
- -- d(CurrentMap.filename.." tms "..distance.." dist "..pin.weDistance)
- end
- else
- Tracked = false
- end
- end
- return not Visible and Tracked
- end
- local function GetNumBorderPins()
- local totalPins = Fyr_MM_Axis_Border_Pins:GetNumChildren()
- local count = 0
- for index = 1, totalPins do
- local borderPinChild = Fyr_MM_Axis_Border_Pins:GetChild(index)
- if borderPinChild then
- if borderPinChild.pin then
- count = count + 1
- else
- borderPinChild:SetHidden(true)
- end
- end
- end
- return count
- end
- local function RemoveBorderPin(pin)
- if not pin then
- return
- end
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- -- pin:SetTexture(nil)
- -- pin:SetHandler("OnMouseEnter", function() return end)
- -- pin:SetHandler("OnMouseExit", function() return end)
- -- pin:SetHandler("OnMouseUp", function() return end)
- if pin.pin then
- if pin.pin.OnBorder then
- pin.pin.OnBorder = nil
- end
- if pin.pin.BorderPin then
- pin.pin.BorderPin = nil
- end
- pin.pin = nil -- test 30/04/2023
- end
- end
- local function CleanUpMisc()
- local gameTime = GetGameTimeMilliseconds()
- if not IsInAvAZone() then
- KeepIndex = {}
- local LinksDone = false
- local LinksNSDone = false
- local LinksWEDone = false
- local LocksDone = false
- for index = 1, 100 do
- l = GetControl("Fyr_MM_Scroll_Map_Links_Link" .. tostring(index))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksNS_Link" .. tostring(index))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksNSDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(index))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksWEDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_Locks_Lock" .. tostring(index))
- if l ~= nil then
- l:ClearAnchors()
- l.normalizedX = nil
- l.normalizedY = nil
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- else
- LocksDone = true
- end
- if LinksDone and LinksNSDone and LinksWEDone and LocksDone then
- index = 100
- end
- end
- end
- FyrMM.CustomPinCount = 0
- FreeCustomPinIndex = {}
- CustomPinIndex = {}
- CustomPinKeyIndex = {}
- LastCustomPinIndex = 0
- FyrMM.Reloading = false
- FyrMM.InitialPreload()
- -- Some InitialPreload functions are moved here to speed up things 21/04/2023 -- CAUSING DISPLAY BUGS WITH CUSTOM PINS
- -- YO FyrMM.SetMapToPlayerLocation() -- test 21/04/2023
- -- YO CurrentMap.ZoneIndex = GetCurrentMapZoneIndex() -- test 21/04/2023
- -- FyrMM.UpdateMapInfo() -- test 21/04/2023
- -- FyrMM.UpdateMapTiles(true) -- test 21/04/2023
- -- YO FyrMM.GroupEvent() -- test 21/04/2023
- -- YO FyrMM.UpdateQuestPins() -- test 21/04/2023
- -- YO if IsInAvAZone() then FyrMM.RequestKeepRefresh() end -- test 21/04/2023
- -- YO FyrMM.PlaceWaypointBorderPins() -- test 01/05/2023
- -- YO FyrMM.LoadCustomPinList() -- test 01/05/2023
- -- YO FyrMM.UpdateAntiquityDigSites() -- test 21/04/2023
- -- YO FyrMM.RegisterUpdates() -- test 21/04/2023
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "CleanUpMisc " .. tostring(GetGameTimeMilliseconds() - gameTime))
- end
- end
- local function RemoveCustomPin(p)
- if not p then --[[ d("RemoveCustomPin pin is nil") --]]
- return
- end
- if p.BorderPin then
- RemoveBorderPin(p.BorderPin)
- end
- local key = tostring(p.nX) .. ":" .. tostring(p.nY) .. ":" .. tostring(p.radius)
- if p.m_PinType and FyrMM.CustomPinCheckList[p.m_PinType] and FyrMM.CustomPinCheckList[p.m_PinType][key] then
- FyrMM.CustomPinCheckList[p.m_PinType][key].Id = 0
- end
- p:ClearAnchors()
- p:SetHidden(true)
- p.m_PinTag = nil
- p.MapId = nil
- p.radius = nil
- p.nX = nil
- p.nY = nil
- p.IsTreasure = nil
- p.IsAvailableQuest = nil
- p.pinTexture = nil
- -- if p.Key == nil then d("p.Key == nil, could not remove that pin") end
- -- if p.Index == nil then d("p.Index == nil, could not remove that pin") end
- if FyrMM.CustomPinList[p.m_PinType] and FyrMM.CustomPinList[p.m_PinType][p.Key] and FyrMM.CustomPinList[p.m_PinType][p.Key].pin then
- FyrMM.CustomPinList[p.m_PinType][p.Key].pin = nil
- FyrMM.CustomPinList[p.m_PinType][p.Key] = nil
- end
- if not IsTableEmpty(CustomPinIndex) then
- if p.Index then
- table.insert(FreeCustomPinIndex, p.Index)
- FyrMM.CustomPinCount = FyrMM.CustomPinCount - 1
- end
- if CustomPinIndex[p.m_PinType] and p.Index and CustomPinIndex[p.m_PinType][p.Index] then
- CustomPinIndex[p.m_PinType][p.Index] = nil
- -- if p.Key ~= nil then
- -- CustomPinKeyIndex[p.m_PinType][p.Key] = nil
- -- end
- end
- end
- if p:GetName() and PinsList[p:GetName()] then
- PinsList[p:GetName()] = nil
- end
- p.Key = nil
- p.m_PinType = nil
- p.Index = nil
- p = nil
- -- d("pin was removed")
- end
- local function CheckCustomPinConsistence(Type)
- local pin
- if Type == nil then
- for i, n in pairs(CustomPinKeyIndex) do
- if FyrMM.CustomPinList[i] == nil then
- for j, index in pairs(n) do
- pin = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index))
- RemoveCustomPin(pin)
- CustomPinKeyIndex[i][j] = nil
- end
- else
- if #n ~= #FyrMM.CustomPinList[i] then
- for j, index in pairs(n) do
- if FyrMM.CustomPinList[i][j] == nil then
- pin = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index))
- RemoveCustomPin(pin)
- CustomPinKeyIndex[i][j] = nil
- end
- end
- end
- end
- end
- else
- if CustomPinKeyIndex[Type] == nil then
- return
- end
- if FyrMM.CustomPinList[Type] == nil then
- for j, index in pairs(CustomPinKeyIndex[Type]) do
- pin = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index))
- RemoveCustomPin(pin)
- CustomPinKeyIndex[Type][j] = nil
- end
- else
- if #CustomPinKeyIndex[Type] ~= #FyrMM.CustomPinList[Type] then
- for j, index in pairs(CustomPinKeyIndex[Type]) do
- if FyrMM.CustomPinList[Type][j] == nil then
- pin = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index))
- RemoveCustomPin(pin)
- CustomPinKeyIndex[Type][j] = nil
- end
- end
- end
- end
- end
- end
- local function CleanUpPins()
- -- faster ways for cleaning up pins result in occasional pins not removing
- if IsTableEmpty(PinsList) then
- FyrMM.Reloading = false
- return
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "CleanUpPins Start:" .. tostring(chunk) .. "..." .. tostring(delay))
- end
- local cui = 0
- local chunk = FyrMM.SV.ChunkSize or 50
- local delay = FyrMM.SV.ChunkDelay or 50
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapCleanupPinsTask", delay, function()
- local count = 0
- local isCustomPin = false
- cui = cui + 1
- local gameTime = GetGameTimeMilliseconds()
- for index, pin in pairs(PinsList) do
- count = count + 1
- if count >= chunk then
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "CleanUpPins " .. tostring(cui) .. " " ..
- tostring(GetGameTimeMilliseconds() - gameTime))
- end
- return
- end
- if pin then
- if pin.m_PinType and pin.m_PinType >= MAP_PIN_TYPE_INVALID then -- is custom pin
- RemoveCustomPin(pin)
- isCustomPin = true
- end
- if not isCustomPin then -- is regular pin
- if pin.BorderPin then
- RemoveBorderPin(pin.BorderPin)
- end
- pin:ClearAnchors()
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin.nX = nil
- pin.nY = nil
- pin:ClearAnchors()
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- pin:SetDimensions(0, 0)
- pin.m_PinTag = nil
- pin.m_PinType = nil
- pin.m_Pin = nil
- pin.IsAvailableQuest = nil
- pin.normalizedX = nil
- pin.normalizedY = nil
- pin.radius = nil
- pin.MapId = nil
- pin.Index = nil
- pin.questName = nil
- pin.PinToolTipText = nil
- pin.primaryPin = nil
- pin.secondaryPin = nil
- pin.tertiaryPin = nil
- pin.MM_Tag = nil
- pin.pinAge = nil
- pin.IsTreasure = nil
- pin.isDps = nil
- pin.isHeal = nil
- pin.isTank = nil
- pin.ClassId = nil
- pin.isLeader = nil
- PinsList[index] = nil
- end
- end
- if IsTableEmpty(PinsList) then
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "CleanUpPins Done. " .. tostring(GetGameTimeMilliseconds() - gameTime))
- end
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapCleanupPinsTask")
- CleanUpMisc()
- return
- end
- end
- end)
- end
- local function GetNewBorderPinIndex()
- if Fyr_MM_Axis_Border_Pins:GetNumChildren() == 0 then
- return 1
- end
- if Fyr_MM_Axis_Border_Pins:GetNumChildren() ~= GetNumBorderPins() then
- for i = 1, Fyr_MM_Axis_Border_Pins:GetNumChildren() do
- local l = Fyr_MM_Axis_Border_Pins:GetChild(i)
- if l and not l.pin then
- return i
- end
- end
- end
- return Fyr_MM_Axis_Border_Pins:GetNumChildren() + 1
- end
- local function GetTextureForBorderPin(pin)
- local texture = pin.pinTexture
- if pin.IsTreasure and texture then
- return texture
- end
- if pin.IsDragonNextLocation and texture then
- return texture
- -- zone stories
- end
- if pin.IsAvailableQuest then
- if pin.m_PinTag.isZoneStory or ZO_MapPin.SUGGESTION_PIN_TYPES[pin.m_PinType] then
- if pin.m_PinType == MAP_PIN_TYPE_SKYSHARD_SUGGESTED then
- return "EsoUI/Art/MapPins/skyshard_seen.dds"
- end
- return "esoui/art/lfg/gamepad/lfg_menuicon_zonestories.dds"
- end
- if texture then
- return texture
- end
- -- antiquities
- end
- if pin.borderInformation then
- return "/esoui/art/icons/servicemappins/servicepin_antiquities.dds"
- end
- if pin.m_PinType == MAP_PIN_TYPE_PLAYER_WAYPOINT then
- return "EsoUI/Art/MapPins/UI_Worldmap_pin_customDestination.dds"
- end
- if pin.m_PinType == MAP_PIN_TYPE_RALLY_POINT then
- return "MiniMap/Textures/rally.dds"
- end
- if pin.m_PinType == MAP_PIN_TYPE_PING then
- return "MiniMap/Textures/ping.dds"
- end
- if pin.m_PinType == MAP_PIN_TYPE_LOCATION and pin.m_PinTag[2] then
- return pin.m_PinTag[2]
- end
- if (pin.m_PinType == MAP_PIN_TYPE_GROUP or pin.m_PinType == MAP_PIN_TYPE_GROUP_LEADER) and texture then
- return texture
- end
- if pin.m_PinType == MAP_PIN_TYPE_ACTIVE_COMPANION and texture then
- return texture
- -- dragons & world events
- end
- if pin.context then
- return texture
- end
- if QUEST_PIN_TYPES[pin.m_PinType] then
- if pin.m_PinTag.isBreadcrumb then
- return breadcrumbQuestPinTextures[pin.m_PinType]
- end
- return questPinTextures[pin.m_PinType]
- end
- if pin.m_Pin and pin.m_Pin:IsFastTravelWayShrine() then
- if pin.m_Pin.m_PinTag[2] then
- return pin.m_Pin.m_PinTag[2]
- end
- return "/esoui/art/icons/poi_wayshrine_complete.dds"
- -- AVA and Battlegrounds
- end
- if OBJECTIVE_PIN_TYPES[pin.m_PinType] or ZO_MapPin.RETURN_OBJECTIVE_PIN_TYPES[pin.m_PinType] or
- ZO_MapPin.SPAWN_OBJECTIVE_PIN_TYPES[pin.m_PinType] then
- return ZO_MapPin.PIN_DATA[pin.m_PinType].texture
- end
- if pin.m_PinType == 9999 then
- return "MiniMap/Textures/scroll_aura.dds"
- -- Elder Scroll aura
- end
- end
- local function ProcessQuestPinClick(pin)
- local PinHandlers = {}
- local Pins = {}
- local HandlerCount = 0
- local Handler = {}
- local entries = {}
- local entry = ""
- Handler.Callback = function(questIndex)
- FOCUSED_QUEST_TRACKER:ForceAssist(questIndex)
- end
- Handler.Name = zo_strformat(SI_WORLD_MAP_ACTION_SELECT_QUEST, GetJournalQuestName(pin.questIndex))
- table.insert(PinHandlers, Handler)
- table.insert(Pins, pin)
- for i = 1, FyrMM.questPinCount do
- local p = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(i))
- if p ~= nil then
- if p ~= pin and p.normalizedX == pin.normalizedX and p.normalizedY == pin.normalizedY and not p:IsHidden() then
- entry = zo_strformat(SI_WORLD_MAP_ACTION_SELECT_QUEST, GetJournalQuestName(p.questIndex))
- if not valueExists(entry, entries) then
- HandlerCount = HandlerCount + 1
- local Handler = {}
- Handler.Callback = function(questIndex)
- FOCUSED_QUEST_TRACKER:ForceAssist(questIndex)
- end
- Handler.Name = zo_strformat(SI_WORLD_MAP_ACTION_SELECT_QUEST, GetJournalQuestName(p.questIndex))
- table.insert(PinHandlers, Handler)
- table.insert(Pins, p)
- table.insert(entries, entry)
- end
- end
- end
- end
- if HandlerCount <= 1 then
- PinHandlers[1].Callback(Pins[1].questIndex)
- else
- ClearMenu()
- for i = 1, HandlerCount do
- local Handler = PinHandlers[i]
- local questIndex = Pins[i].questIndex
- local Name = Handler.Name
- if type(Name) == "function" then
- Name = Name(Pins[i])
- end
- AddMenuItem(Name, function()
- Handler.Callback(questIndex)
- end)
- end
- ShowMenu(pin)
- end
- end
- local function PinOnMouseExit(pin)
- if pin == nil then
- return
- end
- FyrMM.SetTargetScale(pin, 1)
- if pin.m_PinType == MAP_PIN_TYPE_LOCATION then
- ClearTooltip(ZO_MapLocationTooltip)
- else
- ClearTooltip(InformationTooltip)
- end
- end
- local function PinOnMouseEnter(pin)
- FyrMM.SetTargetScale(pin, 1.3)
- if not FyrMM.SV.PinTooltips then
- return
- end
- if pin.pinType ~= nil then
- if pin.pinType == MAP_PIN_TYPE_TRACKED_ANTIQUITY_DIG_SITE or pin.pinType == MAP_PIN_TYPE_ANTIQUITY_DIG_SITE then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendDigSiteAntiquities(pin.Tag)
- end
- end
- if pin.m_PinType ~= nil then
- if QUEST_PIN_TYPES[pin.m_PinType] then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- SetQuestTooltip(pin)
- IsCurrentLocation(pin)
- return
- elseif ZONE_EXPLORATION_PIN_TYPES[pin.m_PinType] then
- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType] == nil then
- return
- end
- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].tooltip then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- end
- ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].creator(pin.mpin)
- IsCurrentLocation(pin)
- elseif CustomWaypoints[pin.m_PinType] then
- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType] then
- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].tooltip and
- ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].creator then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].creator(pin)
- IsCurrentLocation(pin)
- return
- end
- end
- elseif ZO_MapPin.FAST_TRAVEL_WAYSHRINE_PIN_TYPES[pin.m_PinType] or ZO_MapPin.POI_PIN_TYPES[pin.m_PinType] then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- SetTooltipMessage(pin.m_Pin)
- if not ZO_MapPin.FAST_TRAVEL_WAYSHRINE_PIN_TYPES[pin.m_PinType] then
- IsCurrentLocation(pin)
- end
- return
- elseif pin.m_PinType == MAP_PIN_TYPE_LOCATION then
- if ZO_MapPin.TOOLTIP_CREATORS[MAP_PIN_TYPE_LOCATION].tooltip then
- InitializeTooltip(ZO_MapLocationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- ZO_MapPin.TOOLTIP_CREATORS[MAP_PIN_TYPE_LOCATION].creator(pin.m_Pin)
- IsCurrentLocation(pin)
- return
- end
- elseif ZO_MapPin.GROUP_PIN_TYPES[pin.m_PinType] then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendUnitName(pin.unitTag)
- IsCurrentLocation(pin)
- return
- -- world events and dragons
- elseif pin.context ~= nil then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendUnitName(pin.unitTag)
- IsCurrentLocation(pin)
- return
- elseif pin.m_PinType >= MAP_PIN_TYPE_INVALID then -- has to stay on bottom
- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType] then
- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].tooltip and
- ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].creator then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].creator(pin.mpin)
- IsCurrentLocation(pin)
- return
- end
- end
- end
- end
- end
- local function PinOnMouseUp(pin)
- FyrMM.SetTargetScale(pin, 1.3)
- if not FyrMM.SV.PinTooltips then
- return
- end
- if pin.m_PinType ~= nil then
- if QUEST_PIN_TYPES[pin.m_PinType] then
- ProcessQuestPinClick(pin)
- FyrMM.UpdateQuestPins()
- end
- if ZO_MapPin.FAST_TRAVEL_WAYSHRINE_PIN_TYPES[pin.m_PinType] then
- if not IsInAvAZone() and FyrMM.SV.FastTravelEnabled then
- if IsCurrentLocation(pin.m_Pin) then
- return
- end -- No need to recall if player is near wayshrine
- local nodeIndex = pin.m_Pin:GetFastTravelNodeIndex()
- ZO_Dialogs_ReleaseDialog("FAST_TRAVEL_CONFIRM")
- local name = select(2, GetFastTravelNodeInfo(nodeIndex))
- ZO_Dialogs_ShowDialog("FAST_TRAVEL_CONFIRM", {
- nodeIndex = nodeIndex,
- recall = true
- }, {
- mainTextParams = { name }
- })
- end
- end
- end
- end
- local function BorderPinOnMouseExit(pin)
- if pin == nil then
- return
- end
- if pin.pin == nil then
- return
- end
- FyrMM.SetTargetScale(pin, 1)
- if pin.pin.m_PinType then
- if pin.pin.m_PinType == MAP_PIN_TYPE_LOCATION then
- ClearTooltip(ZO_MapLocationTooltip)
- else
- ClearTooltip(InformationTooltip)
- end
- else
- if pin.pin.borderInformation ~= nil then
- ClearTooltip(InformationTooltip)
- end
- end
- end
- local function BorderPinOnMouseEnter(pin)
- if pin.pin == nil then
- RemoveBorderPin(pin)
- return
- end
- FyrMM.SetTargetScale(pin, 1.3)
- if not FyrMM.SV.PinTooltips then
- return
- end
- if pin.pin.borderInformation ~= nil then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendDigSiteAntiquities(pin.pin.Tag)
- IsCurrentLocation(pin.pin)
- return
- end
- if pin.pin.m_PinType then
- if pin.pin.m_PinType == MAP_PIN_TYPE_LOCATION then
- if ZO_MapPin.TOOLTIP_CREATORS[MAP_PIN_TYPE_LOCATION].tooltip then
- InitializeTooltip(ZO_MapLocationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- ZO_MapPin.TOOLTIP_CREATORS[MAP_PIN_TYPE_LOCATION].creator(pin.pin.m_Pin)
- end
- IsCurrentLocation(pin.pin)
- return
- else
- if ZO_MapPin.FAST_TRAVEL_WAYSHRINE_PIN_TYPES[pin.pin.m_PinType] then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- SetTooltipMessage(pin.pin.m_Pin)
- return
- end
- if pin.pin.IsTreasure or pin.pin.IsAvailableQuest then
- if ZO_MapPin.TOOLTIP_CREATORS[pin.pin.m_PinType] == nil then
- return
- end
- if ZO_MapPin.TOOLTIP_CREATORS[pin.pin.m_PinType].tooltip then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- end
- ZO_MapPin.TOOLTIP_CREATORS[pin.pin.m_PinType].creator(pin.pin.mpin)
- IsCurrentLocation(pin.pin)
- return
- end
- if pin.pin.m_PinType == MAP_PIN_TYPE_GROUP or pin.pin.m_PinType == MAP_PIN_TYPE_GROUP_LEADER then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendUnitName(pin.pin.unitTag)
- IsCurrentLocation(pin.pin)
- return
- end
- if ZO_MapPin.MAP_PING_PIN_TYPES[pin.pin.m_PinType] then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendMapPing(pin.pin.m_PinType, "player")
- IsCurrentLocation(pin.pin)
- end
- if QUEST_PIN_TYPES[pin.pin.m_PinType] then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendQuestCondition(GetQuestData(pin.pin))
- IsCurrentLocation(pin.pin)
- end
- end
- end
- end
- local function SetBorderPinHandlers(pin)
- if pin == nil then
- local l
- for i = 1, Fyr_MM_Axis_Border_Pins:GetNumChildren() + 50 do
- l = GetControl("Fyr_MM_Axis_Border_Pins_Pin" .. tostring(i))
- if l ~= nil then
- if l.pin ~= nil then
- if CustomWaypoints[l.pin.m_PinType] then
- RemoveBorderPin(l)
- end
- end
- else
- return
- end
- end
- return
- end
- pin:SetHandler("OnMouseEnter", BorderPinOnMouseEnter)
- pin:SetHandler("OnMouseExit", BorderPinOnMouseExit)
- pin:SetMouseEnabled(true)
- end
- function FyrMM.CreateBorderPin(pin) -- Should have been called create / update border pin
- if pin == nil then
- return
- end
- if pin.m_PinType == nil then
- return
- end
- local borderpin
- local pdata = ZO_MapPin.PIN_DATA[pin.m_PinType]
- local bpsize
- if pin.m_PinType == 9999 then -- Elder Scroll aura
- bpsize = 64
- elseif pdata == nil or pdata.size == nil then
- bpsize = 32
- else
- bpsize = pdata.size
- end
- if not FyrMM.IsValidBorderPin(pin) then
- if pin.BorderPin ~= nil then
- RemoveBorderPin(pin.BorderPin)
- end
- return
- end
- local mmWidth, mmHeight = Fyr_MM:GetDimensions()
- local mmX, mmY = Fyr_MM_Player:GetRight(), Fyr_MM_Player:GetTop()
- local pinX, pinY = math.abs(pin:GetRight() - mmX), math.abs(pin:GetTop() - mmY)
- local m = 0
- if pinX ~= 0 then
- m = pinY / pinX
- end
- local D = mmWidth / 2 - ((38 / 512) * mmWidth)
- local newX, newY
- local na = math.atan((mmWidth / 2) / (mmHeight / 2))
- local nb = pi * 0.5 - na
- local pa = math.atan(pinX / (pinY))
- local pb = pi * 0.5 - pa
- if not pin.BorderPin then -- pin.OnBorder
- local index = GetNewBorderPinIndex()
- borderpin = GetControl("Fyr_MM_Axis_Border_Pin" .. tostring(index))
- if borderpin == nil then
- borderpin = WINDOW_MANAGER:CreateControl("Fyr_MM_Axis_Border_Pin" .. tostring(index),
- Fyr_MM_Axis_Border_Pins, CT_TEXTURE)
- end
- pin.BorderPin = borderpin
- borderpin.pin = pin
- SetBorderPinHandlers(borderpin)
- else
- borderpin = pin.BorderPin
- end
- SetBorderPinHandlers(borderpin)
- pin.OnBorder = true
- borderpin:SetTexture(GetTextureForBorderPin(pin))
- -- antiquities
- if pin.borderInformation ~= nil then
- local antiquityIds = { GetInProgressAntiquitiesForDigSite(pin.Tag) }
- for index, antiquityId in pairs(antiquityIds) do -- removed ipairs for pairs here
- local antiquityData = ANTIQUITY_DATA_MANAGER:GetAntiquityData(antiquityId)
- if not antiquityData:IsInCurrentPlayerZone() then
- RemoveCustomPin(pin)
- break
- end -- fix for antiquities border pins of other zones showing
- local c = GetAntiquityQualityColor(antiquityData:GetQuality())
- if c.r ~= nil then
- borderpin:SetColor(c.r, c.g, c.b, c.a) -- last antiquityId gets the digsite quality color *shrug*
- else
- borderpin:SetColor(1, 1, 1, 1)
- end
- end
- -- group leader colour
- elseif pin.isLeader then
- borderpin:SetColor(FyrMM.SV.LeaderDeadPinColor.r, FyrMM.SV.LeaderDeadPinColor.g, FyrMM.SV.LeaderDeadPinColor.b,
- 1)
- -- coloured custom pins
- elseif pin.m_PinType ~= nil and pin.context == nil and not (pin.m_PinTag and pin.m_PinTag.isZoneStory) then
- if pin.tint then -- compatibility with addons which modify pin colors by pin
- if type(pin.tint) ~= "function" then
- borderpin:SetColor(pin.tint:UnpackRGBA())
- else
- if type(pin.tint) == "table" then
- borderpin:SetColor(pin.tint.r, pin.tint.g, pin.tint.b, pin.tint.a)
- end
- end
- elseif ZOpinData[pin.m_PinType].tint ~= nil then
- if type(ZOpinData[pin.m_PinType].tint) ~= "function" then
- borderpin:SetColor(ZOpinData[pin.m_PinType].tint:UnpackRGBA())
- else
- if borderpin.pin.m_Pin ~= nil then
- borderpin:SetColor(ZOpinData[pin.m_PinType].tint(borderpin.pin.m_Pin):UnpackRGBA())
- elseif borderpin.pin ~= nil then
- borderpin:SetColor(ZOpinData[pin.m_PinType].tint(borderpin.pin):UnpackRGBA())
- else
- borderpin:SetColor(1, 1, 1, 1)
- end
- end
- else
- borderpin:SetColor(1, 1, 1, 1)
- end
- end
- if pin.color then
- borderpin:SetColor(pin.color[1], pin.color[2], pin.color[3], 1)
- end
- if pinX > 0 and pinY > 0 then
- if pa <= na then
- if pin:GetRight() >= mmX then
- newX = mmWidth / 2 + mmHeight / 2 * math.sin(pa) / math.sin(pi * 0.5 - pa)
- else
- newX = mmWidth / 2 - mmHeight / 2 * math.sin(pa) / math.sin(pi * 0.5 - pa)
- end
- if pin:GetTop() < mmY then
- newY = 4
- else
- newY = mmHeight - (bpsize * FyrMM.pScalePercent) / 2 + 2
- end
- else
- if pin:GetRight() > mmX then
- newX = mmWidth - (bpsize * FyrMM.pScalePercent) / 2 + 4
- else
- newX = 2
- end
- pa = pi * 0.5 - (pa - na)
- if pin:GetTop() <= mmY then
- newY = mmHeight / 2 - mmWidth / 2 * math.sin(pa - na) / math.sin(pi * 0.5 - (pa - na))
- else
- newY = mmHeight / 2 + mmWidth / 2 * math.sin(pa - na) / math.sin(pi * 0.5 - (pa - na))
- end
- end
- if pin.m_PinType == MAP_PIN_TYPE_GROUP then
- FyrMM.SetPinSize(borderpin, pin:GetDimensions())
- else
- FyrMM.SetPinSize(borderpin, bpsize * FyrMM.pScalePercent, 0)
- end
- if FyrMM.SV.WheelMap then
- if pin:GetRight() >= mmX and pin:GetTop() >= mmY then
- newX = D / math.sqrt(1 + m * m) + mmWidth / 2
- newY = (m * D) / math.sqrt(1 + m * m) + mmHeight / 2
- end
- if pin:GetRight() >= mmX and pin:GetTop() < mmY then
- newX = D / math.sqrt(1 + m * m) + mmWidth / 2
- newY = mmWidth / 2 - (m * D) / math.sqrt(1 + m * m)
- end
- if pin:GetRight() < mmX and pin:GetTop() < mmY then
- newX = mmWidth / 2 - D / math.sqrt(1 + m * m)
- newY = mmWidth / 2 - (m * D) / math.sqrt(1 + m * m)
- end
- if pin:GetRight() < mmX and pin:GetTop() >= mmY then
- newX = mmWidth / 2 - D / math.sqrt(1 + m * m)
- newY = (m * D) / math.sqrt(1 + m * m) + mmWidth / 2
- end
- end
- borderpin:SetHidden(false)
- borderpin:ClearAnchors()
- borderpin:SetAnchor(CENTER, Fyr_MM_Axis_Control, TOPLEFT, newX, newY)
- -- animated world events
- if pin.context ~= nil then
- borderpin:SetColor(1, 1, 1, 1)
- if ZO_MapPin.WORLD_EVENT_UNIT_PIN_TYPES[pin.m_PinType] then
- if IsUnitInCombat(pin.unitTag) then
- borderpin:SetColor(1, 0, 0, 1)
- FyrMM.CheapAnimation(borderpin)
- end
- else
- FyrMM.CheapAnimation(borderpin, true)
- end
- else
- borderpin:SetTransformRotationZ(0)
- end
- if pin.m_PinTag and (pin.m_PinTag.isZoneStory or ZO_MapPin.SUGGESTION_PIN_TYPES[pin.m_PinType]) then
- borderpin:SetColor(1, 1, 1, 1)
- FyrMM.SetPinSize(borderpin, 48 * FyrMM.pScalePercent, 0)
- end
- borderpin:SetDrawLevel(pin:GetDrawLevel())
- borderpin:SetDrawTier(pin:GetDrawTier())
- borderpin:SetDrawLayer(pin:GetDrawLayer())
- -- if pdata.isAnimated then -- removed animated BORDERPINS to test
- -- if not borderpin.textureAntl then
- -- local an
- -- an, borderpin.textureAntl = CreateSimpleAnimation(ANIMATION_TEXTURE, borderpin)
- -- an:SetHandler("OnStop", function() borderpin:SetTextureCoords(0, 1, 0, 1) end)
- -- end
- -- local anim = borderpin.textureAntl:GetAnimation(1)
- -- anim:SetImageData(pdata.framesWide, pdata.framesHigh)
- -- anim:SetFramerate(pdata.framesPerSecond)
- -- borderpin.textureAntl:SetPlaybackType(ANIMATION_PLAYBACK_LOOP, LOOP_INDEFINITELY)
- -- borderpin.textureAntl:PlayFromStart()
- -- end
- end
- if (pin.nX and pin.nY) or (pin.normalizedX and pin.normalizedY) then -- fade distant pin texture
- local nX = pin.nX or pin.normalizedX
- local nY = pin.nY or pin.normalizedY
- local distance = CurrentMap.TrueMapSize *
- math.sqrt(
- (nX - CurrentMap.PlayerNX) * (nX - CurrentMap.PlayerNX) + (nY - CurrentMap.PlayerNY) *
- (nY - CurrentMap.PlayerNY)) or 1
- if distance > 650 then
- distance = 650
- end
- local iDistance = 650 - distance
- local minVal1 = 0 -- min distance value
- local maxVal1 = 650 -- max distance value
- local minVal2 = 0.6 -- min alpha
- local maxVal2 = 1 -- max alpha
- local alpha = ((maxVal2 - minVal2) * (((iDistance) - (minVal1)) / ((maxVal1) - (minVal1)))) + minVal2
- -- d("alpha "..alpha.." distance "..distance)
- borderpin:SetAlpha(alpha)
- else
- borderpin:SetAlpha(1)
- end
- return borderpin
- end
- function FyrMM.PlaceBorderPins()
- local i, j, l, v
- if ((not FyrMM.Visible or Fyr_MM:IsHidden())) then
- return
- end
- for i = 1, Fyr_MM_Axis_Border_Pins:GetNumChildren() do
- l = Fyr_MM_Axis_Border_Pins:GetChild(i)
- if l ~= nil then
- if FyrMM.SV.BorderPins then
- if not l.pin then
- l:SetHidden(true)
- else
- if not FyrMM.IsValidBorderPin(l.pin) then
- RemoveBorderPin(l)
- end
- end
- else
- RemoveBorderPin(l)
- end
- end
- end
- if not FyrMM.SV.BorderPins then
- return
- end
- -- border pins for moving or interesting AVA & Battleground pins
- if (not IsInAvAZone() and not IsActiveWorldBattleground()) and AVABGobjectivesToBorderPins then
- AVABGobjectivesToBorderPins = nil
- end
- if FyrMM.SV.borderAVABG then
- local bgContext = ZO_WorldMap_GetBattlegroundQueryType()
- if AVABGobjectivesToBorderPins and not IsTableEmpty(AVABGobjectivesToBorderPins) then
- for i, v in pairs(AVABGobjectivesToBorderPins) do
- if v ~= nil then
- local type = GetObjectiveType(v.keepId, v.objectiveId, bgContext)
- local objectiveControlState = GetObjectiveControlState(v.keepId, v.objectiveId, bgContext)
- local exists = DoesObjectiveExist(v.keepId, v.objectiveId, bgContext)
- local visible = IsObjectiveObjectVisible(v.keepId, v.objectiveId, bgContext)
- local gameType = GetBattlegroundGameType(GetCurrentBattlegroundId())
- if exists and visible then
- local daedricWeapon = type == OBJECTIVE_DAEDRIC_WEAPON and objectiveControlState ~=
- OBJECTIVE_CONTROL_STATE_UNKNOWN
- local elderScroll = (type == OBJECTIVE_ARTIFACT_DEFENSIVE or type ==
- OBJECTIVE_ARTIFACT_OFFENSIVE or type == OBJECTIVE_ARTIFACT_RETURN) and
- (objectiveControlState == OBJECTIVE_CONTROL_STATE_FLAG_HELD or
- objectiveControlState == OBJECTIVE_CONTROL_STATE_FLAG_DROPPED)
- local captureTheRelicRelic = type == OBJECTIVE_FLAG_CAPTURE
- local captureTheRelicOwnBase = v.AVABGtype == "spawn"
- local showAllWithThisGameType = gameType == BATTLEGROUND_GAME_TYPE_DOMINATION or gameType ==
- BATTLEGROUND_GAME_TYPE_CRAZY_KING or gameType ==
- BATTLEGROUND_GAME_TYPE_MURDERBALL
- if daedricWeapon or elderScroll or captureTheRelicRelic or captureTheRelicOwnBase or
- showAllWithThisGameType then
- v.size = 32
- if elderScroll then
- v.size = 80
- end
- if battlegroundMovingPins then
- v.size = 64
- end
- FyrMM.CreateBorderPin(v)
- else
- if v.BorderPin ~= nil then
- RemoveBorderPin(v.BorderPin)
- end
- end
- else
- if v.BorderPin ~= nil then
- RemoveBorderPin(v.BorderPin)
- end
- end
- end
- end
- end
- end
- -- waypoints
- FyrMM.PlaceWaypointBorderPins()
- -- border pins
- if Fyr_MM_Axis_Control:IsHidden() and FyrMM.SV.BorderPins then
- Fyr_MM_Axis_Control:SetHidden(false)
- end
- -- quest pins
- for i, v in pairs(QuestPins) do
- if not v.Pin:IsHidden() and FyrMM.IsValidBorderPin(v.Pin) then
- FyrMM.CreateBorderPin(v.Pin)
- end
- end
- -- group pins
- for i = 1, 24 do
- l = GetControl("Fyr_MM_Scroll_Map_Pinsgroup" .. tostring(i))
- if l ~= nil then
- if not l:IsHidden() and FyrMM.IsValidBorderPin(l) then
- FyrMM.CreateBorderPin(l)
- end
- end
- end
- -- Bank - stables - crafting - community leveling guides
- if FyrMM.SV.BorderPinsBank or FyrMM.SV.BorderPinsStables or FyrMM.SV.BorderCrafting or FyrMM.SV.UseOriginalAPI then
- for i = 1, FyrMM.currentLocationsCount do
- l = GetControl("Fyr_MM_Scroll_Map_LocationPins_Pin" .. tostring(i))
- if l ~= nil then
- if l.m_PinType == MAP_PIN_TYPE_LOCATION and FyrMM.IsValidBorderPin(l) then
- FyrMM.CreateBorderPin(l)
- elseif l.isZGESO and FyrMM.IsValidBorderPin(l) then
- l.m_PinType = MAP_PIN_TYPE_LOCATION
- FyrMM.CreateBorderPin(l)
- end
- end
- end
- end
- -- wayshrines
- if FyrMM.SV.BorderWayshrine and FyrMM.currentWayshrineCount > 0 then
- for i, v in ipairs(Wayshrines) do
- if v.Closest then
- l = GetControl("Fyr_MM_Scroll_Map_WayshrinePins_Pin" .. tostring(i))
- if l ~= nil then
- FyrMM.CreateBorderPin(l)
- end
- end
- end
- end
- -- treasures and antiquities
- if FyrMM.SV.BorderTreasures then
- if not IsTableEmpty(Treasures) then
- for i, v in pairs(Treasures) do
- if v ~= nil then
- if v.IsTreasure then
- FyrMM.CreateBorderPin(v)
- end
- end
- end
- end
- end
- -- Dragon next location
- if FyrMM.SV.WorldEvents then
- if not IsTableEmpty(DragonNextLocation) then
- for i, v in pairs(DragonNextLocation) do
- if v ~= nil then
- if v.IsDragonNextLocation then
- FyrMM.CreateBorderPin(v)
- end
- end
- end
- end
- end
- -- digsites
- if not IsTableEmpty(Digsites) then
- for i, v in pairs(Digsites) do
- if v ~= nil then
- if v.borderInformation ~= nil then
- FyrMM.CreateBorderPin(v)
- end
- end
- end
- end
- -- Quest givers
- if FyrMM.SV.BorderQuestGivers and not IsTableEmpty(FyrMM.AvailableQuestGivers) then
- if #FyrMM.AvailableQuestGivers <= 5 then
- for i, v in pairs(FyrMM.AvailableQuestGivers) do
- if v ~= nil then
- if v.IsAvailableQuest then
- FyrMM.CreateBorderPin(v)
- end
- end
- end
- else
- if not IsTableEmpty(AQGList) then
- for i = 1, 5 do
- if AQGList[i] ~= nil then
- FyrMM.CreateBorderPin(AQGList[i])
- end
- end
- end
- end
- end
- end
- function FyrMM.PlaceWaypointBorderPins()
- SetBorderPinHandlers()
- if FyrMM.SV.BorderPinsWaypoint then
- if FyrMM.IsWaypoint then
- if not FyrMM.Waypoint:IsHidden() or not Is_PinInsideWheel(FyrMM.Waypoint) then
- FyrMM.CreateBorderPin(FyrMM.Waypoint)
- if FyrMM.Waypoint.BorderPin then
- FyrMM.Waypoint.BorderPin:SetHandler("OnMouseEnter", BorderPinOnMouseEnter)
- FyrMM.Waypoint.BorderPin:SetHandler("OnMouseExit", BorderPinOnMouseExit)
- FyrMM.Waypoint.BorderPin:SetMouseEnabled(true)
- end
- else
- if FyrMM.Waypoint.BorderPin ~= nil then
- RemoveBorderPin(FyrMM.Waypoint)
- end
- end
- end
- if FyrMM.IsPing then
- if not FyrMM.Ping:IsHidden() or not Is_PinInsideWheel(FyrMM.Ping) then
- FyrMM.CreateBorderPin(FyrMM.Ping)
- if FyrMM.Ping.BorderPin then
- FyrMM.Ping.BorderPin:SetHandler("OnMouseEnter", BorderPinOnMouseEnter)
- FyrMM.Ping.BorderPin:SetHandler("OnMouseExit", BorderPinOnMouseExit)
- FyrMM.Ping.BorderPin:SetMouseEnabled(true)
- end
- else
- if FyrMM.Ping.BorderPin ~= nil then
- RemoveBorderPin(FyrMM.Ping)
- end
- end
- end
- if FyrMM.IsRally then
- if not FyrMM.Rally:IsHidden() or not Is_PinInsideWheel(FyrMM.Rally) then
- FyrMM.CreateBorderPin(FyrMM.Rally)
- if FyrMM.Rally.BorderPin then
- FyrMM.Rally.BorderPin:SetHandler("OnMouseEnter", BorderPinOnMouseEnter)
- FyrMM.Rally.BorderPin:SetHandler("OnMouseExit", BorderPinOnMouseExit)
- FyrMM.Rally.BorderPin:SetMouseEnabled(true)
- end
- else
- if FyrMM.Rally.BorderPin ~= nil then
- RemoveBorderPin(FyrMM.Rally)
- end
- end
- end
- end
- end
- function FyrMM.isSameZone(PinMapId)
- local _, _, _, pinZone = GetMapInfoById(PinMapId)
- local _, _, _, currentMapZone = GetMapInfoById(CurrentMap.MapId)
- if PinMapId == CurrentMap.MapId or pinZone == currentMapZone then
- return true
- else
- return false
- end
- end
- -----------------------------------------------------------------
- -- Pin Clean up
- -----------------------------------------------------------------
- local function CleanupMapLocations()
- local t = GetGameTimeMilliseconds()
- local totalPins = Fyr_MM_Scroll_Map_LocationPins:GetNumChildren()
- if totalPins > FyrMM.currentLocationsCount then
- for i = FyrMM.currentLocationsCount + 1, totalPins do
- local l = GetControl("Fyr_MM_Scroll_Map_LocationPins_Pin" .. tostring(i))
- if l ~= nil then
- if l.BorderPin ~= nil then
- RemoveBorderPin(l.BorderPin)
- end
- l.nX = nil
- l.nY = nil
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- l.m_Pin = nil
- PinsList[l:GetName()] = nil
- end
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "CleanupMapLocations " .. tostring(GetGameTimeMilliseconds() - t))
- end
- end
- local function CleanupWayshrines()
- local t = GetGameTimeMilliseconds()
- local totalPins = Fyr_MM_Scroll_Map_WayshrinePins:GetNumChildren()
- if totalPins > FyrMM.currentWayshrineCount then
- for i = FyrMM.currentWayshrineCount + 1, totalPins do
- local l = GetControl("Fyr_MM_Scroll_Map_WayshrinePins_Pin" .. tostring(i))
- if l ~= nil then
- if l.BorderPin ~= nil then
- RemoveBorderPin(l.BorderPin)
- end
- l.nX = nil
- l.nY = nil
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- l.m_Pin = nil
- PinsList[l:GetName()] = nil
- end
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "CleanupWayshrines " .. tostring(GetGameTimeMilliseconds() - t))
- end
- end
- local function CleanupPOIs()
- local t = GetGameTimeMilliseconds()
- local totalPins = Fyr_MM_Scroll_Map_POIPins:GetNumChildren()
- if totalPins == 0 then
- return
- end
- if CleanPOIs + FyrMM.currentPOICount ~= totalPins then
- -- if totalPins > FyrMM.currentPOICount then
- CleanPOIs = 0
- for i = FyrMM.currentPOICount + 1, totalPins do
- local l = GetControl("Fyr_MM_Scroll_Map_POIPins_Pin" .. tostring(i))
- if l ~= nil then
- l.nX = nil
- l.nY = nil
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- l.m_Pin = nil
- PinsList[l:GetName()] = nil
- CleanPOIs = CleanPOIs + 1
- end
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "CleanupPOIs (" .. tostring(FyrMM.currentPOICount + 1) .. " - " .. tostring(totalPins) .. ") (" .. CleanPOIs ..
- ") " .. tostring(GetGameTimeMilliseconds() - t))
- end
- end
- local function RemoveQuestPin(l)
- if l == nil then
- return
- end
- if l.MM_Tag ~= nil then
- if l.MM_Tag == 1 then
- if l.secondaryPin ~= nil then
- l.secondaryPin.MM_Tag = nil
- RemoveQuestPin(l.secondaryPin)
- end
- if l.tertiaryPin ~= nil then
- l.tertiaryPin.MM_Tag = nil
- RemoveQuestPin(l.tertiaryPin)
- end
- else
- if l.primaryPin ~= nil then
- l.primaryPin.MM_Tag = nil
- RemoveQuestPin(l.primaryPin)
- end
- end
- end
- if l.OnBorder then
- if l.BorderPin then
- l.BorderPin:ClearAnchors()
- l.BorderPin:SetHidden()
- l.BorderPin.pin = nil
- l.BorderPin = nil
- end
- l.OnBorder = nil
- end
- if l.questdataIndex ~= nil then
- if FyrMM.questPinCount > 0 then
- FyrMM.questPinCount = FyrMM.questPinCount - 1
- end
- if QuestPins[l.questdataIndex] ~= nil then
- table.insert(FreeQuestPinIndex, QuestPins[l.questdataIndex].pinIndex)
- end
- QuestPins[l.questdataIndex] = nil
- end
- l:SetParent(Fyr_MM_Scroll_Map_QuestPins)
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- l.questdataIndex = nil
- l.MM_Tag = nil
- l.m_PinTag = nil
- l.m_PinType = nil
- l.m_Pin = nil
- l.normalizedX = nil
- l.normalizedY = nil
- l.radius = nil
- l.MapId = nil
- l.questIndex = nil
- l.questName = nil
- l.PinToolTipText = nil
- l.primaryPin = nil
- l.secondaryPin = nil
- l.tertiaryPin = nil
- l.pinAge = nil
- PinsList[l:GetName()] = nil
- end
- local function ClearDigsiteBlob(digSite)
- digSite.pinType = nil
- digSite.m_PinType = nil
- digSite.Tag = nil
- digSite.nX = nil
- digSite.nY = nil
- digSite.MapId = nil
- digSite.borderInformation = nil
- digSite:SetHidden(true)
- digSite:ClearPoints()
- digSite:ClearAnchors()
- end
- local function CreateDigSiteAreaSidePins(pin, width, height, isTracked)
- local DigSiteAreaSidePinNS
- DigSiteAreaSidePinNS = GetControl("Fyr_MM_Scroll_Map_DigSite" .. tostring(FyrMM.currentDigSiteCount) .. "_NS")
- if DigSiteAreaSidePinNS == nil then
- DigSiteAreaSidePinNS = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_DigSite" ..
- tostring(FyrMM.currentDigSiteCount) .. "_NS",
- Fyr_MM_Scroll_NS_Map_Pins, CT_POLYGON)
- else
- DigSiteAreaSidePinNS:SetParent(Fyr_MM_Scroll_NS_Map_Pins)
- end
- DigSiteAreaSidePinNS.m_PinType = pin.m_PinType
- DigSiteAreaSidePinNS.nX = pin.nX
- DigSiteAreaSidePinNS.nY = pin.nY
- DigSiteAreaSidePinNS.borderInformation = pin.borderInformation
- DigSiteAreaSidePinNS.MapId = pin.MapId
- DigSiteAreaSidePinNS:SetDimensions(width, height)
- DigSiteAreaSidePinNS:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_DIG_SITES))
- local centerColor = isTracked and ZO_MAP_PIN_TRACKED_DIG_SITE_COLOR or ZO_MAP_PIN_DIG_SITE_COLOR
- local r, g, b = centerColor:UnpackRGB()
- local alpha = 0.39
- DigSiteAreaSidePinNS:SetCenterColor(r, g, b, alpha)
- local borderColor = ZO_MAP_PIN_DIG_SITE_BORDER_COLOR
- DigSiteAreaSidePinNS:SetBorderColor(borderColor:UnpackRGBA())
- DigSiteAreaSidePinNS:SetSmoothingEnabled(true)
- DigSiteAreaSidePinNS:SetBorderThickness(3, 3, 0)
- DigSiteAreaSidePinNS:SetShapeType(SHAPE_CIRCLE)
- DigSiteAreaSidePinNS:SetDrawLayer(1)
- FyrMM.SetPinAnchor(DigSiteAreaSidePinNS, DigSiteAreaSidePinNS.nX, DigSiteAreaSidePinNS.nY, Fyr_MM_Scroll_Map_Pins)
- if FyrMM.SV.WheelMap then
- DigSiteAreaSidePinNS:SetParent(Fyr_MM_Scroll_NS_Map_Pins)
- end
- DigSiteAreaSidePinNS:SetHandler("OnMouseUp", PinOnMouseUp)
- DigSiteAreaSidePinNS:SetHandler("OnMouseEnter", PinOnMouseEnter)
- DigSiteAreaSidePinNS:SetHandler("OnMouseExit", PinOnMouseExit)
- SetDigSitePoints(DigSiteAreaSidePinNS)
- local DigSiteAreaSidePinWE
- DigSiteAreaSidePinWE = GetControl("Fyr_MM_Scroll_Map_DigSite" .. tostring(FyrMM.currentDigSiteCount) .. "_WE")
- if DigSiteAreaSidePinWE == nil then
- DigSiteAreaSidePinWE = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_DigSite" ..
- tostring(FyrMM.currentDigSiteCount) .. "_WE",
- Fyr_MM_Scroll_WE_Map_Pins, CT_POLYGON)
- else
- DigSiteAreaSidePinWE:SetParent(Fyr_MM_Scroll_WE_Map_Pins)
- end
- DigSiteAreaSidePinWE.m_PinType = pin.m_PinType
- DigSiteAreaSidePinWE.nX = pin.nX
- DigSiteAreaSidePinWE.nY = pin.nY
- DigSiteAreaSidePinWE.borderInformation = pin.borderInformation
- DigSiteAreaSidePinWE.MapId = pin.MapId
- DigSiteAreaSidePinWE:SetDimensions(width, height)
- DigSiteAreaSidePinWE:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_DIG_SITES))
- DigSiteAreaSidePinWE:SetCenterColor(r, g, b, alpha)
- DigSiteAreaSidePinWE:SetBorderColor(borderColor:UnpackRGBA())
- DigSiteAreaSidePinWE:SetSmoothingEnabled(true)
- DigSiteAreaSidePinWE:SetBorderThickness(3, 3, 0)
- DigSiteAreaSidePinWE:SetShapeType(SHAPE_CIRCLE)
- DigSiteAreaSidePinWE:SetDrawLayer(1)
- FyrMM.SetPinAnchor(DigSiteAreaSidePinWE, DigSiteAreaSidePinWE.nX, DigSiteAreaSidePinWE.nY, Fyr_MM_Scroll_Map_Pins)
- if FyrMM.SV.WheelMap then
- DigSiteAreaSidePinWE:SetParent(Fyr_MM_Scroll_WE_Map_Pins)
- end
- DigSiteAreaSidePinWE:SetHandler("OnMouseUp", PinOnMouseUp)
- DigSiteAreaSidePinWE:SetHandler("OnMouseEnter", PinOnMouseEnter)
- DigSiteAreaSidePinWE:SetHandler("OnMouseExit", PinOnMouseExit)
- SetDigSitePoints(DigSiteAreaSidePinWE)
- end
- local function CreateDigSiteBlob(DigsiteId)
- local centerX, centerZ, isShownInCurrentMap = GetDigSiteNormalizedCenterPosition(DigsiteId)
- if isShownInCurrentMap then
- local isTracked = IsDigSiteAssociatedWithTrackedAntiquity(DigsiteId)
- local points = {}
- local minX = 1.0
- local maxX = 0.0
- local minY = 1.0
- local maxY = 0.0
- local borderPoints = { GetDigSiteNormalizedBorderPoints(DigsiteId) }
- for i = 1, #borderPoints, 2 do -- loop by 2 because we are getting x and z coordinates
- local x = borderPoints[i]
- local y = borderPoints[i + 1] -- UI is going to treat z as y
- minX = zo_min(x, minX)
- maxX = zo_max(x, maxX)
- minY = zo_min(y, minY)
- maxY = zo_max(y, maxY)
- local coordinates = {
- x = x,
- y = y
- }
- table.insert(points, coordinates)
- end
- for index, coordinates in ipairs(points) do
- coordinates.x = zo_normalize(coordinates.x, minX, maxX)
- coordinates.y = zo_normalize(coordinates.y, minY, maxY)
- end
- local borderInformation = {
- borderPoints = points,
- borderWidth = maxX - minX,
- borderHeight = maxY - minY
- }
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- local digSite
- FyrMM.currentDigSiteCount = FyrMM.currentDigSiteCount + 1
- digSite = GetControl("Fyr_MM_Scroll_Map_DigSite" .. tostring(FyrMM.currentDigSiteCount))
- if digSite == nil then
- digSite = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_DigSite" .. tostring(FyrMM.currentDigSiteCount),
- Fyr_MM_Scroll_Map_Pins, CT_POLYGON)
- digSite.nDistance = function(self)
- if self.nX == nil then
- return 1
- end
- return math.sqrt((zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) +
- (zo_round(CurrentMap.PlayerNY * 10000) - zo_round(self.nY * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nY * 10000))) / 10000
- end
- digSite:SetMouseEnabled(true)
- digSite:SetHandler("OnMouseEnter", PinOnMouseEnter)
- digSite:SetHandler("OnMouseExit", PinOnMouseExit)
- digSite:SetHandler("OnMouseUp", PinOnMouseUp)
- end
- digSite.pinType = isTracked and MAP_PIN_TYPE_TRACKED_ANTIQUITY_DIG_SITE or MAP_PIN_TYPE_ANTIQUITY_DIG_SITE
- digSite.Tag = DigsiteId
- digSite.nX = centerX
- digSite.nY = centerZ
- SetMapToDigSitePosition(DigsiteId)
- digSite.MapId = CurrentMap.MapId
- FyrMM.SetMapToPlayerLocation()
- digSite.borderInformation = borderInformation
- digSite.m_PinType = digSite.pinType
- digSite:SetDrawLayer(1)
- local width = borderInformation.borderWidth * mWidth
- local height = borderInformation.borderHeight * mHeight
- digSite:SetDimensions(width, height)
- local centerColor = isTracked and ZO_MAP_PIN_TRACKED_DIG_SITE_COLOR or ZO_MAP_PIN_DIG_SITE_COLOR
- local r, g, b = centerColor:UnpackRGB()
- local alpha = 0.39
- digSite:SetCenterColor(r, g, b, alpha)
- local borderColor = ZO_MAP_PIN_DIG_SITE_BORDER_COLOR
- digSite:SetBorderColor(borderColor:UnpackRGBA())
- digSite:SetSmoothingEnabled(true)
- digSite:SetBorderThickness(3, 3, 0)
- digSite:SetShapeType(SHAPE_CIRCLE)
- FyrMM.SetPinAnchor(digSite, centerX, centerZ, Fyr_MM_Scroll_Map_Pins)
- if FyrMM.SV.WheelMap then -- root of the problem was here
- if FyrMM.SV.RotateMap then
- digSite:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- else
- digSite:SetParent(FyrMM.GetScrollObject(digSite))
- -- FyrMM.SetPinAnchor(digSite, centerX, centerZ, Fyr_MM_Scroll_CW_Map_Pins)
- end
- CreateDigSiteAreaSidePins(digSite, width, height, isTracked)
- end
- digSite:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_DIG_SITES))
- SetDigSitePoints(digSite)
- table.insert(Digsites, digSite)
- end
- end
- function FyrMM.UpdateAntiquityDigSites()
- if FyrMM.currentDigSiteCount > 0 then
- Digsites = {}
- for i = 1, FyrMM.currentDigSiteCount, 1 do
- local digSite = GetControl("Fyr_MM_Scroll_Map_DigSite" .. tostring(i))
- local digSiteNS = GetControl("Fyr_MM_Scroll_Map_DigSite" .. tostring(i) .. "_NS")
- local digSiteWE = GetControl("Fyr_MM_Scroll_Map_DigSite" .. tostring(i) .. "_WE")
- ClearDigsiteBlob(digSite)
- if FyrMM.SV.WheelMap then
- if digSiteNS then
- ClearDigsiteBlob(digSiteNS)
- end
- if digSiteWE then
- ClearDigsiteBlob(digSiteWE)
- end
- end
- end
- end
- FyrMM.currentDigSiteCount = 0
- local numInprogress = GetNumInProgressAntiquities()
- for antiquityIndex = 1, numInprogress, 1 do
- local numDigSites = GetNumDigSitesForInProgressAntiquity(antiquityIndex)
- if numDigSites > 0 then
- if numDigSites == 1 then
- local digSiteId = GetInProgressAntiquityDigSiteId(antiquityIndex, 1)
- if digSiteId > 0 then
- CreateDigSiteBlob(digSiteId)
- end
- else
- for digSiteIndex = 1, numDigSites, 1 do
- local digSiteId = GetInProgressAntiquityDigSiteId(antiquityIndex, digSiteIndex)
- if digSiteId > 0 then
- CreateDigSiteBlob(digSiteId)
- end
- end
- end
- end
- end
- end
- function FyrMM.RemoveInvalidQuestPins()
- local t = GetGameTimeMilliseconds()
- local _
- local compleate
- for i, v in pairs(QuestPins) do
- local l = v.Pin
- if l ~= nil then
- if not l:IsHidden() then
- local a = l.m_PinTag[1]
- local b = l.m_PinTag[3]
- local c = l.m_PinTag[2]
- local qi = l.questIndex
- if l.questIndex ~= nil then
- if not IsValidQuestIndex(qi) or GetJournalQuestName(qi) ~= l.questName then
- RemoveQuestPin(l)
- else
- if l.m_PinTag ~= nil and l.PinToolTipText ~= nil then
- if l.PinToolTipText ~= GenerateQuestConditionTooltipLine(a, b, c) then
- RemoveQuestPin(l)
- else
- _, _, _, _, compleate, _ = GetJournalQuestConditionInfo(a, b, c)
- if compleate then
- RemoveQuestPin(l)
- end
- end
- else
- RemoveQuestPin(l)
- end
- end
- else
- RemoveQuestPin(l)
- end
- end
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "RemoveInvalidQuestPins " .. tostring(GetGameTimeMilliseconds() - t))
- end
- end
- function FyrMM.UpdateLabels(eventCode, zoneName, subZoneName, newSubzone, someID, subzoneId)
- if not FyrMM.SV then
- return
- end -- too soon
- if Fyr_MM:IsHidden() then
- Fyr_MM_ZoneFrame:SetHidden(true)
- return
- end
- local currentMapName, _ = string.gsub(GetMapName(), "(%w+)[%^]+.*", "%1")
- local currentAreaName = string.gsub(GetPlayerLocationName(), "(%w+)[%^]+.*", "%1")
- if not FyrMM.SV.ZoneNameContents ~= nil then
- if FyrMM.SV.ZoneNameContents == "Classic (Map only)" then
- Fyr_MM_Zone:SetText(currentMapName)
- elseif FyrMM.SV.ZoneNameContents == "Map & Area" then
- if currentMapName ~= currentAreaName then
- Fyr_MM_Zone:SetText(currentMapName .. "\n" .. currentAreaName)
- else
- Fyr_MM_Zone:SetText(currentMapName)
- end
- else
- Fyr_MM_Zone:SetText(currentAreaName)
- end
- else
- Fyr_MM_Zone:SetText(currentMapName)
- end
- local zoneWidth, zoneHeight = Fyr_MM_Zone:GetTextDimensions() or 100, 20
- if string.find(Fyr_MM_Zone:GetText(), "\n") then
- zoneHeight = zoneHeight * 2
- end
- Fyr_MM_ZoneFrame:SetDimensions(zoneWidth + 10, zoneHeight + 3)
- if FyrMM.SV.ZoneFrameLocationOption == "Free" then
- Fyr_MM_ZoneFrame:ClearAnchors()
- Fyr_MM_ZoneFrame:SetAnchor(MM_GetZoneFrameAnchor())
- end
- Fyr_MM_ZoomLevel:SetText(tostring(CurrentMap.ZoomLevel))
- end
- -----------------------------------------------------------------
- -- Updates
- -----------------------------------------------------------------
- function FyrMM.GetMapMeasureMultiplier()
- -- Based on assumption that player constantly moves at the same speed anywhere - world size has to be adjusted to match it. According to Tamriel distance difference for some specific maps I made a few adjustments for the worldsizes while in those maps.
- -- Maps like Auridon or Glenumbra indicate same player speeds while Cyrodiil, Craglorn and starting maps show compleately different speeds (for mapsize 33440)
- local mapIndex = GetCurrentMapIndex()
- local multiplier = 1
- -- walking = 2.00/2.03 m/s
- -- if mapIndex == 14 then -- cyrodiil
- -- multiplier = 2.2
- -- elseif mapIndex == 18 then -- Bal foyen
- -- multiplier = 1 --1.353
- -- elseif mapIndex == 19 then -- stros m'kai
- -- multiplier = 2.6
- -- elseif mapIndex == 21 then -- kenarthi's roost
- -- multiplier = 2.4865
- -- elseif mapIndex == 22 then -- Bleakrock isle
- -- multiplier = 1 --3.1
- -- elseif mapIndex == 25 then -- craglorn
- -- multiplier = 1 --1.087
- if mapIndex == 39 then -- Greymoor Caverns
- multiplier = 4.5
- end
- -- alik'r, artaeum, auridon, Bal foyen, Bangkorai , Betnikh, Arkhzand cavern, Blackwood, Bleakrock, clockwork city, craglorn, deshaan, eastmarch,
- -- fargrave, glenumbra, gold coast, grahtwood, greenshade, hew's bane, high isle, kenarthi's roost, malabal tor, murkmire, northern elsweyr
- -- reaper's march, rivenspire, shadowfen, southern elsweyr, stonefalls, stormhaven, stros m'kai, summerset, the deadlands, the reach
- -- the rift, western skyrim, wrothgar are multiplier = 1
- return multiplier
- end
- function FyrMM.MeasureDistance()
- if not FyrMM.MeasureMaps then
- return
- end
- if CurrentMap.TrueMapSize and CurrentMap.TrueMapSize > 1 then
- FyrMM.DistanceMeasurementStarted = false
- return
- end
- local _
- FyrMM.SetMapToPlayerLocation()
- FyrMM.MeasurementXl, FyrMM.MeasurementYl, _ = GetMapPlayerPosition("player")
- local mapIndex = GetCurrentMapIndex()
- if mapIndex == nil then
- MapZoomOut()
- mapIndex = GetCurrentMapIndex()
- end
- if mapIndex ~= 23 then
- SetMapToMapListIndex(1)
- end
- FyrMM.MeasurementX, FyrMM.MeasurementY, _ = GetMapPlayerPosition("player")
- FyrMM.DistanceMeasurementStarted = true
- FyrMM.SetMapToPlayerLocation()
- zo_callLater(FyrMM.FinishDistanceMeasurement, 5000)
- end
- function FyrMM.FinishDistanceMeasurement()
- if Fyr_MM:IsHidden() or FyrMM.worldMapShowing then
- return
- end
- FyrMM.DistanceMeasurementStarted = false
- if CurrentMap.TrueMapSize > 1 then
- return
- end
- local x, y = FyrMM.MeasurementX, FyrMM.MeasurementY
- FyrMM.SetMapToPlayerLocation()
- local xl, yl = FyrMM.MeasurementXl, FyrMM.MeasurementYl
- local x2l, y2l, _ = GetMapPlayerPosition("player")
- local mapIndex = GetCurrentMapIndex()
- if mapIndex == nil then
- MapZoomOut()
- mapIndex = GetCurrentMapIndex()
- end
- local worldsize, multiplier
- if mapIndex ~= 23 then -- not coldharbour
- SetMapToMapListIndex(1)
- worldsize = 33440 -- Assumed Tamriel size in feet taken from ZygorGuides
- else
- worldsize = 5684 -- Assumed Coldharbour size in feet
- end
- local multiplier = FyrMM.GetMapMeasureMultiplier()
- local x2, y2, _ = GetMapPlayerPosition("player")
- FyrMM.SetMapToPlayerLocation()
- local localdistance = math.sqrt((xl - x2l) * (xl - x2l) + (yl - y2l) * (yl - y2l)) -- Local map distance
- local continentdistance = math.sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2)) -- Tamriel/Coldharbour
- local mapSize = (worldsize * continentdistance / localdistance) * multiplier
- if not (mapSize > 0) then -- Error
- FyrMM.DistanceMeasurementStarted = true
- return
- end
- if FyrMM.SV.MapSizes == nil then
- FyrMM.SV.MapSizes = {}
- end
- if not CurrentMap.filename or CurrentMap.filename == "" then
- local filename, nameNoNum, path = GetCurrentMapTextureFileInfo()
- CurrentMap.filename = string.lower(filename)
- end
- FyrMM.SV.MapSizes[CurrentMap.filename] = mapSize
- CurrentMap.TrueMapSize = mapSize
- end
- function FyrMM.InCombatAutoHideCheck()
- if not FyrMM.SV.InCombatAutoHide then
- return
- end
- if IsUnitActivelyEngaged("player") then
- FyrMM.AfterCombatUnhidePending = false
- if not Fyr_MM:IsHidden() then
- FyrMM.Visible = false
- FyrMM.AutoHidden = true
- end
- else
- if Fyr_MM:IsHidden() and FyrMM.AutoHidden then
- if not FyrMM.AfterCombatUnhidePending then
- FyrMM.AfterCombatUnhidePending = true
- FyrMM.AfterCombatUnhideTimeStamp = GetFrameTimeMilliseconds()
- zo_callLater(AfterCombatShow, 1000 * FyrMM.SV.AfterCombatUnhideDelay)
- end
- end
- end
- end
- local function DelayedReload()
- if FyrMM.Reloading then
- return
- end
- zo_callLater(FyrMM.Reload, 100)
- end
- local function DelayedShow()
- if not Fyr_MM:IsHidden() or FyrMM.Reloading then
- return
- end
- zo_callLater(FyrMM.Show, 100)
- end
- local frameRatePrevious = GetFramerate()
- function FyrMM.HideCheck() -- fires every 100 ticks
- -- if FyrMM.Reloading then --[[ d("Reloading") --]] return end
- -- FyrMM.Refresh = false
- -------- hide compass -------------------------------------------------------------
- if FyrMM.SV.hideCompass == true and not ZO_CompassFrame:IsHidden() then
- ZO_CompassFrame:SetHidden(true)
- end
- -- FPS stuff ----------------------------------------------------------------------
- if FyrMM.SV.ShowFPS or FyrMM.FpsTest then
- local frameRate = GetFramerate()
- frameRatePrevious = (frameRatePrevious + frameRate) / 2
- if (frameRate < 20.0) then
- Fyr_MM_FPS:SetColor(1, 0, 0, 1)
- elseif (frameRate < 30.0) then
- Fyr_MM_FPS:SetColor(1, 0.6, 0, 1)
- elseif (frameRate < 60.0) then
- Fyr_MM_FPS:SetColor(0, 1, 0, 1)
- else
- Fyr_MM_FPS:SetColor(1, 1, 1, 1)
- end
- Fyr_MM_FPS:SetText(string.format(" %.1f", frameRate))
- if not Fyr_MM:IsHidden() and FyrMM.FpsTest then
- if FyrMM.Fps == 0 then
- FyrMM.Fps = frameRate
- else
- FyrMM.Fps = (FyrMM.Fps + frameRate) / 2
- end
- end
- if Fyr_MM:IsHidden() and FyrMM.FpsTest then
- if FyrMM.FpsRaw == 0 then
- FyrMM.FpsRaw = frameRate
- else
- FyrMM.FpsRaw = (FyrMM.FpsRaw + frameRate) / 2
- end
- end
- else
- Fyr_MM_FPS:SetText("")
- Fyr_MM_FPS:SetAlpha(0)
- end
- --------------- clock -------------------------------------------------------------
- if FyrMM.SV.ShowClock then
- if GetSecondsSinceMidnight() ~= FyrMM.SecondsSinceMidnight then
- local TS = ""
- local a = GetTimeString()
- if FyrMM.TimeFormat == 0 then
- Fyr_MM_Time:SetText(a)
- elseif FyrMM.TimeFormat == 2 then
- TS = " " .. string.sub(a, 1, 5) .. " "
- Fyr_MM_Time:SetText(TS)
- else
- local h = tonumber(string.sub(a, 1, 2))
- if h > 12 then
- local H = tostring(h - 12)
- if (h - 12) < 10 then
- H = "0" .. H
- end
- TS = (H .. string.sub(a, 3, 5) .. "pm")
- else
- TS = (string.sub(a, 1, 5) .. "am")
- end
- Fyr_MM_Time:SetText(TS)
- end
- Fyr_MM_Time:SetMouseEnabled(true)
- if Fyr_MM_Time:IsHidden() then
- Fyr_MM_Time:SetHidden(false)
- end
- FyrMM.SecondsSinceMidnight = GetSecondsSinceMidnight()
- end
- else
- Fyr_MM_Time:SetMouseEnabled(false)
- Fyr_MM_Time:SetHidden(true)
- end
- --------------- SHOW / HIDE MINIMAP STUFF ---------------------------------------------------------------------------------------------------
- ------ Protect against minimap conflicts stuff
- if BUI and BUI.MiniMap and BUI.Vars.MiniMap == true then -- disables to avoid conflicts with BUI minimap
- if not FyrMM.minimapConflictMessage then
- d("|ceeeeeeMiniMap by |c006600Fyrakin |ceeeeee v" .. FyrMM.Panel.version .. "|r" ..
- "|c00BFFF is disabled to avoid conflicts with |cFF0000Bandits User Interface|r|c00BFFF's minimap. To use Minimap by |c006600Fyrakin|r|c00BFFF you need to disable |cFF0000Bandits User Interface|r|c00BFFF's minimap first. Please, always test/compare your minimaps one by one.")
- end
- FyrMM.minimapConflictMessage = true
- elseif AUI and AUI.Minimap and AUI.Minimap.IsEnabled() then -- disables to avoid conflicts with AUI's minimap
- if not FyrMM.minimapConflictMessage then
- d("|ceeeeeeMiniMap by |c006600Fyrakin |ceeeeee v" .. FyrMM.Panel.version .. "|r" ..
- "|c00BFFF is disabled to avoid conflicts with |cFF0000Advanced User Interface|r|c00BFFF's minimap. To use Minimap by |c006600Fyrakin|r|c00BFFF you need to disable |cFF0000Advanced User Interface|r|c00BFFF's minimap first. Please, always test/compare your minimaps one by one.")
- end
- FyrMM.minimapConflictMessage = true
- elseif VOTANS_MINIMAP and VOTANS_MINIMAP.account.enableMap then -- disables to avoid conflicts with Votan's minimap
- if not FyrMM.minimapConflictMessage then
- d("|ceeeeeeMiniMap by |c006600Fyrakin |ceeeeee v" .. FyrMM.Panel.version .. "|r" ..
- "|c00BFFF is disabled to avoid conflicts with |cFF0000Votan|r|c00BFFF's minimap. To use Minimap by |c006600Fyrakin|r|c00BFFF you need to disable |cFF0000Votan|r|c00BFFF's minimap first. Please, always test/compare your minimaps one by one.")
- end
- FyrMM.minimapConflictMessage = true
- else
- FyrMM.minimapConflictMessage = false
- end
- -- menus, scenes stuff
- local siegeControlling = IsPlayerControllingSiegeWeapon()
- local menuShowing = not ZO_KeybindStripControl:IsHidden()
- local interactShowing = not ZO_InteractWindow:IsHidden()
- local gameMenuShowing = not ZO_GameMenu_InGame:IsHidden()
- local crownStoreActive = WINDOW_MANAGER:IsSecureRenderModeEnabled() or
- not ZO_ProvisionerTopLevelNavigationContainerScroll:IsHidden() or
- not ZO_SharedRightPanelBackground:IsHidden()
- if FyrMM.SV.InCombatAutoHide then
- FyrMM.InCombatAutoHideCheck()
- end -- checks for combat autohide and returns FyrMM.AutoHidden
- if siegeControlling and FyrMM.SV.Siege and not FyrMM.manuallyHidden then -- controlling siege weapon
- FyrMM.Visible = true
- elseif (FyrMM.worldMapShowing or FyrMM.FastTravelOpen or TRIBUTE_SCENE:IsShowing() or SCRYING_SCENE:IsShowing() or
- ANTIQUITY_DIGGING_SCENE:IsShowing() or GAME_MENU_SCENE:IsShowing() or crownStoreActive or
- (FyrMM.isInHouse and FyrMM.SV.InHouseAutoHide) or menuShowing or interactShowing or gameMenuShowing or
- FyrMM.AutoHidden or FyrMM.minimapConflictMessage) and ZO_Loot:IsHidden() and
- not LORE_READER_INTERACTION_SCENE:IsShowing() then
- FyrMM.Visible = false
- elseif not FyrMM.manuallyHidden then
- FyrMM.Visible = true
- end
- if FyrMM.manuallyHidden then -- if hidden by user, never show
- FyrMM.Hide()
- elseif FyrMM.Visible == false or FyrMM.noMap == true then -- not visible or no map data
- FyrMM.Hide()
- else -- if everything is good we show the mini map
- DelayedShow()
- end
- if FyrMM.Visible == true and FyrMM.noMap == true then -- reload in case of problem
- FyrMM.noMap = false
- DelayedReload()
- DelayedShow()
- return
- end
- -- checks for Mini compass
- if FyrMM.SV.miniCompassOption and not COMPASS_FRAME:GetBossBarActive() then
- if ZO_CompassFrame:IsHidden() and not Fyr_MM:IsHidden() then
- ZO_CompassFrame:SetHidden(false)
- end
- FyrMM.SetMiniCompass()
- elseif FyrMM.SV.miniCompassOption and COMPASS_FRAME:GetBossBarActive() then
- if FyrMM.SV.miniCompassNoBossBar then
- if not ZO_CompassFrame:IsHidden() then
- ZO_CompassFrame:SetHidden(true)
- end
- else
- FyrMM.compassDefaultWidth = FyrMM.compassDefaultWidth or 650
- local width = ZO_CompassFrame:GetWidth()
- if width ~= FyrMM.compassDefaultWidth then
- ZO_CompassFrame:SetWidth(FyrMM.compassDefaultWidth)
- if width ~= MM_GetMapWidth() - 10 then
- FyrMM.compassDefaultWidth = width
- end
- end
- end
- end
- end
- function FyrMM.WorldMapShowHide()
- if ZO_WorldMap:IsHidden() then
- FyrMM.UnregisterUpdates()
- CancelUpdates()
- FyrMM.worldMapShowing = true
- FyrMM.Reloading = true
- else
- CurrentTasks = {}
- FyrMM.worldMapShowing = false
- FyrMM.Reloading = false
- -- zo_callLater(FyrMM.SetMapToPlayerLocation,50)
- end
- end
- function FyrMM.SetMapToPlayerLocation(stealth)
- local changed = false
- if not Stealth then
- if Fyr_MM:IsHidden() then
- return
- end
- end
- if GetMapFilterType() == 0 and stealth then
- zo_callLater(FyrMM.SetMapToPlayerLocation, 50)
- return
- end
- if FyrMM.worldMapShowing or not ZO_QuestJournal:IsHidden() then
- return
- end
- if FyrMM.DisableSubzones == true and GetMapType() ~= 1 then
- return
- end
- if FyrMM.DisableSubzones == true and GetMapType() == 1 and not IsUnitInDungeon("player") and not IsPlayerInRaid() and
- not IsActiveWorldBattleground() and not IsInAvAZone() then
- SetMapToZone()
- return true
- end
- if SetMapToPlayerLocation() ~= SET_MAP_RESULT_CURRENT_MAP_UNCHANGED then -- SET_MAP_RESULT_CURRENT_MAP_UNCHANGED = 1 SET_MAP_RESULT_FAILED = 0 SET_MAP_RESULT_MAP_CHANGED = 2
- changed = true
- if stealth then
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "OnWorldMapChanged (SetMapToPlayerLocation)" ..
- tostring(GetGameTimeMilliseconds()))
- end
- CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged")
- end
- end
- return changed
- end
- function FyrMM.Hide()
- if Fyr_MM:IsHidden() then
- return
- end
- FyrMM.UnregisterUpdates()
- CancelUpdates()
- Fyr_MM_Wheel_Background:SetHidden(true)
- Fyr_MM_Menu:SetHidden(true)
- Fyr_MM_Coordinates:SetHidden(true)
- Fyr_MM_Axis_Control:SetHidden(true)
- Fyr_MM_Scroll_WheelCenter:SetHidden(true)
- Fyr_MM_Scroll_WheelNS:SetHidden(true)
- Fyr_MM_Scroll_WheelWE:SetHidden(true)
- Fyr_MM_Frame_Wheel:SetHidden(true)
- if not FyrMM.SV.ShowBorder then
- Fyr_MM_Border:SetAlpha(0)
- end
- Fyr_MM:SetMouseEnabled(false)
- Fyr_MM_Menu:SetMouseEnabled(false)
- Fyr_MM_FPS_Frame:SetHidden(true)
- Fyr_MM_Zone_Background:SetHidden(true)
- Fyr_MM_ZoneFrame:SetHidden(true)
- Fyr_MM_Zone:SetText("")
- Fyr_MM_Speed:SetHidden(true)
- Fyr_MM:SetMouseEnabled(false)
- Fyr_MM_Frame_Control:SetMouseEnabled(false)
- Fyr_MM_ZoneFrame:SetMouseEnabled(false)
- Fyr_MM_FPS_Frame:SetMouseEnabled(false)
- Fyr_MM:SetHidden(true)
- end
- function FyrMM.Show_WheelScrolls()
- FyrMM.UpdateMapTiles(true)
- Fyr_MM_Wheel_Background:SetHidden(not FyrMM.SV.WheelMap)
- Fyr_MM_Scroll_WheelCenter:SetHidden(not FyrMM.SV.WheelMap)
- Fyr_MM_Scroll_WheelNS:SetHidden(not FyrMM.SV.WheelMap)
- Fyr_MM_Scroll_WheelWE:SetHidden(not FyrMM.SV.WheelMap)
- Fyr_MM_Scroll:SetHorizontalScroll(CurrentMap.hpos)
- Fyr_MM_Scroll:SetVerticalScroll(CurrentMap.vpos)
- Fyr_MM_Scroll_WheelCenter:SetHorizontalScroll(CurrentMap.hpos)
- Fyr_MM_Scroll_WheelCenter:SetVerticalScroll(CurrentMap.vpos)
- Fyr_MM_Scroll_WheelNS:SetHorizontalScroll(CurrentMap.hpos)
- Fyr_MM_Scroll_WheelNS:SetVerticalScroll(CurrentMap.vpos)
- Fyr_MM_Scroll_WheelWE:SetHorizontalScroll(CurrentMap.hpos)
- Fyr_MM_Scroll_WheelWE:SetVerticalScroll(CurrentMap.vpos)
- end
- function FyrMM.Show()
- if FyrMM.Reloading or not Fyr_MM:IsHidden() then
- return
- end -- or not Fyr_MM:IsHidden() was added for optimization 20/04/2023
- if not (IsPlayerControllingSiegeWeapon() and FyrMM.SV.Siege) then
- if not FyrMM.Visible or FyrMM.worldMapShowing or not ZO_KeybindStripControl:IsHidden() or
- not ZO_InteractWindow:IsHidden() or not ZO_GameMenu_InGame:IsHidden() or
- WINDOW_MANAGER:IsSecureRenderModeEnabled() then
- return
- end
- end
- if FyrMM.Halted and FyrMM.Visible and not FyrMM.worldMapShowing and FyrMM.HaltTimeOffset ~= 0 then
- if GetFrameTimeMilliseconds() - FyrMM.HaltTimeOffset > 1000 then
- FyrMM.RegisterUpdates()
- end
- end
- FyrMM.SetMapToPlayerLocation()
- if Fyr_MM:IsHidden() then
- zo_callLater(function()
- FyrMM.UpdateMapTiles(true)
- FyrMM.RegisterUpdates()
- end, 100)
- Fyr_MM_Frame_Wheel:SetHidden(not FyrMM.SV.WheelMap)
- if FyrMM.SV.WheelMap then
- FyrMM.Show_WheelScrolls()
- end
- Fyr_MM_Frame_Control:SetHidden(not FyrMM.SV.WheelMap)
- Fyr_MM:SetHidden(false)
- Fyr_MM_Menu:SetHidden(FyrMM.SV.MenuDisabled)
- Fyr_MM_Menu:SetMouseEnabled(not FyrMM.SV.MenuDisabled)
- Fyr_MM_Zone_Background:SetHidden(not FyrMM.SV.ShowZoneBackground)
- Fyr_MM_ZoneFrame:SetHidden(FyrMM.SV.HideZoneLabel)
- if not FyrMM.SV.HideZoneLabel then
- FyrMM.UpdateLabels()
- end
- Fyr_MM_Coordinates:SetHidden(not FyrMM.SV.ShowPosition)
- Fyr_MM_Axis_Control:SetHidden(not (FyrMM.SV.RotateMap or FyrMM.SV.BorderPins))
- Fyr_MM_FPS_Frame:SetHidden(not FyrMM.SV.ShowFPS)
- Fyr_MM_Speed:SetHidden(not FyrMM.SV.ShowSpeed)
- Fyr_MM_ZoneFrame:SetMouseEnabled(true)
- Fyr_MM:SetMouseEnabled(true)
- end
- if FyrMM.SV.ShowBorder then
- Fyr_MM_Border:SetAlpha(100)
- end
- Fyr_MM:SetMouseEnabled(true)
- FyrMM.RequestQuestPinUpdate() -- test 03/05/2023
- if FyrMM.checkLater == true then
- FyrMM.ZoneCheck()
- end
- end
- function FyrMM.ZoneUpdate()
- if FyrMM.Reloading then
- return
- end
- if FyrMM.SV.DisableSubzones then
- FyrMM.ZoneCheck()
- end
- end
- function FyrMM.playerMoved()
- FyrMM.newPos = { CurrentMap.PlayerNX, CurrentMap.PlayerNY } -- GetMapPlayerPosition("player")
- if rawequal(FyrMM.newPos, FyrMM.oldPos) then
- return false
- end
- FyrMM.oldPos = FyrMM.newPos
- return true
- end
- local function ZoneCheck()
- if Fyr_MM:IsHidden() then
- FyrMM.checkLater = true
- return
- end
- FyrMM.RegisterUpdates() -- Solves the bug where custom pins of parent zone are displayed on current subzone map after porting to a wayshrine in the same subzone 24/07/2022
- if not FyrMM.worldMapShowing then
- if GetMapFilterType() == 0 then
- zo_callLater(ZoneCheck, 50)
- return
- end
- FyrMM.CheckingZone = true
- local filename, _, _ = GetCurrentMapTextureFileInfo()
- if filename == "tamriel_0" then
- FyrMM.CheckingZone = false
- return
- end
- CurrentMap.ZoneIndex = GetCurrentMapZoneIndex()
- if string.lower(CurrentMap.filename) ~= string.lower(filename) then
- FyrMM.UnregisterUpdates()
- CancelUpdates()
- local ZoneIndex = 0
- local mapId = FyrMM.GetMapId()
- if FyrMM.MapSizes[mapId] then
- FyrMM.LoadCustomPinList()
- end
- if ZoneIndex == 0 then
- FyrMM.SetMapToPlayerLocation()
- CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged")
- else
- CurrentMap.ZoneIndex = ZoneIndex
- end
- FyrMM.UpdateMapInfo()
- FyrMM.UpdateMapTiles(true)
- FyrMM.MovementSpeed = 0
- FyrMM.MovementSpeedPrevious = 0
- FyrMM.MovementSpeedMax = 0
- CustomPinIndex = {}
- if IsInAvAZone() then
- zo_callLater(FyrMM.RequestKeepRefresh, 100) -- WAS 1000
- end
- CurrentMap.PlayerNX, CurrentMap.PlayerNY, CurrentMap.PlayerHeading = GetMapPlayerPosition("player")
- CurrentMap.MapId = mapId
- CurrentMap.MapContent = GetMapContentType()
- CALLBACK_MANAGER:FireCallbacks("OnFyrMiniNewMapEntered")
- end
- if FyrMM.SV.RotateMap then
- Fyr_MM_Scroll:SetHorizontalScroll(0)
- Fyr_MM_Scroll:SetVerticalScroll(0)
- else
- Fyr_MM_Scroll:SetHorizontalScroll(CurrentMap.hpos)
- Fyr_MM_Scroll:SetVerticalScroll(CurrentMap.vpos)
- end
- if FyrMM.SV.WheelMap then
- FyrMM.WheelScroll(CurrentMap.hpos, CurrentMap.vpos)
- end
- FyrMM.customPinsUpdateCount = nil
- end
- FyrMM.CheckingZone = false
- FyrMM.checkLater = false
- end
- function FyrMM.ZoneCheck()
- if FyrMM.CheckingZone then
- return
- end
- zo_callLater(ZoneCheck, 50)
- end
- local function TaskExists(tag)
- for i, v in pairs(CurrentTasks) do
- if CurrentTasks[i] ~= nil then
- if GetFrameTimeMilliseconds() - CurrentTasks[i].RequestTimeStamp < FYRMM_QUEST_PIN_REQUEST_TIMEOUT then
- if CurrentTasks[i][1] == tag[1] and CurrentTasks[i][2] == tag[2] and CurrentTasks[i][3] == tag[3] and
- CurrentTasks[i].isBreadcrumb == tag.isBreadcrumb then
- return true
- end
- else
- -- CurrentTasks[i] = nil
- end
- end
- end
- return false
- end
- local function DestroyTasks()
- for i, v in pairs(CurrentTasks) do
- if CurrentTasks[i] ~= nil then
- CurrentTasks[i] = nil
- end
- end
- end
- local function RemoveObsoleteQuestPins()
- local t = GetGameTimeMilliseconds()
- for i, v in pairs(QuestPins) do
- if questpinDataExists(v, RequestedQuestPins) == nil then
- RemoveQuestPin(v.Pin)
- end
- end
- local pinCount = Fyr_MM_Scroll_Map_QuestPins:GetNumChildren()
- local l
- local nilcount = 0
- for i = 1, pinCount + 100 do
- l = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(i))
- if l == nil then
- nilcount = nilcount + 1
- if nilcount > 1 then
- return
- end
- end
- if l ~= nil and l.questdataIndex ~= nil then
- if QuestPins[l.questdataIndex] == nil then
- if l.MM_Tag == nil then
- RemoveQuestPin(l)
- else
- if l.MM_Tag == 1 then
- if l.secondaryPin ~= nil then
- l.secondaryPin.MM_Tag = nil
- RemoveQuestPin(l.secondaryPin)
- end
- if l.tertiaryPin ~= nil then
- l.tertiaryPin.MM_Tag = nil
- RemoveQuestPin(l.tertiaryPin)
- end
- l.MM_Tag = nil
- RemoveQuestPin(l)
- end
- end
- zo_callLater(FyrMM.RequestQuestPinUpdate, 1000)
- end
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "RemoveObsoleteQuestPins " .. tostring(GetGameTimeMilliseconds() - t))
- end
- end
- local function AddMissingQuestPins()
- local properType, pinTexture, size
- for i, v in pairs(RequestedQuestPins) do
- if questpinDataExists(v, QuestPins) == nil then
- properType, pinTexture, size = FyrMM.GetQuestPinInfo(MAP_PIN_TYPE_TRACKED_QUEST_CONDITION,
- GetTrackedIsAssisted(TRACK_TYPE_QUEST, v.questIndex), v.isBreadcrumb, v.radius)
- FyrMM.CreateQuestPin(properType, v.tag, v.normalizedX, v.normalizedY, v.radius)
- zo_callLater(FyrMM.RequestQuestPinUpdate, 1000)
- end
- end
- end
- function FyrMM.checkDuplicateCustompin() -- added by @Masteroshi430 -- testing purposes, should never been called!
- if Fyr_MM_Scroll_Map_Pins:GetNumChildren() == 0 then
- return
- end
- FyrMM.scrollMapPinToCheck = FyrMM.scrollMapPinToCheck or 1
- local pinToTest = Fyr_MM_Scroll_Map_Pins:GetChild(FyrMM.scrollMapPinToCheck)
- local total = 1
- local notFoundYet = true
- for i = 1, Fyr_MM_Scroll_Map_Pins:GetNumChildren() do
- l = Fyr_MM_Scroll_Map_Pins:GetChild(i)
- if l ~= nil and l.nX then
- if FyrMM.scrollMapPinToCheck ~= i and pinToTest.nX == l.nX and pinToTest.nY == l.nY and pinToTest.radius ==
- l.radius then
- local texture = l:GetTextureFileName() or ""
- RemoveCustomPin(l)
- d("custom pin duplicate removed " .. texture)
- end
- if i > FyrMM.scrollMapPinToCheck and notFoundYet == true then
- FyrMM.scrollMapPinToCheck = i
- notFoundYet = false
- end
- total = total + 1
- else
- if i > FyrMM.scrollMapPinToCheck and notFoundYet == true then
- FyrMM.scrollMapPinToCheck = i
- end
- end
- end
- if FyrMM.scrollMapPinToCheck >= 1200 then
- FyrMM.scrollMapPinToCheck = 1
- end
- d("Next tested pin: " .. FyrMM.scrollMapPinToCheck .. " total custom pins: " .. total)
- end
- function FyrMM.customPinsUpdate(count) -- added by @Masteroshi430
- if FyrMM.Reloading then
- return
- end
- -- d("tries to update custom pins")
- if IsCustomPinsLoading() or count ~= FyrMM.customPinsUpdateCount then
- return
- end
- if FyrMM.CustomPinCount == AvailableCustomPins() then
- FyrMM.customPinsUpdateCount = nil
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.CustomPins End: (" .. tostring(FyrMM.CustomPinCount) ..
- ") " .. tostring(GetGameTimeMilliseconds()))
- end
- return
- end
- count = count or 1
- if count < 5 then
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "FyrMM.CustomPins Start: (" .. tostring(FyrMM.CustomPinCount) .. ") " ..
- tostring(GetGameTimeMilliseconds()))
- end
- FyrMM.CustomPins()
- -- d("check custompins attempt "..count)
- zo_callLater(function()
- FyrMM.customPinsUpdate(count + 1)
- end, 1000 + (count * 100))
- FyrMM.customPinsUpdateCount = count + 1
- return
- end
- FyrMM.ResetCustomPinList()
- FyrMM.customPinsUpdateCount = nil
- -- d("check custompins attempt "..count..": resetting custompins!")
- end
- function FyrMM.PinUpdate()
- if FyrMM.Halted then
- return
- end
- if ((not FyrMM.Visible or Fyr_MM:IsHidden()) and FyrMM.Initialized) or FyrMM.worldMapShowing then
- return
- end
- local a = GetGameTimeMilliseconds()
- CurrentMap.ZoneIndex = GetCurrentMapZoneIndex()
- FyrMM.RemoveInvalidQuestPins()
- CheckCustomPinConsistence()
- if FyrMM.currentPOICount == 0 then
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapPOIPins", 30, function()
- if FyrMM.Reloading then
- return
- end
- FyrMM.POIPins()
- if FyrMM.currentPOICount ~= 0 then
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapPOIPins")
- return
- end
- end)
- end
- if FyrMM.currentLocationsCount == 0 then
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapLocationsPins", 30, function()
- if FyrMM.Reloading then
- return
- end
- FyrMM.LocationPins()
- if FyrMM.currentLocationsCount ~= 0 then
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapLocationsPins")
- return
- end
- end)
- end
- if FyrMM.currentWayshrineCount == 0 then
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapWayshrinesPins", 30, function()
- if FyrMM.Reloading then
- return
- end
- FyrMM.Wayshrines()
- if FyrMM.currentWayshrineCount ~= 0 then
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapWayshrinesPins")
- return
- end
- end)
- end
- -- FyrMM.checkDuplicateCustompin() -- testing purposes, should never been called!
- if FyrMM.CustomPinCount ~= AvailableCustomPins() or IsTableEmpty(FyrMM.CustomPinList) or detectedNewCustomPin then
- if IsTableEmpty(FyrMM.CustomPinList) then
- FyrMM.LoadCustomPinList()
- elseif detectedNewCustomPin then
- FyrMM.CheckForNewCustomPins()
- end
- FyrMM.customPinsUpdate()
- end
- if IsTableEmpty(CurrentTasks) and QuestPinsUpdating and not QuestTasksPending then
- RemoveObsoleteQuestPins()
- AddMissingQuestPins()
- GetNumBorderPins()
- QuestPinsUpdating = false
- end
- if (NeedQuestPinUpdate or FyrMM.questPinCount == 0) and GetQuestJournalMaxValidIndex() > 0 then
- if not QuestPinsUpdating then
- if not (IsTableEmpty(CurrentTasks) and GetFrameTimeMilliseconds() - FyrMM.LastQuestPinRequest <
- FYRMM_QUEST_PIN_REQUEST_MINIMUM_DELAY) then
- RequestedQuestPins = {}
- FyrMM.UpdateQuestPins()
- NeedQuestPinUpdate = false
- end
- end
- end
- -- testing only !
- -- if #PinsList ~= PL then PL = #PinsList d(PL.." total pins") end
- -- if Fyr_MM_Scroll_Map_Pins:GetNumChildren() ~= SMP then SMP = Fyr_MM_Scroll_Map_Pins:GetNumChildren() d(SMP.." custom pins") end
- -- if Fyr_MM_Scroll_Map_WayshrinePins:GetNumChildren() ~= WSP then WSP = Fyr_MM_Scroll_Map_WayshrinePins:GetNumChildren() d(WSP.." wayshrine pins") end
- -- if Fyr_MM_Scroll_Map_LocationPins:GetNumChildren() ~= LP then LP = Fyr_MM_Scroll_Map_LocationPins:GetNumChildren() d(LP.." location pins") end
- -- if Fyr_MM_Scroll_Map_POIPins:GetNumChildren() ~= POIP then POIP = Fyr_MM_Scroll_Map_POIPins:GetNumChildren() d(POIP.." POI pins") end
- -- if Fyr_MM_Axis_Border_Pins:GetNumChildren() ~= BP then BP = Fyr_MM_Axis_Border_Pins:GetNumChildren() d(BP.." border pins") end
- -- if Fyr_MM_Scroll_Map_GroupPins:GetNumChildren() ~= GP then GP = Fyr_MM_Scroll_Map_GroupPins:GetNumChildren() d(GP.." group pins") end
- a = GetFrameTimeMilliseconds() - a
- if FyrMM.DebugMode and a > 0 then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.PinUpdate " .. tostring(a))
- end
- end
- function FyrMM.Debug_d(value)
- if FyrMM.DebugMode and FyrMM.SV then
- if FyrMM.SV.DebugLog == nil then
- FyrMM.SV.DebugLog = {}
- end
- local t = GetGameTimeMilliseconds() - math.floor(GetGameTimeMilliseconds() / 1000) * 1000
- d("[" .. GetTimeString() .. string.format("] %s", tostring(value)))
- table.insert(FyrMM.SV.DebugLog,
- "[" .. GetTimeString() .. "." .. tostring(t) .. "] FPS:" .. tostring(zo_round(GetFramerate() * 10) / 10) ..
- " RAM:" .. tostring(zo_round((collectgarbage("count") / 1024) * 100) / 100) .. " MAP:" ..
- tostring(CurrentMap.MapId) .. " LOC:" ..
- string.format("%05.02f, %05.02f", zo_round(CurrentMap.PlayerNX * 10000) / 100,
- zo_round(CurrentMap.PlayerNY * 10000) / 100) .. " FN:" .. tostring(value))
- else
- FyrMM.SV.DebugLog = nil
- end
- d("debug triggering")
- end
- function FyrMM.SetMiniCompass()
- if ZO_Compass:GetScale() ~= MM_GetMapWidth() / 350 then
- if not Harvest then
- ZO_Compass:SetScale(MM_GetMapWidth() / 350)
- end
- end
- ZO_Compass:SetDimensions(MM_GetMapWidth() - 10, MM_GetMapWidth() / 20)
- ZO_CompassCenterOverPinLabel:SetScale(MM_GetMapWidth() / 300)
- ZO_CompassFrameLeft:SetDimensions(10, MM_GetMapWidth() / 20)
- ZO_CompassFrameRight:SetDimensions(10, MM_GetMapWidth() / 20)
- ZO_CompassFrame:SetDimensions(MM_GetMapWidth() - 10, MM_GetMapWidth() / 20)
- ZO_CompassCenterOverPinLabel:SetHidden(true) -- hide compass pin text
- ZO_CompassFrame:ClearAnchors()
- if FyrMM.SV.miniCompassLocation == "Top" then
- ZO_CompassFrame:SetAnchor(BOTTOMLEFT, Fyr_MM, TOPLEFT, 5, -5) -- TOP POSITION
- else
- local verticalOffset = 5
- if (not Fyr_MM_Frame_RoundMenu:IsHidden()) and Fyr_MM_Frame_RoundMenu:GetAlpha() ~= 0 then
- verticalOffset = verticalOffset + (Fyr_MM_Frame_RoundMenu:GetHeight() / 3)
- end
- if (not Fyr_MM_Frame_SquareMenu:IsHidden()) and Fyr_MM_Frame_SquareMenu:GetAlpha() ~= 0 then
- verticalOffset = verticalOffset + (Fyr_MM_Frame_SquareMenu:GetHeight() / 3)
- end
- if not Fyr_MM_ZoneFrame:IsHidden() then
- verticalOffset = verticalOffset + Fyr_MM_ZoneFrame:GetHeight()
- end
- ZO_CompassFrame:SetAnchor(TOPLEFT, Fyr_MM, BOTTOMLEFT, 5, verticalOffset) -- BOTTOM POSITION
- end
- ZO_CompassFrame:SetClampedToScreen(true)
- ZO_CompassFrame:SetDrawLayer(-1)
- end
- function FyrMM.Reload()
- if FyrMM.Reloading then
- return
- end
- local t = GetGameTimeMilliseconds()
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.Reload Start:")
- end
- FyrMM.Reloading = true
- CancelUpdates()
- CustomPinsCopying = false
- FyrMM.LastReload = GetFrameTimeMilliseconds()
- FyrMM.UnregisterUpdates()
- if not FyrMM.SV.HideZoneLabel then
- FyrMM.UpdateLabels()
- end
- FyrMM.MapHalfDiagonal()
- FyrMM.UpdateMapInfo()
- FyrMM.UpdateMapTiles(true)
- FyrMM.PositionUpdate()
- FreeQuestPinIndex = {}
- QuestPins = {}
- LastQuestPinIndex = 0
- FyrMM.DistanceMeasurementStarted = false
- FyrMM.MovementSpeedMax = 0
- FyrMM.questPinCount = 0
- FyrMM.currentLocationsCount = 0
- FyrMM.currentPOICount = 0
- FyrMM.currentForwardCamps = 0
- FyrMM.currentWayshrineCount = 0
- CleanUpPins()
- FyrMM.MeasureDistance()
- FyrMM.PlaceWaypointBorderPins()
- FyrMM.LoadCustomPinList()
- FyrMM.UpdateAntiquityDigSites()
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.Reload Done." .. tostring(GetGameTimeMilliseconds() - t))
- end
- -- EVENT_MANAGER:UnregisterForUpdate("MiniMapReload")
- end
- function FyrMM.WheelScroll(x, y)
- if x and y then
- Fyr_MM_Scroll_WheelCenter:SetHorizontalScroll(x)
- Fyr_MM_Scroll_WheelCenter:SetVerticalScroll(y)
- Fyr_MM_Scroll_WheelNS:SetHorizontalScroll(x)
- Fyr_MM_Scroll_WheelNS:SetVerticalScroll(y)
- Fyr_MM_Scroll_WheelWE:SetHorizontalScroll(x)
- Fyr_MM_Scroll_WheelWE:SetVerticalScroll(y)
- end
- end
- local function SetSpeedLabel(speed)
- if speed == nil then
- speed = 0
- end
- if speed ~= 0 then
- if FyrMM.SV.SpeedUnit == "ft/s" then
- speed = zo_round(speed * 22.0632) / 100
- Fyr_MM_SpeedLabel:SetText(string.format("%05.02f ft/s", speed))
- end
- if FyrMM.SV.SpeedUnit == "m/s" then
- speed = zo_round(speed * 6.7249) / 100
- Fyr_MM_SpeedLabel:SetText(string.format("%05.02f m/s", speed))
- end
- if FyrMM.SV.SpeedUnit == "%" then
- speed = zo_round(speed * 100) / 100
- Fyr_MM_SpeedLabel:SetText(string.format("%05.01f ", speed) .. "%")
- end
- else
- Fyr_MM_SpeedLabel:SetText("0 " .. FyrMM.SV.SpeedUnit)
- end
- local speedWidth, speedHeight = Fyr_MM_SpeedLabel:GetTextDimensions() or 100, 20
- Fyr_MM_Speed:SetDimensions(speedWidth + 10, speedHeight + 3)
- end
- local function LogPosition()
- local MapId = FyrMM.GetMapId()
- local size = CurrentMap.TrueMapSize
- local gameTime = GetGameTimeMilliseconds()
- IsCompanionAround = DoesUnitExist("companion")
- CurrentMap.PlayerNX, CurrentMap.PlayerNY, CurrentMap.PlayerHeading = GetMapPlayerPosition("player")
- if FyrMM.SV.ShowSpeed then
- PositionLogCounter = PositionLogCounter + 1
- PositionLog3D[PositionLogCounter] = { GetUnitWorldPosition("player") }
- PositionLog3D[PositionLogCounter][5] = GetFrameTimeMilliseconds()
- PositionLog3D[PositionLogCounter][6] = CurrentMap.PlayerNX
- PositionLog3D[PositionLogCounter][7] = CurrentMap.PlayerNY
- end
- CurrentMap.CameraHeading = GetPlayerCameraHeading()
- CurrentMap.PlayerTurned = (CurrentMap.Heading ~= math.abs(CurrentMap.PlayerHeading - pi * 2))
- CurrentMap.Heading = smoothHeadingRotation()
- CurrentMap.PlayerMoved = FyrMM.playerMoved()
- if CurrentMap.PlayerHeading < 0 then
- CurrentMap.PlayerHeading = pi * 2 + CurrentMap.PlayerHeading
- end
- if zo_round(CurrentMap.PlayerNX * 100) / 100 <= 0 or zo_round(CurrentMap.PlayerNY * 100) / 100 <= 0 or
- CurrentMap.PlayerNX >= 1 or CurrentMap.PlayerNY >= 1 then
- if not Fyr_MM:IsHidden() then
- zo_callLater(FyrMM.SetMapToPlayerLocation, 50)
- end
- end
- if MapId ~= CurrentMap.MapId and FyrMM.CheckingZone == false then
- FyrMM.ZoneCheck()
- end
- CurrentMap.PlayerX, CurrentMap.PlayerY = Fyr_MM_Scroll_Map:GetDimensions()
- CurrentMap.PlayerX = CurrentMap.PlayerX * CurrentMap.PlayerNX
- CurrentMap.PlayerY = CurrentMap.PlayerY * CurrentMap.PlayerNY
- CurrentMap.currentTimeStamp = gameTime
- if CurrentMap.PlayerMoved then
- CurrentMap.movedTimeStamp = gameTime
- end
- Fyr_MM_Position:SetText(string.format("%05.02f, %05.02f", CurrentMap.PlayerNX * 100, CurrentMap.PlayerNY * 100)) -- thanks Garkin
- local textWidth, textHeight = Fyr_MM_Position:GetTextDimensions() or 100, 20
- Fyr_MM_Position_Background:SetDimensions(textWidth + 10, textHeight + 3)
- Fyr_MM_Player_incombat:SetHidden(not (FyrMM.SV.InCombatState and IsUnitActivelyEngaged("player")))
- end
- local function SpeedMeasure()
- FyrMM.WaypointPins()
- if not FyrMM.SV.ShowSpeed then
- return
- end
- local multiplier = FyrMM.GetMapMeasureMultiplier()
- local x13d, y13d, z13d, t1, x12d, y12d = PositionLog3D[1][2], PositionLog3D[1][3], PositionLog3D[1][4],
- PositionLog3D[1][5], PositionLog3D[1][6], PositionLog3D[1][7]
- local x23d, y23d, z23d, t2, x22d, y22d
- local d3d, d2d, v13d, va3d = 0, 0, 0, 0
- local size = FyrMM.MapSizes[CurrentMap.MapId] or FyrMM.currentMap.TrueMapSize
- if IsPlayerMoving() then
- for i = 2, PositionLogCounter do
- local posData = PositionLog3D[i]
- x23d, y23d, z23d, t2, x22d, y22d = posData[2], posData[3], posData[4], posData[5], posData[6], posData[7]
- d3d = math.sqrt((x23d - x13d) ^ 2 + (y23d - y13d) ^ 2 + (z23d - z13d) ^ 2)
- v13d = 0.1487 * d3d / math.abs((t2 - t1) / 1000)
- x13d, y13d, z13d, t1, x12d, y12d = x23d, y23d, z23d, t2, x22d, y22d
- va3d = va3d + v13d
- end
- if PositionLogCounter == 0 then
- return
- end
- local nsize = 0.0143 * math.sqrt((x23d - x13d) ^ 2 + (y23d - y13d) ^ 2) /
- math.sqrt((x22d - x12d) ^ 2 + (y22d - y12d) ^ 2)
- if nsize and size and nsize ~= 1e309 and size < nsize then
- FyrMM.currentMap.TrueMapSize = nsize
- end
- va3d = va3d / (PositionLogCounter - 1) * multiplier
- end
- PositionLogCounter = 0
- local MovementSpeedPrevious = FyrMM.MovementSpeedPrevious -- cache global variable
- if MovementSpeedPrevious then
- FyrMM.MovementSpeed = (va3d + MovementSpeedPrevious) / 2
- else
- FyrMM.MovementSpeed = va3d
- end
- if MovementSpeedPrevious ~= FyrMM.MovementSpeed then
- CALLBACK_MANAGER:FireCallbacks("MovementSpeedChanged", va3d)
- FyrMM.MovementSpeedPrevious = FyrMM.MovementSpeed
- end
- if va3d > FyrMM.MovementSpeedMax then
- FyrMM.MovementSpeedMax = va3d
- end
- SetSpeedLabel(va3d)
- end
- function FyrMM.PositionUpdate()
- if not FyrMM.Visible or Fyr_MM:IsHidden() or FyrMM.worldMapShowing or not FyrMM.Initialized or
- not Fyr_MM_Scroll_Map_0 or not CurrentMap.Dx then
- return
- end
- if FyrMM.GetMapId() ~= CurrentMap.MapId and not FyrMM.CheckingZone then
- FyrMM.ZoneCheck()
- end
- local a = GetGameTimeMilliseconds()
- local x = CurrentMap.PlayerNX
- local y = CurrentMap.PlayerNY
- local pheading = CurrentMap.PlayerHeading
- if x == nil or pheading == nil then
- x, y, pheading = GetMapPlayerPosition("player")
- end
- local moved = CurrentMap.PlayerMoved
- CurrentMap.CameraHeading = CurrentMap.CameraHeading or GetPlayerCameraHeading()
- local cpheading = FyrMM.SV.RotateMap and math.abs(pheading - pi * 2) + CurrentMap.CameraHeading or
- CurrentMap.CameraHeading
- Fyr_MM_Camera:SetTextureRotation(cpheading)
- local hpos = (x * (Fyr_MM_Scroll_Map_0:GetWidth() * CurrentMap.Dx)) - (Fyr_MM_Scroll:GetWidth() / 2)
- local vpos = (y * (Fyr_MM_Scroll_Map_0:GetHeight() * CurrentMap.Dx)) - (Fyr_MM_Scroll:GetHeight() / 2)
- local heading = pheading
- if FyrMM.SV.PPStyle ~= GetString(SI_MM_STRING_PLAYERANDCAMERA) then
- if FyrMM.SV.Heading == "CAMERA" then
- heading = CurrentMap.CameraHeading
- end
- if not moved and FyrMM.SV.Heading == "MIXED" then
- heading = CurrentMap.CameraHeading
- end
- end
- if moved and FyrMM.SV.ViewRangeFiltering then
- UpdateCustomPinPositions()
- end
- if ((x < 1.2 and x > -0.2) and (y < 1.2 and y > -0.2)) then -- Can't let the scroll go too far outside view (Black map issue)
- if not Fyr_MM:IsHidden() and moved then
- FyrMM.SetMapToPlayerLocation()
- end
- CurrentMap.hpos = hpos
- CurrentMap.vpos = vpos
- if FyrMM.SV.RotateMap then
- Fyr_MM_Scroll:SetHorizontalScroll(0)
- Fyr_MM_Scroll:SetVerticalScroll(0)
- else
- Fyr_MM_Scroll:SetHorizontalScroll(hpos)
- Fyr_MM_Scroll:SetVerticalScroll(vpos)
- end
- if FyrMM.SV.WheelMap then
- FyrMM.WheelScroll(CurrentMap.hpos, CurrentMap.vpos)
- end
- else
- CurrentMap.hpos = hpos
- CurrentMap.vpos = vpos
- if FyrMM.SV.RotateMap then
- Fyr_MM_Scroll:SetHorizontalScroll(0)
- Fyr_MM_Scroll:SetVerticalScroll(0)
- else
- Fyr_MM_Scroll:SetHorizontalScroll(CurrentMap.hpos)
- Fyr_MM_Scroll:SetVerticalScroll(CurrentMap.vpos)
- end
- if FyrMM.SV.WheelMap then
- FyrMM.WheelScroll(CurrentMap.hpos, CurrentMap.vpos)
- end
- end
- FyrMM.UpdateMapTiles(moved) -- can cause tiles not updating but should be fixed by now
- CurrentMap.needRescale = true -- REMOVING THIS CAUSES OCCASIONAL PINS DEPHASING ON ROTATING MAPS
- if FyrMM.SV.RotateMap then
- Fyr_MM_Player:SetTextureRotation(0)
- FyrMM.AxisPins()
- else
- Fyr_MM_Player:SetTextureRotation(heading)
- end
- a = GetGameTimeMilliseconds() - a
- if FyrMM.DebugMode and a > 0 then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.PositionUpdate " .. tostring(a))
- end
- end
- -------------------------------------------------------------
- -- Map Building
- -------------------------------------------------------------
- -- get map info for minimap
- function FyrMM.UpdateMapInfo(IgnoreZone)
- local t = GetGameTimeMilliseconds()
- CurrentMap.ready = false
- CurrentMap.name = GetMapName()
- CurrentMap.tileTexture = string.lower(GetMapTileTexture())
- CurrentMap.Dx, CurrentMap.Dy = GetMapNumTiles()
- local filename, nameNoNum, path = GetCurrentMapTextureFileInfo()
- CurrentMap.filename = string.lower(filename)
- CurrentMap.nameNoNum = nameNoNum
- CurrentMap.path = path
- CurrentMap.TextureAngle = 0
- local id = FyrMM.GetMapId()
- if string.lower(CurrentMap.filename) == "tamriel_0" then
- CurrentMap.ready = true
- zo_callLater(FyrMM.UpdateMapInfo, 5)
- return
- end
- if CurrentMap.Dx < 2 or CurrentMap.Dy < 2 or CurrentMap.Dx == nil or CurrentMap.Dy == nil then
- if id ~= 0 then
- CurrentMap.Dx, CurrentMap.Dy = GetMapNumTilesForMapId(id)
- else
- CurrentMap.Dx = 3
- CurrentMap.Dy = 3
- end
- end
- CurrentMap.type = GetMapType()
- if not IgnoreZone then
- CurrentMap.ZoneIndex = GetCurrentMapZoneIndex()
- end
- -- if we have no texture we have nothing further to do
- if CurrentMap.tileTexture == "" or CurrentMap.Dx == nil or CurrentMap.Dy == nil then
- FyrMM.noMap = true
- return
- else
- FyrMM.noMap = false
- end
- CurrentMap.numTiles = CurrentMap.Dx * CurrentMap.Dy
- CurrentMap.TrueMapSize = 1
- if id ~= 0 and FyrMM.MapSizes[id] then
- CurrentMap.TrueMapSize = FyrMM.MapSizes[id]
- if FyrMM.SV.MapSizes then
- if FyrMM.SV.MapSizes[CurrentMap.filename] and CurrentMap.TrueMapSize > 1 then
- FyrMM.SV.MapSizes[CurrentMap.filename] = nil
- end
- end
- end
- -- store tile textures in table
- CurrentMap.tiles = {}
- for i = 1, CurrentMap.numTiles do
- table.insert(CurrentMap.tiles, string.lower(GetMapTileTexture(i)))
- end
- if not CurrentMap.filename or CurrentMap.filename == "" then
- local filename, _, _ = GetCurrentMapTextureFileInfo()
- CurrentMap.filename = string.lower(filename)
- end
- if FyrMM.SV.ZoomTable[CurrentMap.filename] == nil then
- FyrMM.SV.ZoomTable[CurrentMap.filename] = FYRMM_DEFAULT_ZOOM_LEVEL
- CurrentMap.ZoomLevel = FYRMM_DEFAULT_ZOOM_LEVEL
- else
- CurrentMap.ZoomLevel = FyrMM.SV.ZoomTable[CurrentMap.filename]
- end
- if FyrMM.SV.autoResizePin and CurrentMap.MapId ~= 16 and CurrentMap.MapId ~= 660 and GetMapContentType() ~=
- MAP_CONTENT_BATTLEGROUND then
- -- zoom: 1 to 50 default: 10
- FyrMM.pinZoomScale = (CurrentMap.ZoomLevel) / 10
- else
- FyrMM.pinZoomScale = 1
- end
- if id ~= 0 then
- CurrentMap.MapId = id
- if CurrentMap.TrueMapSize == 1 then
- if FyrMM.SV.MapSizes[CurrentMap.filename] then
- CurrentMap.TrueMapSize = FyrMM.SV.MapSizes[CurrentMap.filename]
- end
- end
- else
- CurrentMap.MapId = 0 -- "unknown"
- if FyrMM.SV.MapSizes == nil then
- FyrMM.SV.MapSizes = {}
- FyrMM.SV.MapSizes[CurrentMap.filename] = 1
- CurrentMap.TrueMapSize = 1
- else
- if FyrMM.SV.MapSizes[CurrentMap.filename] ~= nil then
- CurrentMap.TrueMapSize = FyrMM.SV.MapSizes[CurrentMap.filename]
- end
- end
- end
- CurrentMap.ready = true
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.UpdateMapInfo " .. tostring(GetGameTimeMilliseconds() - t))
- end
- CALLBACK_MANAGER:FireCallbacks("OnFyrMiniMapChanged")
- end
- function FyrMM.GetTileDimensions() -- gets tile scale for map
- local texW, texH = Fyr_MM_Scroll_Map_0:GetTextureFileDimensions() or ((texW < 256 or texH < 256) or (texW > 1024 or texH > 1024) or texW == nil or texH == nil) and CurrentMap.filename and mr and mr[1] or 256, 256 -- 256 = unknown map
- local id = FyrMM.GetMapId()
- local dx, dy = GetMapNumTilesForMapId(id)
- local zoomlevel = CurrentMap.ZoomLevel or FYRMM_DEFAULT_ZOOM_LEVEL
- local tileX = math.floor(zo_round(((zoomlevel / 10) * texW * dx) / dx) / 2) * 2
- local tileY = math.floor(zo_round(((zoomlevel / 10) * texW * dy) / dy) / 2) * 2
- return tileX, tileY
- end
- local Tiles = false
- function FyrMM.UpdateMapTiles(stealth)
- local needRescale = false
- if not stealth and ((not FyrMM.Visible or Fyr_MM:IsHidden()) and not FyrMM.Initialized) then
- return
- end
- if not CurrentMap.ready then
- return
- end
- if string.lower(CurrentMap.filename) == "tamriel_0" then
- return
- end
- local MM_TileSizeW, MM_TileSizeH = FyrMM.GetTileDimensions()
- if Fyr_MM_Scroll_Map_0:GetTextureFileName():lower() == CurrentMap.tiles[1]:lower() and
- zo_round(Fyr_MM_Scroll_Map_0:GetWidth()) == zo_round(MM_TileSizeW) and zo_round(Fyr_MM_Scroll_Map_0:GetHeight()) ==
- zo_round(MM_TileSizeH) then
- if stealth == GetFrameTimeMilliseconds() then
- return
- end
- else
- if zo_round(Fyr_MM_Scroll_Map_0:GetWidth()) ~= zo_round(MM_TileSizeW) or
- zo_round(Fyr_MM_Scroll_Map_0:GetHeight()) ~= zo_round(MM_TileSizeH) then
- CurrentMap.needRescale = true
- end
- end -- nothing to update if same map
- if Tiles then
- return
- end
- Tiles = true
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.UpdateMapTiles " .. tostring(stealth))
- end
- local sa, sb, centerSize
- local i = 0
- local MM_TileSizeW, MM_TileSizeH = FyrMM.GetTileDimensions()
- local mWidth, mHeight = MM_TileSizeW * CurrentMap.Dx, MM_TileSizeH * CurrentMap.Dy
- Fyr_MM_Scroll_Map:SetDimensions(mWidth, mHeight)
- Fyr_MM_Scroll_Map:SetDrawLayer(0) -- 1
- if not FyrMM.SV.WheelMap then
- Fyr_MM_Bg:SetColor(0, 0, 0, 1)
- Fyr_MM_Scroll_WheelNS:SetHidden(true)
- Fyr_MM_Scroll_WheelCenter:SetHidden(true)
- Fyr_MM_Scroll_WheelWE:SetHidden(true)
- else
- Fyr_MM_Bg:SetColor(1, 1, 1, 0)
- Fyr_MM_Border:SetHidden(true)
- sa = Fyr_MM:GetWidth() - ((50 / 512) * Fyr_MM:GetWidth())
- sb = (220 / 512) * Fyr_MM:GetWidth()
- Fyr_MM_Scroll_WheelWE:SetDimensions(sa, sb)
- Fyr_MM_Scroll_WheelNS:SetDimensions(sb, sa)
- Fyr_MM_Frame_Control:SetDimensions(Fyr_MM:GetWidth(), Fyr_MM:GetWidth())
- Fyr_MM_Frame_Wheel:SetDimensions(Fyr_MM:GetWidth() + 8, Fyr_MM:GetWidth() + 8)
- if FyrMM.SV.RotateMap and CurrentMap.Heading then
- Fyr_MM_Frame_Wheel:SetTextureCoordsRotation(CurrentMap.Heading)
- end
- centerSize = math.sqrt(2 * Fyr_MM:GetWidth() * Fyr_MM:GetWidth()) / 2
- Fyr_MM_Scroll_WheelCenter:SetDimensions(centerSize, centerSize)
- if not CurrentMap.PlayerX or not CurrentMap.PlayerY or not CurrentMap.Heading then
- local x, y, pheading = GetMapPlayerPosition("player")
- CurrentMap.PlayerNX = x
- CurrentMap.PlayerNY = y
- CurrentMap.PlayerX, CurrentMap.PlayerY = Fyr_MM_Scroll_Map:GetDimensions()
- CurrentMap.PlayerX = CurrentMap.PlayerX * x
- CurrentMap.PlayerY = CurrentMap.PlayerY * y
- CurrentMap.Heading = smoothHeadingRotation()
- end
- end
- local tilec, tilens, tilewe
- local tileposX, tileposY, x, y
- for a = 1, CurrentMap.Dy do
- for b = 1, CurrentMap.Dx do
- i = i + 1
- local tileControl = GetControl("Fyr_MM_Scroll_Map_" .. tostring(i - 1))
- if tileControl == nil then
- tileControl = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_" .. tostring(i - 1), Fyr_MM_Scroll_Map,
- CT_TEXTURE)
- end
- local tilens = GetControl("Fyr_MM_Scroll_WNS_Map_" .. tostring(i - 1)) -- top & bottom
- if tilens == nil then
- tilens = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_WNS_Map_" .. tostring(i - 1),
- Fyr_MM_Scroll_WheelNS, CT_TEXTURE)
- end
- local tilec = GetControl("Fyr_MM_Scroll_CW_Map_" .. tostring(i - 1)) -- corners
- if tilec == nil then
- tilec = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_CW_Map_" .. tostring(i - 1),
- Fyr_MM_Scroll_WheelCenter, CT_TEXTURE)
- end
- local tilewe = GetControl("Fyr_MM_Scroll_WWE_Map_" .. tostring(i - 1)) -- left and right
- if tilewe == nil then
- tilewe = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_WWE_Map_" .. tostring(i - 1),
- Fyr_MM_Scroll_WheelWE, CT_TEXTURE)
- end
- tileControl:SetHidden(FyrMM.SV.WheelMap)
- tilens:SetHidden(not FyrMM.SV.WheelMap)
- tilec:SetHidden(not FyrMM.SV.WheelMap)
- tilewe:SetHidden(not FyrMM.SV.WheelMap)
- if tileControl:GetTextureFileName():lower() ~= CurrentMap.tiles[i]:lower() then
- tileControl:SetTexture(CurrentMap.tiles[i])
- tilens:SetTexture(CurrentMap.tiles[i])
- tilec:SetTexture(CurrentMap.tiles[i])
- tilewe:SetTexture(CurrentMap.tiles[i])
- end
- tileControl:SetDimensions(FyrMM.GetTileDimensions())
- tilens:SetDimensions(FyrMM.GetTileDimensions())
- tilec:SetDimensions(FyrMM.GetTileDimensions())
- tilewe:SetDimensions(FyrMM.GetTileDimensions())
- tileControl:SetDrawLayer(0)
- tilens:SetDrawLayer(0)
- tilec:SetDrawLayer(0)
- tilewe:SetDrawLayer(0)
- tilens:ClearAnchors()
- tilec:ClearAnchors()
- tilewe:ClearAnchors()
- tileControl:ClearAnchors()
- if FyrMM.SV.RotateMap then
- if not CurrentMap.PlayerX or not CurrentMap.PlayerY or not CurrentMap.Heading then
- local x, y, pheading = GetMapPlayerPosition("player")
- CurrentMap.PlayerNX = x
- CurrentMap.PlayerNY = y
- CurrentMap.PlayerX, CurrentMap.PlayerY = Fyr_MM_Scroll_Map:GetDimensions()
- CurrentMap.PlayerX = CurrentMap.PlayerX * x
- CurrentMap.PlayerY = CurrentMap.PlayerY * y
- CurrentMap.Heading = smoothHeadingRotation()
- end
- x = ((b - 0.5) * mWidth / CurrentMap.Dx) - CurrentMap.PlayerX
- y = ((a - 0.5) * mHeight / CurrentMap.Dy) - CurrentMap.PlayerY
- tileposX = (math.cos(-CurrentMap.Heading) * x) - (math.sin(-CurrentMap.Heading) * y)
- tileposY = (math.sin(-CurrentMap.Heading) * x) + (math.cos(-CurrentMap.Heading) * y)
- tileControl:SetTextureRotation(CurrentMap.Heading, 0.5, 0.5);
- tilens:SetTextureRotation(CurrentMap.Heading, 0.5, 0.5);
- tilec:SetTextureRotation(CurrentMap.Heading, 0.5, 0.5);
- tilewe:SetTextureRotation(CurrentMap.Heading, 0.5, 0.5);
- if FyrMM.SV.MapAlpha > 80 then
- tilens:SetScale(1.0055)
- tilec:SetScale(1.0055)
- tilewe:SetScale(1.0055)
- tileControl:SetScale(1.0055)
- else
- tilens:SetScale(1)
- tilec:SetScale(1)
- tilewe:SetScale(1)
- tileControl:SetScale(1)
- end
- tileControl:SetAnchor(CENTER, Fyr_MM_Scroll, CENTER, tileposX, tileposY)
- tilens:SetAnchor(CENTER, Fyr_MM_Scroll_WheelNS, CENTER, tileposX, tileposY)
- tilec:SetAnchor(CENTER, Fyr_MM_Scroll_WheelCenter, CENTER, tileposX, tileposY)
- tilewe:SetAnchor(CENTER, Fyr_MM_Scroll_WheelWE, CENTER, tileposX, tileposY)
- else
- tileposX = ((b - 0.5) * mWidth / CurrentMap.Dx) - mWidth / 2
- tileposY = ((a - 0.5) * mHeight / CurrentMap.Dy) - mHeight / 2
- tileControl:SetScale(1)
- tilens:SetScale(1)
- tilec:SetScale(1)
- tilewe:SetScale(1)
- tileControl:SetTextureRotation(0)
- tilens:SetTextureRotation(0)
- tilec:SetTextureRotation(0)
- tilewe:SetTextureRotation(0)
- tileControl:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- tilens:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- tilec:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- tilewe:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- tileControl:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- tilens:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- tilec:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- tilewe:SetAnchor(CENTER, Fyr_MM_Scroll_Map, CENTER, tileposX, tileposY)
- end
- end
- end
- for j = i, Fyr_MM_Scroll_Map:GetNumChildren() do
- tileControl = GetControl("Fyr_MM_Scroll_Map_" .. tostring(j))
- tilens = GetControl("Fyr_MM_Scroll_WNS_Map_" .. tostring(j))
- tilec = GetControl("Fyr_MM_Scroll_CW_Map_" .. tostring(j))
- tilewe = GetControl("Fyr_MM_Scroll_WWE_Map_" .. tostring(j))
- if (tileControl) then
- tileControl:ClearAnchors()
- tileControl:SetHidden(true)
- end
- if (tilens) then
- tilens:ClearAnchors()
- tilens:SetHidden(true)
- end
- if (tilec) then
- tilec:ClearAnchors()
- tilec:SetHidden(true)
- end
- if (tilewe) then
- tilewe:ClearAnchors()
- tilewe:SetHidden(true)
- end
- end
- if FyrMM.SV.WheelMap then
- CurrentMap.TextureAngle = CurrentMap.Heading
- else
- CurrentMap.TextureAngle = 0
- end
- Tiles = false
- end
- function FyrMM.GetScrollObject(control)
- if not FyrMM.SV.WheelMap then
- return Fyr_MM_Scroll_WheelCenter
- end
- local xl = control:GetLeft()
- local xr = control:GetRight()
- local yt = control:GetTop()
- local yb = control:GetBottom()
- local scrollWheels = {
- Fyr_MM_Scroll_WheelCenter,
- Fyr_MM_Scroll_WheelNS,
- Fyr_MM_Scroll_WheelWE,
- }
- for _, scrollWheel in ipairs(scrollWheels) do
- if (xr >= scrollWheel:GetLeft() + 6 and xl <= scrollWheel:GetRight() - 10 and yb >=
- scrollWheel:GetTop() + 6 and yt <= scrollWheel:GetBottom() - 10) then
- return scrollWheel
- end
- end
- return Fyr_MM_Scroll_Map
- end
- -----------------------------------------------------------------
- -- Map Pins
- -----------------------------------------------------------------
- local function GetPinTexture(pinType, control)
- if type(ZO_MapPin.PIN_DATA[pinType].texture) == 'string' then
- return ZO_MapPin.PIN_DATA[pinType].texture
- end
- if not type(ZO_MapPin.PIN_DATA[pinType].texture) == 'function' then
- return
- end
- if (control.m_PinTag.isBreadcrumb) then
- return breadcrumbQuestPinTextures[pinType]
- end
- return questPinTextures[pinType]
- end
- local function GetCustomPin()
- local p
- if IsTableEmpty(FreeCustomPinIndex) then
- LastCustomPinIndex = LastCustomPinIndex + 1
- p = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(LastCustomPinIndex))
- if p == nil then
- p = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(LastCustomPinIndex),
- Fyr_MM_Scroll_Map_Pins, CT_TEXTURE)
- p:SetHandler("OnMouseEnter", PinOnMouseEnter)
- p:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- p.Index = LastCustomPinIndex
- return p
- else
- for i, n in pairs(FreeCustomPinIndex) do
- p = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(n))
- if p == nil then
- p = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(n), Fyr_MM_Scroll_Map_Pins,
- CT_TEXTURE)
- p:SetHandler("OnMouseEnter", PinOnMouseEnter)
- p:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- p.Index = n
- FreeCustomPinIndex[i] = nil
- return p
- end
- end
- end
- local function ClearCustomPinReminder() -- never called
- if CustomPinsCopying then
- return
- end
- for i = FyrMM.CustomPinCount + 1, Fyr_MM_Scroll_Map_Pins:GetNumChildren() do
- local l = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(i))
- if l ~= nil then
- if l.BorderPin ~= nil then
- RemoveBorderPin(l.BorderPin)
- end
- l:ClearAnchors()
- l:SetHidden(true)
- l.nX = nil
- l.nY = nil
- l.IsTreasure = nil
- l.IsAvailableQuest = nil
- l.pinTexture = nil
- end
- end
- end
- local ci = 0
- function InsertCustomPin(p, key)
- if p == nil or FyrMM.Reloading then
- return
- end
- if p.m_PinType == nil then
- return
- end
- if ZOpinData == nil then
- return
- end
- if ZOpinData[p.m_PinType] == nil then
- return
- end
- local j = 1
- -- local mapId = CurrentMap.MapId
- local pin, texture, pScalePercent
- pScalePercent = FyrMM.pScalePercent
- if pScalePercent == nil then
- pScalePercent = 1
- end
- local enabled
- if type(p) == "table" then
- if p.IsMapPing then
- -- d("!!!!!!!")
- end
- enabled = true
- if PinRef ~= nil then
- if PRCustomPins ~= nil and p.m_PinType >= MAP_PIN_TYPE_INVALID then
- enabled = PRCustomPins[p.m_PinType].enabled
- end
- else
- if p.m_PinType >= MAP_PIN_TYPE_INVALID then
- enabled = ZO_WorldMap_IsCustomPinEnabled(p.m_PinType) -- checks filter for custom pin
- end
- end
- if CustomPinIndex[p.m_PinType] == nil then
- CustomPinIndex[p.m_PinType] = {}
- end
- if CustomPinKeyIndex[p.m_PinType] == nil then
- CustomPinKeyIndex[p.m_PinType] = {}
- end
- if FyrMM.CustomPinList[p.m_PinType] == nil then
- FyrMM.CustomPinList[p.m_PinType] = {}
- end
- if enabled then
- pin = GetCustomPin()
- if pin.mpin == nil then
- pin.mpin = ZO_MapPin:New(ZO_WorldMapContainer)
- end
- if FyrMM.CustomPinList[p.m_PinType][key] ~= nil then
- FyrMM.CustomPinList[p.m_PinType][key].pin = pin
- end
- j = pin.Index
- if key ~= nil then
- CustomPinKeyIndex[p.m_PinType][key] = j
- end
- FyrMM.CustomPinCount = FyrMM.CustomPinCount + 1
- CustomPinIndex[p.m_PinType][j] = pin
- pin:SetHidden(true) -- updating...
- if pin.BorderPin ~= nil then
- RemoveBorderPin(pin.BorderPin)
- end
- texture = ""
- pin.m_PinType = p.m_PinType
- pin.m_PinTag = p.m_PinTag
- pin.mpin.m_PinType = p.m_PinType
- pin.mpin.m_PinTag = p.m_PinTag
- pin.mpin.normalizedX = p.normalizedX
- pin.mpin.normalizedY = p.normalizedY
- pin.nX = p.normalizedX
- pin.nY = p.normalizedY
- pin.radius = p.radius
- pin.MapId = CurrentMap.MapId
- pin.Index = j
- pin.Key = key
- pin.tint = p.tint
- CustomPinCrossReference[pin.mpin] = pin
- -- pin.GetPinTypeAndTag = function(self) return self.m_PinType, self.m_PinTag end
- if FyrMM.SV.autoResizePin and CurrentMap.MapId ~= 16 and CurrentMap.MapId ~= 660 and GetMapContentType() ~=
- MAP_CONTENT_BATTLEGROUND then
- -- zoom: 1 to 50 default: 10
- FyrMM.pinZoomScale = (CurrentMap.ZoomLevel) / 10
- else
- FyrMM.pinZoomScale = 1
- end
- if not ZO_MapPin.FAST_TRAVEL_WAYSHRINE_PIN_TYPES[pin.m_PinType] and
- not ZO_MapPin.POI_PIN_TYPES[pin.m_PinType] and not pin.m_PinType == MAP_PIN_TYPE_LOCATION then
- pin.noZoomResize = true
- end
- if ZOpinData[p.m_PinType].size ~= nil then
- FyrMM.SetPinSize(pin, ZOpinData[p.m_PinType].size * pScalePercent * FyrMM.pinZoomScale)
- end
- if type(ZOpinData[p.m_PinType].texture) == 'string' then
- texture = ZOpinData[p.m_PinType].texture
- elseif type(ZOpinData[p.m_PinType].texture) == 'function' then
- texture = ZOpinData[p.m_PinType].texture(pin.mpin)
- end
- if p.m_PinType == MAP_PIN_TYPE_PLAYER_WAYPOINT then
- texture = "EsoUI/Art/MapPins/UI_Worldmap_pin_customDestination.dds"
- FyrMM.IsWaypoint = true
- FyrMM.SetPinSize(pin, ZOpinData[p.m_PinType].minSize * pScalePercent)
- if FyrMM.Waypoint ~= nil then
- if FyrMM.Waypoint.BorderPin ~= nil then
- RemoveBorderPin(FyrMM.Waypoint.BorderPin)
- end
- end
- FyrMM.Waypoint = pin
- end
- if p.m_PinType == MAP_PIN_TYPE_RALLY_POINT then
- texture = "MiniMap/Textures/rally.dds"
- FyrMM.SetPinSize(pin, (ZOpinData[MAP_PIN_TYPE_RALLY_POINT].minSize / 3) * pScalePercent)
- FyrMM.IsRally = true
- if FyrMM.Rally ~= nil then
- if FyrMM.Rally.BorderPin ~= nil then
- RemoveBorderPin(FyrMM.Rally.BorderPin)
- end
- end
- FyrMM.Rally = pin
- end
- if p.m_PinType == MAP_PIN_TYPE_PING then
- texture = "MiniMap/Textures/ping.dds"
- FyrMM.SetPinSize(pin, ZOpinData[p.m_PinType].minSize * pScalePercent)
- FyrMM.IsPing = true
- if FyrMM.Ping ~= nil then
- if FyrMM.Ping.BorderPin ~= nil then
- RemoveBorderPin(FyrMM.Ping.BorderPin)
- end
- end
- FyrMM.Ping = pin
- end
- pin.pinTexture = texture
- pin:SetTexture(texture)
- if (PRCustomPins and PRCustomPins[p.m_PinType] and PRCustomPins[p.m_PinType].pinTypeString and
- string.find(PRCustomPins[p.m_PinType].pinTypeString, "LostTreasure")) or
- string.find(texture, "MapPins/Treasure_") then
- pin.IsTreasure = true
- -- pin.MapId = p.m_PinTag.mapId -- was a bad idea
- pin.noZoomResize = true
- table.insert(Treasures, pin)
- end
- if string.find(texture, "dragonNextLocation") then
- pin.IsDragonNextLocation = true
- table.insert(DragonNextLocation, pin)
- end
- pin:SetColor(1, 1, 1, 1)
- if ZOpinData[p.m_PinType].tint ~= nil then -- compatibility with addons which modify pin colors by type
- if type(ZOpinData[p.m_PinType].tint) ~= "function" then
- pin:SetColor(ZOpinData[p.m_PinType].tint:UnpackRGBA())
- else
- local c = ZOpinData[p.m_PinType].tint(pin.mpin)
- if type(c) == "table" then
- pin:SetColor(c.r, c.g, c.b, c.a)
- end
- end
- end
- if p.tint then -- compatibility with addons which modify pin colors by pin
- if type(p.tint) ~= "function" then
- pin:SetColor(p.tint:UnpackRGBA())
- else
- if type(p.tint) == "table" then
- pin:SetColor(p.tint.r, p.tint.g, p.tint.b, p.tint.a)
- end
- end
- end
- if type(p.m_PinTag) == "table" then -- suggested
- if p.m_PinTag.IsAvailableQuest or p.m_PinTag.isZoneStory or ZO_MapPin.SUGGESTION_PIN_TYPES[p.m_PinType] then
- pin.m_PinTag.IsAvailableQuest = true
- pin.IsAvailableQuest = true
- if ZO_MapPin.SUGGESTION_PIN_TYPES[p.m_PinType] and
- not IsZoneStoryComplete(GetZoneId(GetUnitZoneIndex("player"))) then
- pin.m_PinTag.isZoneStory = true
- local _, _, activityId = GetTrackedZoneStoryActivityInfo()
- pin.m_PinTag.activityId = activityId
- FyrMM.ZoneStoryPin = pin
- end
- table.insert(FyrMM.AvailableQuestGivers, pin)
- if p.radius and p.radius > 0 and p.m_PinType then
- local properType, pinTexture, size = FyrMM.GetQuestPinInfo(p.m_PinType, false, false, p.radius)
- local areaPin = pin
- areaPin:SetTexture(pinTexture)
- areaPin:SetDimensions(size, size)
- local color = ZO_MAP_PIN_NORMAL_COLOR
- areaPin:SetColor(color:UnpackRGBA())
- if FyrMM.SV.WheelMap then
- areaPin:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- FyrMM.CreateSuggestedAreaSidePins(areaPin, p.radius)
- end
- table.insert(FyrMM.AvailableQuestGivers, areaPin)
- end
- end
- end
- FyrMM.SetPinAnchor(pin, pin.nX, pin.nY, Fyr_MM_Scroll_Map_Pins)
- local pinHidden = true
- if FyrMM.SV.WheelMap then
- pin:SetHidden(not Is_PinInsideWheel(pin) and pinHidden)
- else
- pin:SetHidden(not pinHidden)
- end
- pin:SetMouseEnabled(true)
- if (FyrMM.IsWaypoint or FyrMM.IsRally or FyrMM.IsPing) and FyrMM.SV.BorderPinsWaypoint then
- FyrMM.PlaceWaypointBorderPins()
- end
- else
- if pin ~= nil then
- if pin.BorderPin ~= nil then
- RemoveBorderPin(pin.BorderPin)
- end
- pin:ClearAnchors()
- pin:SetHidden(true)
- pin.nX = nil
- pin.nY = nil
- pin.MapId = nil
- pin.Index = nil
- pin.IsTreasure = nil
- pin.IsAvailableQuest = nil
- pin.pinTexture = nil
- PinsList[pin:GetName()] = nil
- end
- end
- end
- end
- function FyrMM.CustomPins()
- if FyrMM.Halted or not FyrMM.Visible or Fyr_MM:IsHidden() or FyrMM.worldMapShowing then
- return
- end
- local gameTime = GetGameTimeMilliseconds()
- local function DebugMessage()
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "FyrMM.CustomPins " .. tostring(GetGameTimeMilliseconds() - gameTime))
- end
- if IsTableEmpty(FyrMM.CustomPinList) or IsCustomPinsLoading() then
- if FyrMM.DebugMode then
- DebugMessage()
- end
- return
- end
- Treasures = {}
- DragonNextLocation = {}
- FyrMM.AvailableQuestGivers = {}
- FyrMM.CustomPinCount = 0
- -- FreeCustomPinIndex = {}
- CustomPinIndex = {}
- -- LastCustomPinIndex = 0
- local function ProcessPin(t, n, i, v)
- if v.pin == nil then
- InsertCustomPin(v, i)
- return
- end
- local pin = v.pin
- local pinType = pin.m_PinType
- if not pinType then
- return
- end
- local Index = pin.Index
- Index = CustomPinKeyIndex[pinType][i] -- TEST there was a bug here especially with square maps 02/01/2023
- local Key = pin.Key or i -- TEST there was a bug here especially with square maps 02/01/2023
- pin.Key = Key
- pin.Index = Index
- if FyrMM.UpdatingCustomPins[pinType] then
- return
- end
- if CustomPinIndex[pinType] == nil then
- CustomPinIndex[pinType] = {}
- end
- CustomPinIndex[pinType][Index] = pin
- CustomPinKeyIndex[pinType][Key] = Index
- FyrMM.CustomPinCount = FyrMM.CustomPinCount + 1
- if type(pin.m_PinTag) == "table" and
- (pin.m_PinTag.IsAvailableQuest or pin.m_PinTag.isZoneStory or ZO_MapPin.SUGGESTION_PIN_TYPES[pin.m_PinType]) then
- pin.m_PinTag.IsAvailableQuest = true
- pin.IsAvailableQuest = true
- if pin.m_PinTag.isZoneStory and CanZoneStoryContinueTrackingActivities(GetZoneId(GetCurrentMapZoneIndex())) then
- local _, _, activityId = GetTrackedZoneStoryActivityInfo()
- if pin.m_PinTag.activityId == activityId or pin.m_PinTag[3] == activityId then
- FyrMM.ZoneStoryPin = pin
- else
- if pin == FyrMM.ZoneStoryPin then
- if pin.tertiaryPin then
- RemoveCustomPin(pin.tertiaryPin)
- end
- if pin.secondaryPin then
- RemoveCustomPin(pin.secondaryPin)
- end
- if pin.primaryPin then
- RemoveCustomPin(pin.primaryPin)
- end
- RemoveCustomPin(pin)
- FyrMM.ZoneStoryPin = nil
- end
- end
- else
- if pin == FyrMM.ZoneStoryPin then
- if pin.tertiaryPin then
- RemoveCustomPin(pin.tertiaryPin)
- end
- if pin.secondaryPin then
- RemoveCustomPin(pin.secondaryPin)
- end
- if pin.primaryPin then
- RemoveCustomPin(pin.primaryPin)
- end
- RemoveCustomPin(pin)
- FyrMM.ZoneStoryPin = nil
- end
- end
- table.insert(FyrMM.AvailableQuestGivers, pin)
- end
- if (pin.pinTexture and string.find(pin.pinTexture, "MapPins/Treasure_")) or
- (PRCustomPins and PRCustomPins[pin.m_PinType] and PRCustomPins[pin.m_PinType].pinTypeString and
- string.find(PRCustomPins[pin.m_PinType].pinTypeString, "LostTreasure")) then
- table.insert(Treasures, pin)
- end
- if pin.pinTexture and string.find(pin.pinTexture, "dragonNextLocation") then
- table.insert(DragonNextLocation, pin)
- end
- end
- for t, n in pairs(FyrMM.CustomPinList) do
- if not FyrMM.UpdatingCustomPins[t] then
- for i, v in pairs(n) do
- ProcessPin(t, n, i, v)
- end
- end
- end
- if FyrMM.DebugMode then
- DebugMessage()
- end
- end
- ------------------------------------------------------------
- -- Waypoint/Rally Pins
- -----------------------------------------------------------
- function FyrMM.WaypointPins()
- local wpx, wpy = GetMapPlayerWaypoint()
- if wpx ~= 0 or wpy ~= 0 then
- local waypointPin
- waypointPin = GetControl("Fyr_MM_Scroll_Map_Pins_PlayerWaypoint")
- if waypointPin == nil then
- waypointPin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_PlayerWaypoint", Fyr_MM_Scroll_Map_Pins,
- CT_TEXTURE)
- waypointPin.nDistance = function(self)
- if self.nX == nil then
- return 1
- end
- return math.sqrt((zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) +
- (zo_round(CurrentMap.PlayerNY * 10000) - zo_round(self.nY * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nY * 10000))) / 10000
- end
- waypointPin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- waypointPin:SetHandler("OnMouseExit", PinOnMouseExit)
- waypointPin:SetHandler("OnMouseUp", PinOnMouseUp)
- end
- local pin
- local pinSize = ZOpinData[MAP_PIN_TYPE_PLAYER_WAYPOINT].minSize * FyrMM.pScalePercent
- if waypointPin.m_Pin then
- pin = waypointPin.m_Pin
- else
- pin = ZO_Object.New(ZO_MapPin)
- end
- pin.m_PinType = MAP_PIN_TYPE_PLAYER_WAYPOINT
- pin.m_PinTag = "waypoint"
- pin.nX = wpx
- pin.nY = wpy
- waypointPin.m_Pin = pin
- waypointPin.MapId = CurrentMap.MapId
- waypointPin.nX = wpx
- waypointPin.nY = wpy
- waypointPin.m_PinType = MAP_PIN_TYPE_PLAYER_WAYPOINT
- waypointPin:SetDrawLayer(1)
- FyrMM.SetPinSize(waypointPin, pinSize, 0)
- waypointPin:SetTexture("EsoUI/Art/MapPins/UI_WorldMap_pin_customDestination.dds")
- waypointPin:SetHidden(false)
- FyrMM.SetPinAnchor(waypointPin, wpx, wpy, Fyr_MM_Scroll_Map_Pins)
- waypointPin:SetMouseEnabled(true)
- FyrMM.Waypoint = waypointPin
- FyrMM.IsWaypoint = true
- else
- FyrMM.Waypoint = nil
- FyrMM.IsWaypoint = false
- local waypointPin
- waypointPin = GetControl("Fyr_MM_Scroll_Map_Pins_PlayerWaypoint")
- if waypointPin then
- waypointPin.m_Pin = nil
- waypointPin.MapId = 0
- waypointPin.nX = 0
- waypointPin.nY = 0
- waypointPin.m_PinType = 0
- waypointPin:SetTexture("")
- waypointPin:SetHidden(true)
- end
- end
- wpx, wpy = GetMapRallyPoint()
- if wpx ~= 0 or wpy ~= 0 then
- local RallyPin
- RallyPin = GetControl("Fyr_MM_Scroll_Map_Pins_RallyPoint")
- if RallyPin == nil then
- RallyPin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_RallyPoint", Fyr_MM_Scroll_Map_Pins,
- CT_TEXTURE)
- RallyPin.nDistance = function(self)
- if self.nX == nil then
- return 1
- end
- return math.sqrt((zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) +
- (zo_round(CurrentMap.PlayerNY * 10000) - zo_round(self.nY * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nY * 10000))) / 10000
- end
- RallyPin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- RallyPin:SetHandler("OnMouseExit", PinOnMouseExit)
- RallyPin:SetHandler("OnMouseUp", PinOnMouseUp)
- end
- local pin
- local pinSize = (ZOpinData[MAP_PIN_TYPE_RALLY_POINT].minSize / 3) * FyrMM.pScalePercent
- if RallyPin.m_Pin then
- pin = RallyPin.m_Pin
- else
- pin = ZO_Object.New(ZO_MapPin)
- end
- pin.m_PinType = MAP_PIN_TYPE_RALLY_POINT
- pin.m_PinTag = "rally"
- pin.nX = wpx
- pin.nY = wpy
- RallyPin.m_Pin = pin
- RallyPin.MapId = CurrentMap.MapId
- RallyPin.nX = wpx
- RallyPin.nY = wpy
- RallyPin.m_PinType = MAP_PIN_TYPE_RALLY_POINT
- RallyPin:SetDrawLayer(1)
- FyrMM.SetPinSize(RallyPin, pinSize, 0)
- RallyPin:SetTexture("MiniMap/Textures/rally.dds")
- RallyPin:SetHidden(false)
- FyrMM.SetPinAnchor(RallyPin, wpx, wpy, Fyr_MM_Scroll_Map_Pins)
- RallyPin:SetMouseEnabled(true)
- FyrMM.Rally = RallyPin
- FyrMM.IsRally = true
- else
- FyrMM.Rally = nil
- FyrMM.IsRally = false
- local RallyPin
- RallyPin = GetControl("Fyr_MM_Scroll_Map_Pins_RallyPoint")
- if RallyPin then
- RallyPin.m_Pin = nil
- RallyPin.MapId = 0
- RallyPin.nX = 0
- RallyPin.nY = 0
- RallyPin.m_PinType = 0
- RallyPin:SetTexture("")
- RallyPin:SetHidden(true)
- end
- end
- wpx, wpy = GetMapPing()
- if wpx ~= 0 or wpy ~= 0 then
- local PingPin
- PingPin = GetControl("Fyr_MM_Scroll_Map_Pins_Ping")
- if PingPin == nil then
- PingPin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_Ping", Fyr_MM_Scroll_Map_Pins, CT_TEXTURE)
- PingPin.nDistance = function(self)
- if self.nX == nil then
- return 1
- end
- return math.sqrt((zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) +
- (zo_round(CurrentMap.PlayerNY * 10000) - zo_round(self.nY * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nY * 10000))) / 10000
- end
- PingPin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- PingPin:SetHandler("OnMouseExit", PinOnMouseExit)
- PingPin:SetHandler("OnMouseUp", PinOnMouseUp)
- end
- local pin
- local pinSize = ZOpinData[MAP_PIN_TYPE_PING].minSize * FyrMM.pScalePercent
- if PingPin.m_Pin then
- pin = PingPin.m_Pin
- else
- pin = ZO_Object.New(ZO_MapPin)
- end
- pin.m_PinType = MAP_PIN_TYPE_PING
- pin.m_PinTag = "rally"
- pin.nX = wpx
- pin.nY = wpy
- PingPin.m_Pin = pin
- PingPin.MapId = CurrentMap.MapId
- PingPin.nX = wpx
- PingPin.nY = wpy
- PingPin.m_PinType = MAP_PIN_TYPE_PING
- PingPin:SetDrawLayer(1)
- FyrMM.SetPinSize(PingPin, pinSize, 0)
- PingPin:SetTexture("MiniMap/Textures/ping.dds")
- PingPin:SetHidden(false)
- FyrMM.SetPinAnchor(PingPin, wpx, wpy, Fyr_MM_Scroll_Map_Pins)
- PingPin:SetMouseEnabled(true)
- FyrMM.Ping = PingPin
- FyrMM.IsPing = true
- else
- FyrMM.Ping = nil
- FyrMM.IsPing = false
- local PingPin
- PingPin = GetControl("Fyr_MM_Scroll_Map_Pins_Ping")
- if PingPin then
- PingPin.m_Pin = nil
- PingPin.MapId = 0
- PingPin.nX = 0
- PingPin.nY = 0
- PingPin.m_PinType = 0
- PingPin:SetTexture("")
- PingPin:SetHidden(true)
- end
- end
- end
- ------------------------------------------------------------
- -- Wayshrine Pins
- -----------------------------------------------------------
- function FyrMM.UpdateWayshrinePinPositions()
- if not FyrMM.Visible or Fyr_MM:IsHidden() or FyrMM.worldMapShowing then
- return
- end
- local currentZone = CurrentMap.MapId
- for i = 1, FyrMM.currentWayshrineCount do
- local l = GetControl("Fyr_MM_Scroll_Map_WayshrinePins_Pin" .. tostring(i))
- if l ~= nil then
- if l.MapId == currentZone then
- l:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_WAYSHRINES))
- FyrMM.SetPinAnchor(l, l.nX, l.nY, Fyr_MM_Scroll_Map_WayshrinePins)
- else
- l:SetHidden(true)
- l:ClearAnchors()
- end
- end
- end
- end
- local function CreateWayshrinePin(pinType, tag, nX, nY, isRealWayshrine)
- local wayshrinePin
- wayshrinePin = GetControl("Fyr_MM_Scroll_Map_WayshrinePins_Pin" .. tostring(FyrMM.currentWayshrineCount))
- if wayshrinePin == nil then
- wayshrinePin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_WayshrinePins_Pin" ..
- tostring(FyrMM.currentWayshrineCount),
- Fyr_MM_Scroll_Map_WayshrinePins, CT_TEXTURE)
- wayshrinePin.nDistance = function(self)
- if self.nX == nil then
- return 1
- end
- return math.sqrt((zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) +
- (zo_round(CurrentMap.PlayerNY * 10000) - zo_round(self.nY * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nY * 10000))) / 10000
- end
- wayshrinePin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- wayshrinePin:SetHandler("OnMouseExit", PinOnMouseExit)
- wayshrinePin:SetHandler("OnMouseUp", PinOnMouseUp)
- end
- local pin = ZO_Object.New(ZO_MapPin)
- local pinSize = 40 * FyrMM.pScalePercent * FyrMM.pinZoomScale
- pin.m_PinType = pinType
- pin.m_PinTag = tag
- pin.nX = nX
- pin.nY = nY
- wayshrinePin.m_Pin = pin
- wayshrinePin.MapId = CurrentMap.MapId
- wayshrinePin.nX = nX
- wayshrinePin.nY = nY
- wayshrinePin.m_PinType = pinType
- wayshrinePin:SetDrawLayer(1)
- FyrMM.SetPinSize(wayshrinePin, pinSize, 0)
- wayshrinePin:SetTexture(tag[2])
- wayshrinePin.isRealWayshrine = isRealWayshrine
- local wayshrinePinData = ZOpinData[pinType]
- if wayshrinePinData.tint then -- compatibility with addons which modifies wayshrines colors
- if type(wayshrinePinData.tint) ~= "function" then
- wayshrinePin:SetColor(wayshrinePinData.tint:UnpackRGBA())
- else
- if wayshrinePin.m_Pin ~= nil then
- wayshrinePin:SetColor(wayshrinePinData.tint(wayshrinePin.m_Pin):UnpackRGBA())
- else
- wayshrinePin:SetColor(wayshrinePinData.tint(wayshrinePin):UnpackRGBA())
- end
- end
- else
- wayshrinePin:SetColor(1, 1, 1, 1)
- end
- wayshrinePin:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_WAYSHRINES))
- FyrMM.SetPinAnchor(wayshrinePin, nX, nY, Fyr_MM_Scroll_Map_WayshrinePins)
- wayshrinePin:SetMouseEnabled(true)
- Wayshrines[FyrMM.currentWayshrineCount] = {
- Closest = false,
- nDistance = 1,
- tag = tag,
- nX = nX,
- nY = nY,
- MapId = CurrentMap.MapId,
- pin = wayshrinePin,
- isRealWayshrine = isRealWayshrine
- }
- end
- function FyrMM.Wayshrines()
- if FyrMM.Halted or GetNumFastTravelNodes() == 0 then
- return
- end
- if not FyrMM.Visible or Fyr_MM:IsHidden() or FyrMM.worldMapShowing then
- return
- end
- local t = GetGameTimeMilliseconds()
- FyrMM.SetMapToPlayerLocation()
- FyrMM.currentWayshrineCount = 0
- Wayshrines = {}
- if string.lower(CurrentMap.filename) ~= "giantsrun_base_0" then
- for nodeIndex = 1, GetNumFastTravelNodes() do
- local known, name, nX, nY, icon, glowIcon, poiType, isShownInCurrentMap = GetFastTravelNodeInfo(nodeIndex)
- if known or FyrMM.SV.ShowUnexploredPins then
- local isRealWayshrine = false
- if poiType == POI_TYPE_WAYSHRINE and isShownInCurrentMap then
- isRealWayshrine = true
- end -- and icon and string.find(icon, "wayshrine")
- if not known and poiType ~= POI_TYPE_HOUSE and poiType ~= POI_TYPE_GROUP_DUNGEON then
- icon = "/esoui/art/icons/poi/poi_wayshrine_incomplete.dds"
- glowIcon = "/esoui/art/icons/poi/poi_wayshrine_glow.dds"
- end
- if not known and poiType == POI_TYPE_HOUSE then
- icon = "/esoui/art/icons/poi/poi_group_house_unowned.dds"
- glowIcon = "/esoui/art/icons/poi/poi_group_house_unowned_glow.dds"
- end
- if not known and poiType == POI_TYPE_GROUP_DUNGEON then
- icon = "/esoui/art/icons/poi/poi_groupinstance_incomplete.dds"
- glowIcon = "/esoui/art/icons/poi/poi_groupinstance_incomplete_glow.dds"
- end
- local tag = ZO_MapPin.CreateTravelNetworkPinTag(nodeIndex, icon, glowIcon)
- local pinType = MAP_PIN_TYPE_FAST_TRAVEL_WAYSHRINE
- if nX > 0 and nX < 1.0001 and nY > 0 and nY < 1.0001 and isShownInCurrentMap then
- FyrMM.currentWayshrineCount = FyrMM.currentWayshrineCount + 1
- CreateWayshrinePin(pinType, tag, nX, nY, isRealWayshrine)
- end
- end
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "FyrMM.Wayshrines (" .. tostring(GetNumFastTravelNodes()) .. ") " .. tostring(GetGameTimeMilliseconds() - t))
- end
- CleanupWayshrines()
- end
- ------------------------------------------------------------
- -- POI Pins
- ------------------------------------------------------------
- function FyrMM.UpdatePOIPinPositions()
- for i = 1, FyrMM.currentPOICount do
- local l = GetControl("Fyr_MM_Scroll_Map_POIPins_Pin" .. tostring(i))
- if l ~= nil then
- if l.MapId == CurrentMap.MapId then
- l:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_OBJECTIVES))
- FyrMM.SetPinAnchor(l, l.nX, l.nY, Fyr_MM_Scroll_Map_POIPins)
- else
- l:SetHidden(true)
- l:ClearAnchors()
- end
- end
- end
- end
- local function CreatePOIPin(poiIndex)
- local POIPin
- local nX, nY, iconType, icon = MM_GetPOIMapInfo(CurrentMap.ZoneIndex, poiIndex)
- if CraftingStations ~= nil and icon and zo_strfind(icon, "icons/poi/poi_crafting_") then
- return
- end -- Crafting stations mix-up fix by Garkin
- if not (ZO_MapPin.POI_PIN_TYPES[iconType]) and FyrMM.SV.ShowUnexploredPins then
- icon = "/esoui/art/inventory/newitem_icon.dds"
- iconType = MAP_PIN_TYPE_POI_SEEN
- end
- if nX > 0 and nX < 1.0001 and nY > 0 and nY < 1.0001 and (ZO_MapPin.POI_PIN_TYPES[iconType]) then
- if (not IsPOIWayshrine(CurrentMap.ZoneIndex, poiIndex) or iconType == MAP_PIN_TYPE_POI_SEEN) then
- FyrMM.currentPOICount = FyrMM.currentPOICount + 1
- local tag = ZO_MapPin.CreatePOIPinTag(CurrentMap.ZoneIndex, poiIndex, icon)
- POIPin = GetControl("Fyr_MM_Scroll_Map_POIPins_Pin" .. tostring(FyrMM.currentPOICount))
- if POIPin == nil then
- POIPin = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_POIPins_Pin" .. tostring(FyrMM.currentPOICount), Fyr_MM_Scroll_Map_POIPins,
- CT_TEXTURE)
- POIPin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- POIPin:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- local pin = ZO_Object.New(ZO_MapPin)
- local pinSize = 40 * FyrMM.pScalePercent * FyrMM.pinZoomScale
- if icon == "/esoui/art/inventory/newitem_icon.dds" then
- pinSize = 32 * FyrMM.pScalePercent * FyrMM.pinZoomScale
- POIPin:SetColor(FyrMM.SV.UndiscoveredPOIPinColor.r, FyrMM.SV.UndiscoveredPOIPinColor.g,
- FyrMM.SV.UndiscoveredPOIPinColor.b, FyrMM.SV.UndiscoveredPOIPinColor.a)
- else
- POIPin:SetColor(1, 1, 1, 1)
- end
- POIPin.poiIndex = poiIndex
- pin.m_PinType = iconType
- pin.m_PinTag = tag
- POIPin.m_Pin = pin
- POIPin.MapId = CurrentMap.MapId
- POIPin.nX = nX
- POIPin.nY = nY
- POIPin.m_PinType = iconType
- POIPin:SetDrawLayer(1)
- FyrMM.SetPinSize(POIPin, pinSize, 0)
- POIPin:SetTexture(icon)
- local POIPinData = ZOpinData[iconType]
- if POIPinData.tint then -- compatibility with addons which modifies POI colors
- if type(POIPinData.tint) ~= "function" then
- POIPin:SetColor(POIPinData.tint:UnpackRGBA())
- else
- if POIPin.m_Pin ~= nil then
- POIPin:SetColor(POIPinData.tint(POIPin.m_Pin):UnpackRGBA())
- else
- POIPin:SetColor(POIPinData.tint(POIPin):UnpackRGBA())
- end
- end
- else
- POIPin:SetColor(1, 1, 1, 1)
- end
- POIPin:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_OBJECTIVES))
- FyrMM.SetPinAnchor(POIPin, nX, nY, Fyr_MM_Scroll_Map_POIPins)
- POIPin:SetMouseEnabled(true)
- end
- end
- end
- function FyrMM.POIPins()
- if FyrMM.Halted or MM_GetNumPOIs(CurrentMap.ZoneIndex) == 0 then
- return
- end
- local t = GetGameTimeMilliseconds()
- FyrMM.currentPOICount = 0
- FyrMM.API_Check()
- FyrMM.SetMapToPlayerLocation()
- if string.lower(CurrentMap.filename) ~= "giantsrun_base_0" then
- for i = 1, MM_GetNumPOIs(CurrentMap.ZoneIndex) do
- if FyrMM.Reloading then
- return
- end
- CreatePOIPin(i)
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "FyrMM.POIPins (" .. tostring(MM_GetNumPOIs(CurrentMap.ZoneIndex)) .. ") " ..
- tostring(GetGameTimeMilliseconds() - t))
- end
- if FyrMM.currentPOICount == 0 and Fyr_MM_Scroll_Map_POIPins:GetNumChildren() == CleanPOIs then
- return
- end
- CleanPOIs = 0
- CleanupPOIs()
- -- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapPOIPinsD")
- end
- local function DelayedPOIPins()
- zo_callLater(FyrMM.POIPins, 300) -- WORKAROUND 18/07/2022
- -- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapPOIPinsD", 300, FyrMM.POIPins)
- end
- ------------------------------------------------------------
- -- Location Pins
- ------------------------------------------------------------
- function FyrMM.UpdateLocationPinPositions()
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "MM_UpdateLocationPinPositions (" ..
- tostring(FyrMM.currentLocationsCount) .. ") ")
- end
- for i = 1, FyrMM.currentLocationsCount do
- local l = GetControl("Fyr_MM_Scroll_Map_LocationPins_Pin" .. tostring(i))
- if l ~= nil then
- if l.MapId == CurrentMap.MapId then
- if FyrMM.SV.ShowUnexploredPins then
- l:SetHidden(false)
- else
- if l:IsHidden() then
- l:SetHidden(not MM_IsMapLocationVisible(i))
- end
- end
- FyrMM.SetPinAnchor(l, l.nX, l.nY, Fyr_MM_Scroll_Map_LocationPins)
- else
- l:SetHidden(true)
- l:ClearAnchors()
- end
- end
- end
- end
- local function AddLocation(locationIndex)
- local locationPin, isExperienceBoost
- local ll = GetNumMapLocationTooltipLines(locationIndex)
- if ll >= 1 then
- local c1, c2, c3, cN = GetMapLocationTooltipLineInfo(locationIndex, 1)
- if cN == "Experience Boost" then
- return
- end
- end
- if (MM_IsMapLocationVisible(locationIndex) or FyrMM.SV.ShowUnexploredPins) then
- local icon, x, y = MM_GetMapLocationIcon(locationIndex)
- if icon ~= "" and x > 0 and x < 1.0001 and y > 0 and y < 1.0001 then
- FyrMM.currentLocationsCount = FyrMM.currentLocationsCount + 1
- local tag = ZO_MapPin.CreateLocationPinTag(locationIndex, icon)
- locationPin = GetControl("Fyr_MM_Scroll_Map_LocationPins_Pin" .. tostring(FyrMM.currentLocationsCount))
- if locationPin == nil then
- locationPin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_LocationPins_Pin" ..
- tostring(FyrMM.currentLocationsCount),
- Fyr_MM_Scroll_Map_LocationPins, CT_TEXTURE)
- locationPin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- locationPin:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- local pinSize = 36 * FyrMM.pScalePercent * FyrMM.pinZoomScale
- local pin = ZO_Object.New(ZO_MapPin)
- locationPin.locationIndex = locationIndex
- pin.m_PinType = MAP_PIN_TYPE_LOCATION
- pin.m_PinTag = tag
- locationPin.m_Pin = pin
- locationPin.m_PinType = MAP_PIN_TYPE_LOCATION
- locationPin.m_PinTag = tag
- locationPin.MapId = CurrentMap.MapId
- locationPin.nX = x
- locationPin.nY = y
- FyrMM.SetPinSize(locationPin, pinSize, 0)
- locationPin:SetDrawLayer(1)
- locationPin:SetTexture(icon)
- locationPin.IsCraftingServicePin = IsCraftingService(locationPin)
- if tag[2] ~= nil then
- if string.sub(tag[2], -8) == "bank.dds" then
- locationPin.IsBankPin = true
- else
- locationPin.IsBankPin = false
- end
- if string.sub(tag[2], -10) == "stable.dds" then
- locationPin.IsStablePin = true
- else
- locationPin.IsStablePin = false
- end
- end
- if string.sub(icon, 1, 5) ~= "ZGESO" then -- string.sub(icon, 1, 17) ~= "ZygorGuidesViewer"
- if FyrMM.SV.ShowUnexploredPins then
- locationPin:SetHidden(false)
- else
- if locationPin:IsHidden() then
- locationPin:SetHidden(not MM_IsMapLocationVisible(i))
- end
- end
- else
- locationPin:SetHidden(false)
- locationPin.isZGESO = true
- end
- local locationPinData = ZOpinData[locationPin.m_PinType]
- if locationPinData.tint then -- compatibility with addons which modifies locations colors
- if type(locationPinData.tint) ~= "function" then
- locationPin:SetColor(locationPinData.tint:UnpackRGBA())
- else
- if locationPin.m_Pin ~= nil then
- locationPin:SetColor(locationPinData.tint(locationPin.m_Pin):UnpackRGBA())
- else
- locationPin:SetColor(locationPinData.tint(locationPin):UnpackRGBA())
- end
- end
- else
- locationPin:SetColor(1, 1, 1, 1)
- end
- FyrMM.SetPinAnchor(locationPin, x, y, Fyr_MM_Scroll_Map_LocationPins)
- locationPin:SetMouseEnabled(true)
- end
- end
- end
- function FyrMM.LocationPins()
- if FyrMM.Halted or MM_GetNumMapLocations() == 0 then
- return
- end -- delay if still halted
- local t = GetGameTimeMilliseconds()
- FyrMM.currentLocationsCount = 0
- FyrMM.API_Check()
- FyrMM.SetMapToPlayerLocation()
- if string.lower(CurrentMap.filename) ~= "giantsrun_base_0" then
- for i = 1, MM_GetNumMapLocations() do
- if FyrMM.Reloading then
- return
- end
- AddLocation(i)
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "FyrMM.LocationPins (" .. tostring(MM_GetNumMapLocations()) .. ") " ..
- tostring(GetGameTimeMilliseconds() - t))
- end
- CleanupMapLocations()
- end
- ------------------------------------------------------------
- -- Event Units (Dragons, Cartoklepts)
- ------------------------------------------------------------
- local function RemoveEventUnitPins()
- local num = Fyr_MM_Scroll_Map_EventUnits:GetNumChildren()
- local i, pin
- for i = 1, num do
- pin = Fyr_MM_Scroll_Map_EventUnits:GetChild(i)
- if pin ~= nil then
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- pin.nX = nil
- pin.nY = nil
- pin.unitTag = nil
- pin.nTag = nil
- pin.context = nil
- pin.m_PinType = nil
- if pin.textureAntl then
- pin.textureAntl:Stop()
- pin.textureAntl = nil
- end
- if pin.OnBorder then
- if pin.BorderPin then
- if pin.BorderPin.textureAntl then
- pin.BorderPin.textureAntl:Stop()
- pin.BorderPin.textureAntl = nil
- end
- pin.BorderPin:ClearAnchors()
- pin.BorderPin:SetHidden()
- pin.BorderPin.pin = nil
- pin.BorderPin = nil
- end
- pin.OnBorder = nil
- end
- end
- end
- end
- local function GetNextWorldEventInstanceIdIter(state, var1)
- return GetNextWorldEventInstanceId(var1)
- end
- local function AddWorldEvent(worldEventInstanceId)
- if ZO_WorldMap_DoesMapHideWorldEventPins() then
- return
- end
- local context = GetWorldEventLocationContext(worldEventInstanceId)
- if context == WORLD_EVENT_LOCATION_CONTEXT_UNIT then
- local numUnits = GetNumWorldEventInstanceUnits(worldEventInstanceId)
- for i = 1, numUnits do
- local unitTag = GetWorldEventInstanceUnitTag(worldEventInstanceId, i)
- local pinType = GetWorldEventInstanceUnitPinType(worldEventInstanceId, unitTag)
- local zoneIndex, poiIndex = GetWorldEventPOIInfo(worldEventInstanceId)
- local pin
- if pinType ~= MAP_PIN_TYPE_INVALID then
- local xLoc, yLoc, _, isInCurrentMap = GetMapPlayerPosition(unitTag)
- if isInCurrentMap then
- local tag = ZO_MapPin.CreateWorldEventUnitPinTag(worldEventInstanceId, unitTag)
- if GetControl("Fyr_MM_Scroll_Map_EventUnits_" .. unitTag) == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_EventUnits_" .. unitTag,
- Fyr_MM_Scroll_Map_EventUnits, CT_TEXTURE)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- FyrMM.SetEventPin(pinType, unitTag, tag, context)
- end
- end
- end
- elseif context == WORLD_EVENT_LOCATION_CONTEXT_POINT_OF_INTEREST then
- local zoneIndex, poiIndex = GetWorldEventPOIInfo(worldEventInstanceId)
- local nX, nY, pinType, icon, isOnMap, _, discovered, nearby = MM_GetPOIMapInfo(CurrentMap.ZoneIndex, poiIndex)
- local tag = ZO_MapPin.CreateWorldEventPOIPinTag(worldEventInstanceId, CurrentMap.ZoneIndex, poiIndex)
- local pin
- if pinType ~= MAP_PIN_TYPE_INVALID and isOnMap then
- if GetControl("Fyr_MM_Scroll_Map_EventPOIs_" .. poiIndex) == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_EventPOIs_" .. poiIndex,
- Fyr_MM_Scroll_Map_EventUnits, CT_TEXTURE)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- FyrMM.SetEventPOIPin(pinType, tag, poiIndex, context)
- end
- end
- end
- function FyrMM.SetEventPin(pinType, tag, ntag, context) -- moving world events (dragons, cartoklepts)
- local pin, nX, nY
- local pdata = ZO_MapPin.PIN_DATA[pinType]
- local isDead = IsUnitDead(tag)
- pin = GetControl("Fyr_MM_Scroll_Map_EventUnits_" .. tag)
- if not (DoesUnitExist(tag) and not AreUnitsEqual("player", tag)) then
- if pin ~= nil then
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- pin.nX = nil
- pin.nY = nil
- pin.unitTag = nil
- pin.nTag = nil
- pin.m_PinType = nil
- pin.context = nil
- if pin.textureAntl then
- pin.textureAntl:Stop()
- pin.textureAntl = nil
- end
- if pin.OnBorder then
- if pin.BorderPin then
- if pin.BorderPin.textureAntl then
- pin.BorderPin.textureAntl:Stop()
- pin.BorderPin.textureAntl = nil
- end
- pin.BorderPin:ClearAnchors()
- pin.BorderPin:SetHidden()
- pin.BorderPin.pin = nil
- pin.BorderPin = nil
- end
- pin.OnBorder = nil
- end
- end
- return
- end
- if pin == nil then
- return
- end
- nX, nY = GetMapPlayerPosition(tag)
- pin.m_PinType = pinType
- local distance = CurrentMap.TrueMapSize *
- math.sqrt(
- (nX - CurrentMap.PlayerNX) * (nX - CurrentMap.PlayerNX) + (nY - CurrentMap.PlayerNY) *
- (nY - CurrentMap.PlayerNY))
- local texturetest = GetWorldEventInstanceUnitPinIcon(ntag[1], tag, false) or "not"
- local texture = "esoui/art/icons/mapkey/mapkey_dragon.dds"
- if string.find(texturetest, "dragon") then -- It's a dragon!
- texture = "esoui/art/icons/mapkey/mapkey_dragon.dds" -- /esoui/art/mappins/dragon_fly.dds
- elseif string.find(texturetest, "cartoklept") then -- it's a cartoklept!
- texture = "esoui/art/compass/compass_cartoklept.dds"
- end
- pin:SetTexture(texture)
- pin.pinTexture = texture
- local pinsize = pdata.size
- if pinsize == nil then
- pinsize = 32
- end
- FyrMM.SetPinSize(pin, pinsize * FyrMM.pScalePercent, 0)
- pin.nX = nX
- pin.nY = nY
- pin.unitTag = tag
- pin.nTag = ntag
- pin.context = context
- pin.weDistance = distance
- pin.noZoomResize = true
- pin:SetDrawLayer(3)
- pin:SetMouseEnabled(true)
- FyrMM.SetPinAnchor(pin, nX, nY, Fyr_MM_Scroll_Map_EventUnits)
- if IsUnitInCombat(tag) then
- FyrMM.CheapAnimation(pin)
- pin:SetColor(1, 0, 0, 1)
- pin.m_textureAnimTimeline = "yes"
- else
- pin:SetColor(1, 1, 1, 1)
- pin:SetTransformRotationZ(0)
- pin.m_textureAnimTimeline = nil
- end
- -- if pdata.isAnimated then
- -- --pin:PlayTextureAnimation(pdata.framesWide, pdata.framesHigh, pdata.framesPerSecond)
- -- --pin:StopTextureAnimation()
- -- if not pin.textureAntl then
- -- local an
- -- an, pin.textureAntl = CreateSimpleAnimation(ANIMATION_TEXTURE, pin)
- -- an:SetHandler("OnStop", function() pin:SetTextureCoords(0, 1, 0, 1) end)
- -- end
- -- local anim = pin.textureAntl:GetAnimation(1)
- -- anim:SetImageData(pdata.framesWide, pdata.framesHigh)
- -- anim:SetFramerate(pdata.framesPerSecond)
- -- pin.textureAntl:SetPlaybackType(ANIMATION_PLAYBACK_LOOP, LOOP_INDEFINITELY)
- -- pin.textureAntl:PlayFromStart()
- -- end
- if FyrMM.SV.WheelMap then
- pin:SetHidden(not Is_PinInsideWheel(pin))
- else
- pin:SetHidden(false)
- end
- if FyrMM.IsValidBorderPin(pin) then
- FyrMM.CreateBorderPin(pin)
- end
- end
- function FyrMM.SetEventPOIPin(pinType, tag, poiIndex, context) -- world events (dolmens, harrow storms etc)
- local pin
- local pdata = ZO_MapPin.PIN_DATA[pinType]
- pin = GetControl("Fyr_MM_Scroll_Map_EventPOIs_" .. poiIndex)
- if pin == nil then
- return
- end
- local nX, nY, pinType, icon, isOnMap, _, discovered, nearby = MM_GetPOIMapInfo(GetCurrentMapZoneIndex(), poiIndex)
- local distance = CurrentMap.TrueMapSize *
- math.sqrt(
- (nX - CurrentMap.PlayerNX) * (nX - CurrentMap.PlayerNX) + (nY - CurrentMap.PlayerNY) *
- (nY - CurrentMap.PlayerNY))
- if not isOnMap then
- if pin ~= nil then
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- pin.nX = nil
- pin.nY = nil
- pin.unitTag = nil
- pin.nTag = nil
- pin.m_PinType = nil
- pin.context = nil
- if pin.textureAntl then
- pin.textureAntl:Stop()
- pin.textureAntl = nil
- end
- if pin.OnBorder then
- if pin.BorderPin then
- if pin.BorderPin.textureAntl then
- pin.BorderPin.textureAntl:Stop()
- pin.BorderPin.textureAntl = nil
- end
- pin.BorderPin:ClearAnchors()
- pin.BorderPin:SetHidden()
- pin.BorderPin.pin = nil
- pin.BorderPin = nil
- end
- pin.OnBorder = nil
- end
- end
- return
- end
- pin.m_PinType = pinType
- -- if pin.m_PinType == MAP_PIN_TYPE_POI_COMPLETE then
- -- pin:SetTexture("EsoUI/Art/MapPins/worldEvent_poi_active_complete.dds")
- -- elseif pin.m_PinType == MAP_PIN_TYPE_POI_SEEN then
- -- pin:SetTexture("EsoUI/Art/MapPins/worldEvent_poi_active_incomplete.dds")
- -- end
- local texture = "esoui/art/zonestories/completiontypeicon_worldevents.dds"
- pin:SetTexture(texture)
- pin.pinTexture = texture
- pin:SetColor(1, 1, 1, 1)
- local pinsize = pdata.size
- if pinsize == nil then
- pinsize = 32
- end
- FyrMM.SetPinSize(pin, pinsize * FyrMM.pScalePercent, 0)
- pin.nX = nX
- pin.nY = nY
- pin.unitTag = tag
- pin.nTag = tag
- pin.context = context
- pin.weDistance = distance
- pin:SetDrawLayer(3)
- pin:SetMouseEnabled(true)
- FyrMM.SetPinAnchor(pin, nX, nY, Fyr_MM_Scroll_Map_EventUnits)
- FyrMM.CheapAnimation(pin, true)
- pin.m_textureAnimTimeline = "yes"
- -- if pdata.isAnimated then
- -- --pin:PlayTextureAnimation(pdata.framesWide, pdata.framesHigh, pdata.framesPerSecond)
- -- --pin:StopTextureAnimation()
- -- if not pin.textureAntl then
- -- local an
- -- an, pin.textureAntl = CreateSimpleAnimation(ANIMATION_TEXTURE, pin)
- -- an:SetHandler("OnStop", function() pin:SetTextureCoords(0, 1, 0, 1) end)
- -- end
- -- local anim = pin.textureAntl:GetAnimation(1)
- -- anim:SetImageData(pdata.framesWide, pdata.framesHigh)
- -- anim:SetFramerate(pdata.framesPerSecond)
- -- pin.textureAntl:SetPlaybackType(ANIMATION_PLAYBACK_LOOP, LOOP_INDEFINITELY)
- -- pin.textureAntl:PlayFromStart()
- -- end
- if FyrMM.SV.WheelMap then
- pin:SetHidden(not Is_PinInsideWheel(pin))
- else
- pin:SetHidden(false)
- end
- if FyrMM.IsValidBorderPin(pin) then
- FyrMM.CreateBorderPin(pin)
- end
- end
- function FyrMM.RefreshEventUnits()
- RemoveEventUnitPins()
- for worldEventInstanceId in GetNextWorldEventInstanceIdIter do
- AddWorldEvent(worldEventInstanceId)
- end
- end
- function FyrMM.CheapAnimation(pin, rotate) -- added by @Masteroshi430
- local pinsize = 64
- local pinsizeMax = pinsize + 8
- local pinsizeMin = pinsize - 8
- if FyrMM.animatedPinSize then
- if FyrMM.animatedPinSize == pinsizeMax then
- FyrMM.goDown = true
- FyrMM.animatedPinSize = FyrMM.animatedPinSize - 1
- elseif FyrMM.animatedPinSize == pinsizeMin then
- FyrMM.goDown = false
- FyrMM.animatedPinSize = FyrMM.animatedPinSize + 1
- elseif FyrMM.animatedPinSize > pinsizeMin and FyrMM.goDown == true then
- FyrMM.animatedPinSize = FyrMM.animatedPinSize - 1
- elseif FyrMM.animatedPinSize < pinsizeMax then
- FyrMM.animatedPinSize = FyrMM.animatedPinSize + 1
- end
- else
- FyrMM.animatedPinSize = pinsizeMax
- end
- if rotate then
- if not FyrMM.radians then
- FyrMM.radians = 0
- end
- FyrMM.radians = math.min(pi * 2, FyrMM.radians + 0.1)
- if FyrMM.radians == pi * 2 then
- FyrMM.radians = 0
- end
- pin:SetTransformRotationZ(FyrMM.radians)
- else
- pin:SetTransformRotationZ(0)
- end
- local properSize = math.floor(FyrMM.animatedPinSize * FyrMM.pScalePercent / 2) * 2
- pin:SetDimensions(properSize, properSize)
- end
- ------------------------------------------------------------
- -- Group Pins
- ------------------------------------------------------------
- function FyrMM.GroupEvent()
- FyrMM.GroupRefreshNeeded = true
- FyrMM.RefreshGroup()
- end
- function FyrMM.SetGroupPinTexture(gmPin, odyTexture)
- local Multiplier = 1
- local gmPinTexture = ""
- if gmPin.unitTag == "companion" then
- gmPinTexture = "EsoUI/Art/MapPins/activeCompanion_pin.dds"
- if odyTexture then
- gmPinTexture = odyTexture
- end
- if gmPin.isMounted then
- gmPinTexture = "MiniMap/Textures/mountedMember.dds"
- Multiplier = 1.25
- elseif gmPin.isStealthed then
- gmPinTexture = "MiniMap/Textures/stealthed.dds"
- Multiplier = 0.1
- elseif gmPin.isSwimming then -- in case companions are able to swim in the future
- gmPinTexture = "MiniMap/Textures/swimming.dds"
- Multiplier = 0.1
- end
- FyrMM.SetPinSize(gmPin, FyrMM.SV.MemberPinSize * FyrMM.pScalePercent * Multiplier, 0)
- else
- if gmPin.isLeader then
- if FyrMM.SV.LeaderPin == "Default" then
- gmPinTexture = "EsoUI/Art/Compass/groupLeader.dds"
- elseif FyrMM.SV.LeaderPin == "Class" then
- gmPinTexture = GetClassIcon(gmPin.ClassId)
- elseif gmPin.isDps then
- gmPinTexture = "EsoUI/Art/LFG/LFG_dps_down.dds"
- elseif gmPin.isHeal then
- gmPinTexture = "EsoUI/Art/LFG/LFG_healer_down.dds"
- elseif gmPin.isTank then
- gmPinTexture = "EsoUI/Art/LFG/LFG_tank_down.dds"
- else
- gmPinTexture = "EsoUI/Art/Compass/groupLeader.dds"
- end
- if odyTexture then
- gmPinTexture = odyTexture
- end
- if FyrMM.GetTargetMarkerPicture(gmPin.unitTag) then
- gmPinTexture = FyrMM.GetTargetMarkerPicture(gmPin.unitTag)
- Multiplier = 0.5
- end
- if gmPin.isMounted and not gmPin.engaged then
- gmPinTexture = "MiniMap/Textures/mountedLeader.dds"
- Multiplier = 1.5
- elseif gmPin.isStealthed and not gmPin.engaged then
- gmPinTexture = "MiniMap/Textures/stealthed.dds"
- Multiplier = 0.1
- elseif gmPin.isSwimming and not gmPin.engaged then
- gmPinTexture = "MiniMap/Textures/swimming.dds"
- Multiplier = 0.1
- end
- if gmPin.isBreadcrumb then
- gmPinTexture = "EsoUI/Art/Compass/groupLeader_door.dds"
- end
- FyrMM.SetPinSize(gmPin, FyrMM.SV.LeaderPinSize * FyrMM.pScalePercent * Multiplier, 0)
- else
- if FyrMM.SV.MemberPin == "Default" then
- gmPinTexture =
- "EsoUI/Art/MapPins/UI-WorldMapGroupPip.dds" -- "esoui/art/icons/mapkey/mapkey_groupmember.dds"
- elseif FyrMM.SV.MemberPin == "Class" then
- gmPinTexture = GetClassIcon(gmPin.ClassId)
- elseif gmPin.isDps then
- gmPinTexture = "EsoUI/Art/LFG/LFG_dps_down.dds"
- elseif gmPin.isHeal then
- gmPinTexture = "EsoUI/Art/LFG/LFG_healer_down.dds"
- elseif gmPin.isTank then
- gmPinTexture = "EsoUI/Art/LFG/LFG_tank_down.dds"
- else
- gmPinTexture =
- "EsoUI/Art/MapPins/UI-WorldMapGroupPip.dds" -- "esoui/art/icons/mapkey/mapkey_groupmember.dds"
- end
- if odyTexture then
- gmPinTexture = odyTexture
- end
- if FyrMM.GetTargetMarkerPicture(gmPin.unitTag) then
- gmPinTexture = FyrMM.GetTargetMarkerPicture(gmPin.unitTag)
- Multiplier = 0.5
- end
- if gmPin.isMounted and not gmPin.engaged then
- gmPinTexture = "MiniMap/Textures/mountedMember.dds"
- Multiplier = 1.5
- elseif gmPin.isStealthed and not gmPin.engaged then
- gmPinTexture = "MiniMap/Textures/stealthed.dds"
- Multiplier = 0.1
- elseif gmPin.isSwimming and not gmPin.engaged then
- gmPinTexture = "MiniMap/Textures/swimming.dds"
- Multiplier = 0.1
- end
- if gmPin.isBreadcrumb then
- gmPinTexture = "esoui/art/compass/groupmember_door.dds"
- end
- FyrMM.SetPinSize(gmPin, FyrMM.SV.MemberPinSize * FyrMM.pScalePercent * Multiplier, 0)
- end
- end
- gmPin:SetTexture(gmPinTexture)
- gmPin.pinTexture = gmPinTexture -- we set that here to avoid resetting it for borderpins
- end
- function FyrMM.GetTargetMarkerPicture(tag)
- if not FyrMM.SV.GroupTargetMarkers then
- return nil
- end
- local targetMarkerTexture = {
- [TARGET_MARKER_TYPE_ONE] = "EsoUI/Art/TargetMarkers/Target_Blue_Square_64.dds",
- [TARGET_MARKER_TYPE_TWO] = "EsoUI/Art/TargetMarkers/Target_Gold_Star_64.dds",
- [TARGET_MARKER_TYPE_THREE] = "EsoUI/Art/TargetMarkers/Target_Green_Circle_64.dds",
- [TARGET_MARKER_TYPE_FOUR] = "EsoUI/Art/TargetMarkers/Target_Orange_Triangle_64.dds",
- [TARGET_MARKER_TYPE_FIVE] = "EsoUI/Art/TargetMarkers/Target_Pink_Moons_64.dds",
- [TARGET_MARKER_TYPE_SIX] = "EsoUI/Art/TargetMarkers/Target_Purple_Oblivion_64.dds",
- [TARGET_MARKER_TYPE_SEVEN] = "EsoUI/Art/TargetMarkers/Target_Red_Weapons_64.dds",
- [TARGET_MARKER_TYPE_EIGHT] = "EsoUI/Art/TargetMarkers/Target_White_Skull_64.dds",
- }
- return targetMarkerTexture[GetUnitTargetMarkerType(tag)]
- end
- function FyrMM.SetGroupPin(tag)
- local pin, pin_ic, text, nX, nY
- local isDps, isHeal, isTank = GetGroupMemberRoles(tag)
- local isDead = IsUnitDead(tag)
- pin = GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag)
- pin_ic = GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat")
- text = GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_label")
- if not (DoesUnitExist(tag) and not AreUnitsEqual("player", tag) and IsUnitOnline(tag)) then
- if pin ~= nil then
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- pin.isDps = nil
- pin.isHeal = nil
- pin.isTank = nil
- pin.ClassId = nil
- pin.isLeader = nil
- pin.nX = nil
- pin.nY = nil
- pin_ic.nX = nil
- pin_ic.nY = nil
- pin_ic:SetHidden(true)
- pin_ic:ClearAnchors()
- PinsList["Fyr_MM_Scroll_Map_GroupPins_" .. tag] = nil
- PinsList["Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat"] = nil
- if pin.OnBorder then
- if pin.BorderPin then
- pin.BorderPin:ClearAnchors()
- pin.BorderPin:SetHidden()
- pin.BorderPin.pin = nil
- pin.BorderPin = nil
- end
- pin.OnBorder = nil
- end
- end
- return
- end
- if pin == nil then
- return
- end
- nX, nY, _, isInCurrentMap = GetMapPlayerPosition(tag)
- pin.isDps = isDps
- pin.isHeal = isHeal
- pin.isTank = isTank
- pin.isLeader = IsUnitGroupLeader(tag)
- pin.isBreadcrumb = false
- pin.isMounted = GetTargetMountedStateInfo(GetRawUnitName(tag)) ~= MOUNTED_STATE_NOT_MOUNTED
- pin.isStealthed = GetUnitStealthState(tag) ~= STEALTH_STATE_NONE
- pin.isSwimming = IsUnitSwimming(tag)
- if DoesUnitExist(tag) and not AreUnitsEqual("player", tag) and IsUnitOnline(tag) then
- local isGroupMemberHiddenByInstance = false
- -- If we're in an instance and it has its own map, it's going to be a dungeon map or house. Don't show on the map if we're on different instances/layers
- -- If it doesn't have its own map, we're okay to show the group member regardless of instance
- if DoesCurrentMapMatchMapForPlayerLocation() and IsGroupMemberInSameWorldAsPlayer(tag) and
- (GetMapContentType() == MAP_CONTENT_DUNGEON or GetCurrentZoneHouseId() ~= 0) then
- if not IsGroupMemberInSameInstanceAsPlayer(tag) then
- -- We're in the same world as the group member, but a different instance
- isGroupMemberHiddenByInstance = true
- elseif not IsGroupMemberInSameLayerAsPlayer(tag) then
- -- We're in the same instance as the group member, but a different layer
- isGroupMemberHiddenByInstance = not IsUnitWorldMapPositionBreadcrumbed(tag)
- end
- end
- if not isGroupMemberHiddenByInstance then
- if isInCurrentMap then
- if IsUnitWorldMapPositionBreadcrumbed(tag) then
- pin.isBreadcrumb = true
- end
- end
- end
- end
- if pin.isLeader then
- pin.m_PinType = MAP_PIN_TYPE_GROUP_LEADER
- if FyrMM.SV.LeaderPinColor ~= nil and FyrMM.SV.LeaderDeadPinColor ~= nil then
- if isDead then
- pin:SetColor(FyrMM.SV.LeaderDeadPinColor.r, FyrMM.SV.LeaderDeadPinColor.g,
- FyrMM.SV.LeaderDeadPinColor.b, FyrMM.SV.LeaderDeadPinColor.a)
- text:SetColor(255 - FyrMM.SV.LeaderDeadPinColor.r, 255 - FyrMM.SV.LeaderDeadPinColor.g,
- 255 - FyrMM.SV.LeaderDeadPinColor.b, FyrMM.SV.LeaderDeadPinColor.a)
- else
- pin:SetColor(FyrMM.SV.LeaderPinColor.r, FyrMM.SV.LeaderPinColor.g, FyrMM.SV.LeaderPinColor.b,
- FyrMM.SV.LeaderPinColor.a)
- text:SetColor(255 - FyrMM.SV.LeaderPinColor.r, 255 - FyrMM.SV.LeaderPinColor.g,
- 255 - FyrMM.SV.LeaderPinColor.b, FyrMM.SV.LeaderPinColor.a)
- end
- else
- text:SetColor(0, 0, 0, 1)
- end
- else
- if tag == "companion" then
- pin.m_PinType = MAP_PIN_TYPE_ACTIVE_COMPANION
- else
- pin.m_PinType = MAP_PIN_TYPE_GROUP
- end
- if FyrMM.SV.MemberPinColor ~= nil and FyrMM.SV.MemberDeadPinColor ~= nil then
- if isDead then
- pin:SetColor(FyrMM.SV.MemberDeadPinColor.r, FyrMM.SV.MemberDeadPinColor.g,
- FyrMM.SV.MemberDeadPinColor.b, FyrMM.SV.MemberDeadPinColor.a)
- if not tag == "companion" then
- text:SetColor(255 - FyrMM.SV.MemberDeadPinColor.r, 255 - FyrMM.SV.MemberDeadPinColor.g,
- 255 - FyrMM.SV.MemberDeadPinColor.b, FyrMM.SV.MemberDeadPinColor.a)
- end
- else
- pin:SetColor(FyrMM.SV.MemberPinColor.r, FyrMM.SV.MemberPinColor.g, FyrMM.SV.MemberPinColor.b,
- FyrMM.SV.MemberPinColor.a)
- if not tag == "companion" then
- text:SetColor(255 - FyrMM.SV.MemberPinColor.r, 255 - FyrMM.SV.MemberPinColor.g,
- 255 - FyrMM.SV.MemberPinColor.b, FyrMM.SV.MemberPinColor.a)
- end
- end
- else
- text:SetColor(0, 0, 0, 1)
- end
- end
- pin.noZoomResize = true
- pin.ClassId = GetUnitClassId(tag)
- pin.nX = nX
- pin.nY = nY
- pin.unitTag = tag
- if IsUnitActivelyEngaged(tag) and FyrMM.SV.InCombatState and not isDead and IsUnitOnline(tag) then -- IsUnitActivelyEngaged instead of IsUnitInCombat to get individual combat state instead of group combat state
- pin_ic.nX = nX
- pin_ic.nY = nY
- pin_ic:SetHidden(false)
- if pin.isLeader then
- pin_ic:SetAlpha(0.66)
- else
- pin_ic:SetColor(255, 0, 0, 0.5)
- end
- FyrMM.SetPinAnchor(pin_ic, nX, nY, Fyr_MM_Scroll_Map_GroupPins)
- else
- PinsList["Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat"] = nil
- pin_ic.nX = nil
- pin_ic.nY = nil
- -- pin_ic:SetColor(0,0,0,0)
- pin_ic:SetHidden(true)
- pin_ic:ClearAnchors()
- end
- if not tag == "companion" then
- if FyrMM.SV.ShowGroupLabels then
- text:SetText(tostring(GetGroupIndexByUnitTag(tag)))
- text:SetHidden(false)
- else
- text:SetText("")
- end
- end
- if IsUnitActivelyEngaged(tag) then
- pin.engaged = true
- else
- pin.engaged = false
- end
- if OSI then -- support for OdySupportIcons
- local OPTIONS = OPTIONS or ZO_SavedVars:NewAccountWide("OSIStore", 1, nil, DEFAULT)
- local wmConfig = {
- ["dead"] = OPTIONS.wmdead,
- ["mechanic"] = false,
- ["raid"] = OPTIONS.raidallow,
- ["leader"] = OPTIONS.wmroles,
- ["tank"] = OPTIONS.wmroles,
- ["healer"] = OPTIONS.wmroles,
- ["dps"] = OPTIONS.wmroles,
- ["bg"] = OPTIONS.wmroles,
- ["custom"] = OPTIONS.wmuse,
- ["unique"] = OPTIONS.wmunique,
- ["anim"] = false
- }
- local tex, col, _, hodor = OSI.GetIconDataForPlayer(GetUnitDisplayName(tag), wmConfig, tag)
- if tex then
- FyrMM.SetGroupPinTexture(pin, tex)
- if col then
- pin:SetColor(col[1], col[2], col[3], 1)
- pin.color = col
- end
- else
- FyrMM.SetGroupPinTexture(pin)
- end
- else
- FyrMM.SetGroupPinTexture(pin)
- end
- FyrMM.SetPinSize(pin_ic, pin:GetDesiredHeight() + 10, 0) -- +6
- pin:SetDrawLayer(3)
- pin:SetDrawLevel(ZO_MapPin.PIN_DATA[pin.m_PinType].level)
- pin_ic:SetDrawLayer(2)
- pin:SetMouseEnabled(true)
- FyrMM.SetPinAnchor(pin, nX, nY, Fyr_MM_Scroll_Map_GroupPins)
- PinsList["Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat"] = nil
- if FyrMM.SV.WheelMap then
- pin:SetHidden(not Is_PinInsideWheel(pin))
- else
- pin:SetHidden(false)
- end
- if FyrMM.IsValidBorderPin(pin) then
- FyrMM.CreateBorderPin(pin)
- end
- end
- local function ClearGroupPins()
- local pin, pin_ic, tag
- for i = 1, 24 do
- tag = "group" .. tostring(i)
- local pin = GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag)
- local pin_ic = GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat")
- if pin ~= nil then
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- pin.isDps = nil
- pin.isHeal = nil
- pin.isTank = nil
- pin.ClassId = nil
- pin.isLeader = nil
- pin.isBreadcrumb = nil
- pin.nX = nil
- pin.nY = nil
- pin_ic.nX = nil
- pin_ic.nY = nil
- pin_ic:SetHidden(true)
- pin_ic:ClearAnchors()
- PinsList["Fyr_MM_Scroll_Map_GroupPins_" .. tag] = nil
- PinsList["Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat"] = nil
- if pin.OnBorder then
- if pin.BorderPin then
- pin.BorderPin:ClearAnchors()
- pin.BorderPin:SetHidden()
- pin.BorderPin.pin = nil
- pin.BorderPin = nil
- end
- pin.OnBorder = nil
- end
- end
- end
- if not DoesUnitExist("companion") then
- local pin = GetControl("Fyr_MM_Scroll_Map_GroupPins_companion")
- local pin_ic = GetControl("Fyr_MM_Scroll_Map_GroupPins_companion_incombat")
- if pin ~= nil then
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- pin.isDps = nil
- pin.isHeal = nil
- pin.isTank = nil
- pin.ClassId = nil
- pin.isLeader = nil
- pin.isBreadcrumb = nil
- pin.nX = nil
- pin.nY = nil
- pin_ic.nX = nil
- pin_ic.nY = nil
- pin_ic:SetHidden(true)
- pin_ic:ClearAnchors()
- PinsList["Fyr_MM_Scroll_Map_GroupPins_companion"] = nil
- PinsList["Fyr_MM_Scroll_Map_GroupPins_companion_incombat"] = nil
- if pin.OnBorder then
- if pin.BorderPin then
- pin.BorderPin:ClearAnchors()
- pin.BorderPin:SetHidden()
- pin.BorderPin.pin = nil
- pin.BorderPin = nil
- end
- pin.OnBorder = nil
- end
- end
- end
- end
- function FyrMM.RefreshGroup()
- if not FyrMM.GroupRefreshNeeded and not IsCompanionAround then
- return
- end
- local maxgroupsize = 24
- local tag, pin, pin_ic
- if not IsUnitGrouped("player") and not DoesUnitExist("companion") then
- ClearGroupPins()
- return
- end
- if IsUnitGrouped("player") and not DoesUnitExist("companion") then -- fix for companion icons staying when he/she leaves while grouped
- local pin = GetControl("Fyr_MM_Scroll_Map_GroupPins_companion")
- local pin_ic = GetControl("Fyr_MM_Scroll_Map_GroupPins_companion_incombat")
- if pin ~= nil then
- pin:SetHidden(true)
- pin:SetMouseEnabled(false)
- pin:ClearAnchors()
- pin.isDps = nil
- pin.isHeal = nil
- pin.isTank = nil
- pin.ClassId = nil
- pin.isLeader = nil
- pin.isBreadcrumb = nil
- pin.nX = nil
- pin.nY = nil
- pin_ic.nX = nil
- pin_ic.nY = nil
- pin_ic:SetHidden(true)
- pin_ic:ClearAnchors()
- PinsList["Fyr_MM_Scroll_Map_GroupPins_companion"] = nil
- PinsList["Fyr_MM_Scroll_Map_GroupPins_companion_incombat"] = nil
- if pin.OnBorder then
- if pin.BorderPin then
- pin.BorderPin:ClearAnchors()
- pin.BorderPin:SetHidden()
- pin.BorderPin.pin = nil
- pin.BorderPin = nil
- end
- pin.OnBorder = nil
- end
- end
- end
- local nogroup = GetGroupSize() == 0
- local gameTime = GetGameTimeMilliseconds()
- if GetGroupSize() > 24 then
- maxgroupsize = GetGroupSize()
- end -- Crazy wishfull thinking :)
- for index = 1, maxgroupsize do
- if FyrMM.Reloading then
- return
- end
- tag = "group" .. tostring(index) -- GetGroupUnitTagByIndex(i)
- if maxgroupsize > 24 then -- Very crazy wishfull thinking :)
- if GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag) == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag, Fyr_MM_Scroll_Map_GroupPins,
- CT_TEXTURE)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- if GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat") == nil then
- pin_ic = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat",
- Fyr_MM_Scroll_Map_GroupPins, CT_TEXTURE)
- pin_ic:SetTexture("esoui/art/mappins/ava_attackburst_32.dds")
- end
- end
- FyrMM.SetGroupPin(tag)
- end
- if DoesUnitExist("companion") then
- tag = "companion"
- if GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag) == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag, Fyr_MM_Scroll_Map_GroupPins,
- CT_TEXTURE)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- if GetControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat") == nil then
- pin_ic = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_GroupPins_" .. tag .. "_incombat",
- Fyr_MM_Scroll_Map_GroupPins, CT_TEXTURE)
- pin_ic:SetTexture("esoui/art/mappins/ava_attackburst_32.dds")
- pin_ic:SetColor(255, 0, 0, 0.5)
- end
- FyrMM.SetGroupPin(tag)
- end
- if GetGroupSize() == 0 and not DoesUnitExist("companion") then
- FyrMM.GroupRefreshNeeded = false
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.RefreshGroup " .. tostring(GetGameTimeMilliseconds() - gameTime))
- end
- end
- ---------------------------------------------------
- -- Quest pin updates
- ---------------------------------------------------
- function FyrMM.GetQuestPinInfo(pinType, isassited, isBreadcrumb, radius)
- if radius == nil then
- radius = 0
- end
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- local Diameter = radius * 2 * mHeight
- local texture
- if Diameter < 16 then
- Diameter = 16
- end
- local properType, properTexture
- if (pinType == MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION or pinType == MAP_PIN_TYPE_TRACKED_QUEST_CONDITION) then
- if isassited then
- properType = MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION
- else
- properType = MAP_PIN_TYPE_TRACKED_QUEST_CONDITION
- end
- end
- if (pinType == MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION or pinType ==
- MAP_PIN_TYPE_TRACKED_QUEST_OPTIONAL_CONDITION) then
- if isassited then
- properType = MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION
- else
- properType = MAP_PIN_TYPE_TRACKED_QUEST_OPTIONAL_CONDITION
- end
- end
- if (pinType == MAP_PIN_TYPE_ASSISTED_QUEST_ENDING or pinType == MAP_PIN_TYPE_TRACKED_QUEST_ENDING) then
- if isassited then
- properType = MAP_PIN_TYPE_ASSISTED_QUEST_ENDING
- else
- properType = MAP_PIN_TYPE_TRACKED_QUEST_ENDING
- end
- end
- if not properType then
- properType = pinType
- end
- if radius == 0 then
- texture = isBreadcrumb and breadcrumbQuestPinTextures[properType] or questPinTextures[properType]
- return properType, texture, 32 * FyrMM.pScalePercent
- else
- if Diameter > 24 then
- texture = isassited and "EsoUI/Art/MapPins/map_assistedAreaPin.dds" or "EsoUI/Art/MapPins/map_areaPin.dds"
- return properType, texture, Diameter, true
- else
- texture = isassited and "EsoUI/Art/MapPins/map_assistedAreaPin_32.dds" or "EsoUI/Art/MapPins/map_areaPin_32.dds"
- return properType, texture, Diameter, true
- end
- end
- end
- function FyrMM.ApplyProperQuestPinTextures() -- Discrepancy fix
- local questPin, pinType
- local function applyTextures(index, a)
- questPin = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(a))
- if not questPin or questPin.questIndex ~= index or questPin:IsHidden(true) or IsAssisted(questPin.m_PinType) == FyrMM.GetQuestPinInfo(GetTrackedByIndex(index)) then
- return
- end
- local properType, pinTexture, size =
- FyrMM.GetQuestPinInfo(questPin.m_PinType,
- GetTrackedIsAssisted(TRACK_TYPE_QUEST, questPin.questIndex),
- questPin.m_PinTag.isBreadcrumb, questPin.radius)
- questPin.m_PinType = properType
- questPin:SetTexture(pinTexture)
- FyrMM.SetPinSize(questPin, size, 0)
- local drawLayerIndex = GetTrackedIsAssisted(TRACK_TYPE_QUEST, questPin.questIndex) and 3 or 2
- questPin:SetDrawLayer(drawLayerIndex)
- end
- for index = 1, MAX_JOURNAL_QUESTS do
- if (IsValidQuestIndex(index)) then
- for a = 1, FyrMM.questPinCount do
- applyTextures(index, a)
- end
- end
- end
- end
- local function UpdateQuestPinPosition(questPin)
- if not questPin then
- return
- end
- if questPin.MapId ~= CurrentMap.MapId or not questPin.m_PinTag or not questPin.m_PinTag then
- questPin:SetHidden(true)
- questPin:ClearAnchors()
- return
- end
- local properType, pinTexture, size = FyrMM.GetQuestPinInfo(questPin.m_PinType, GetTrackedIsAssisted(TRACK_TYPE_QUEST, questPin.questIndex), questPin.m_PinTag.isBreadcrumb, questPin.radius)
- questPin.m_PinType = properType
- questPin:SetTexture(pinTexture)
- FyrMM.SetPinSize(questPin, size, 0)
- questPin:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_QUESTS))
- local drawLayerIndex = GetTrackedIsAssisted(TRACK_TYPE_QUEST, questPin.questIndex) and 3 or 2
- questPin:SetDrawLayer(drawLayerIndex)
- FyrMM.SetPinAnchor(questPin, questPin.normalizedX, questPin.normalizedY, Fyr_MM_Scroll_Map_QuestPins)
- if FyrMM.SV.WheelMap and questPin.radius > 0 and not questPin.MM_Tag then
- questPin:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- elseif questPin.MM_Tag == 1 and not FyrMM.SV.WheelMap then
- questPin:SetParent(Fyr_MM_Scroll_Map_QuestPins)
- elseif questPin.MM_Tag == 1 and questPin.radius > 0 then
- questPin:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- if questPin.secondaryPin then
- questPin.secondaryPin:SetTexture(pinTexture)
- end
- if questPin.tertiaryPin then
- questPin.tertiaryPin:SetTexture(pinTexture)
- end
- elseif questPin.MM_Tag == 2 then
- questPin:SetParent(Fyr_MM_Scroll_NS_Map_Pins)
- elseif questPin.MM_Tag == 3 then
- questPin:SetParent(Fyr_MM_Scroll_WE_Map_Pins)
- elseif questPin.MM_Tag then
- questPin.MM_Tag = nil
- questPin:SetParent(Fyr_MM_Scroll_Map_QuestPins)
- end
- if FyrMM.IsValidBorderPin(questPin) then
- FyrMM.CreateBorderPin(questPin)
- end
- end
- function FyrMM.UpdateQuestPinPositions()
- if QuestPinsUpdating then
- return
- end
- for _, v in pairs(QuestPins) do
- UpdateQuestPinPosition(v.Pin)
- if v.Pin.secondaryPin then
- UpdateQuestPinPosition(v.Pin.secondaryPin)
- end
- if v.Pin.tertiaryPin then
- UpdateQuestPinPosition(v.Pin.tertiaryPin)
- end
- end
- end
- local function PlayTextureAnimation(pin, loopCount)
- if not pin.m_textureAnimTimeline then
- local anim
- anim, pin.m_textureAnimTimeline = CreateSimpleAnimation(ANIMATION_TEXTURE, pin)
- anim:SetImageData(32, 1)
- anim:SetFramerate(32)
- anim:SetHandler("OnStop", function()
- pin:SetTextureCoords(0, 1, 0, 1)
- end)
- end
- pin.m_textureAnimTimeline:SetPlaybackType(ANIMATION_PLAYBACK_LOOP, loopCount)
- pin.m_textureAnimTimeline:PlayFromStart()
- end
- local function ResetAnimation(pin, resetOptions, loopCount, pulseIcon, overlayIcon, postPulseCallback, min, max)
- resetOptions = resetOptions or RESET_ANIM_PREVENT_PLAY
- -- The animated control
- local pulseControl = pin
- if (resetOptions == RESET_ANIM_ALLOW_PLAY) then
- pulseControl:SetHidden(pulseIcon == nil)
- if (pulseIcon) then
- pulseControl:SetTexture(pulseIcon)
- postPulseCallback = postPulseCallback or ZO_MapPin.DoFinalFadeOutAfterPing
- ZO_AlphaAnimation_GetAnimation(pulseControl):PingPong(.3, 1, 750, loopCount, postPulseCallback)
- end
- elseif (resetOptions == RESET_ANIM_HIDE_CONTROL) then
- ZO_AlphaAnimation_GetAnimation(pulseControl):Stop()
- pulseControl:SetHidden(true)
- pulseControl:StopTextureAnimation()
- elseif (resetOptions == RESET_ANIM_PREVENT_PLAY) then
- ZO_AlphaAnimation_GetAnimation(pulseControl):FadeOut(0, 300, ZO_ALPHA_ANIMATION_OPTION_USE_CURRENT_ALPHA,
- ZO_MapPin.HidePulseAfterFadeOut)
- end
- end
- local function CreateQuestAreaSidePins(pin, assisted)
- local index
- local properType, pinTexture, size = FyrMM.GetQuestPinInfo(pinType,
- GetTrackedIsAssisted(TRACK_TYPE_QUEST, pin.m_PinTag[1]), pin.m_PinTag.isBreadcrumb, pin.radius)
- FyrMM.questPinCount = FyrMM.questPinCount + 1
- local questPinNS
- index = GetQuestFreePinIndex()
- questPinNS = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index))
- if questPinNS == nil then
- questPinNS = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index),
- Fyr_MM_Scroll_NS_Map_Pins, CT_TEXTURE)
- else
- questPinNS:SetParent(Fyr_MM_Scroll_NS_Map_Pins)
- end
- questPinNS.m_PinTag = pin.m_PinTag
- questPinNS.questIndex = pin.questIndex
- questPinNS.m_PinType = properType
- questPinNS.PinToolTipText = pin.PinToolTipText
- questPinNS.questName = pin.questName
- questPinNS.normalizedX = pin.normalizedX
- questPinNS.normalizedY = pin.normalizedY
- questPinNS.radius = pin.radius
- questPinNS.MapId = pin.MapId
- questPinNS:SetTexture(pinTexture)
- -- FyrMM.SetPinSize(questPinNS, size, 0)
- questPinNS:SetDimensions(size, size)
- questPinNS.pinAge = pin.pinAge
- questPinNS:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_QUESTS))
- questPinNS.MM_Tag = 2
- questPinNS.primaryPin = pin
- pin.secondaryPin = questPinNS
- if assisted then
- local assistedColor = ZO_MAP_PIN_ASSISTED_COLOR
- questPinNS:SetColor(assistedColor:UnpackRGBA())
- else
- local color = ZO_MAP_PIN_NORMAL_COLOR
- questPinNS:SetColor(color:UnpackRGBA())
- end
- questPinNS:SetDrawLayer(3)
- FyrMM.SetPinAnchor(questPinNS, questPinNS.normalizedX, questPinNS.normalizedY, Fyr_MM_Scroll_Map_QuestPins)
- questPinNS:SetHandler("OnMouseUp", PinOnMouseUp)
- questPinNS:SetHandler("OnMouseEnter", PinOnMouseEnter)
- questPinNS:SetHandler("OnMouseExit", PinOnMouseExit)
- FyrMM.questPinCount = FyrMM.questPinCount + 1
- local questPinWE
- index = GetQuestFreePinIndex()
- questPinWE = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index))
- if questPinWE == nil then
- questPinWE = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index),
- Fyr_MM_Scroll_WE_Map_Pins, CT_TEXTURE)
- else
- questPinWE:SetParent(Fyr_MM_Scroll_WE_Map_Pins)
- end
- questPinWE.m_PinTag = pin.m_PinTag
- questPinWE.questIndex = pin.questIndex
- questPinWE.m_PinType = properType
- questPinWE.PinToolTipText = pin.PinToolTipText
- questPinWE.questName = pin.questName
- questPinWE.normalizedX = pin.normalizedX
- questPinWE.normalizedY = pin.normalizedY
- questPinWE.radius = pin.radius
- questPinWE.MapId = pin.MapId
- questPinWE:SetTexture(pinTexture)
- -- FyrMM.SetPinSize(questPinWE, size, 0)
- questPinWE:SetDimensions(size, size)
- questPinWE.pinAge = pin.pinAge
- questPinWE:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_QUESTS))
- questPinWE.MM_Tag = 3
- questPinWE.primaryPin = pin
- pin.tertiaryPin = questPinWE
- if assisted then
- local assistedColor = ZO_MAP_PIN_ASSISTED_COLOR
- questPinWE:SetColor(assistedColor:UnpackRGBA())
- else
- local color = ZO_MAP_PIN_NORMAL_COLOR
- questPinWE:SetColor(color:UnpackRGBA())
- end
- questPinWE:SetDrawLayer(3)
- FyrMM.SetPinAnchor(questPinWE, questPinWE.normalizedX, questPinWE.normalizedY, Fyr_MM_Scroll_Map_QuestPins)
- questPinWE:SetHandler("OnMouseUp", PinOnMouseUp)
- questPinWE:SetHandler("OnMouseEnter", PinOnMouseEnter)
- questPinWE:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- function FyrMM.CreateSuggestedAreaSidePins(pin, radius)
- local index = pin.Index
- local properType, pinTexture, size = FyrMM.GetQuestPinInfo(pin.m_PinType, false, false, radius)
- local suggestedPinNS
- suggestedPinNS = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index) .. "_NS")
- if suggestedPinNS == nil then
- suggestedPinNS = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index) .. "_NS",
- Fyr_MM_Scroll_NS_Map_Pins, CT_TEXTURE)
- else
- suggestedPinNS:SetParent(Fyr_MM_Scroll_NS_Map_Pins)
- end
- suggestedPinNS.m_PinTag = pin.m_PinTag
- suggestedPinNS.questIndex = pin.questIndex
- suggestedPinNS.m_PinType = pin.m_PinType
- suggestedPinNS.PinToolTipText = pin.PinToolTipText
- suggestedPinNS.questName = pin.questName
- suggestedPinNS.normalizedX = pin.nX
- suggestedPinNS.normalizedY = pin.nY
- suggestedPinNS.radius = pin.radius
- suggestedPinNS.MapId = pin.MapId
- suggestedPinNS:SetTexture(pinTexture)
- suggestedPinNS:SetDimensions(size, size)
- suggestedPinNS.pinAge = pin.pinAge
- suggestedPinNS:SetHidden(false)
- suggestedPinNS.MM_Tag = 2
- suggestedPinNS.primaryPin = pin
- pin.secondaryPin = suggestedPinNS
- local color = ZO_MAP_PIN_NORMAL_COLOR
- suggestedPinNS:SetColor(color:UnpackRGBA())
- suggestedPinNS:SetDrawLayer(3)
- FyrMM.SetPinAnchor(suggestedPinNS, suggestedPinNS.normalizedX, suggestedPinNS.normalizedY,
- Fyr_MM_Scroll_Map_QuestPins)
- suggestedPinNS:SetHandler("OnMouseUp", PinOnMouseUp)
- suggestedPinNS:SetHandler("OnMouseEnter", PinOnMouseEnter)
- suggestedPinNS:SetHandler("OnMouseExit", PinOnMouseExit)
- local suggestedPinWE
- suggestedPinWE = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index) .. "_WE")
- if suggestedPinWE == nil then
- suggestedPinWE = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(index) .. "_WE",
- Fyr_MM_Scroll_WE_Map_Pins, CT_TEXTURE)
- else
- suggestedPinWE:SetParent(Fyr_MM_Scroll_WE_Map_Pins)
- end
- suggestedPinWE.m_PinTag = pin.m_PinTag
- suggestedPinWE.questIndex = pin.questIndex
- suggestedPinWE.m_PinType = pin.m_PinType
- suggestedPinWE.PinToolTipText = pin.PinToolTipText
- suggestedPinWE.questName = pin.questName
- suggestedPinWE.normalizedX = pin.nX
- suggestedPinWE.normalizedY = pin.nY
- suggestedPinWE.radius = pin.radius
- suggestedPinWE.MapId = pin.MapId
- suggestedPinWE:SetTexture(pinTexture)
- suggestedPinWE:SetDimensions(size, size)
- suggestedPinWE.pinAge = pin.pinAge
- suggestedPinWE:SetHidden(false)
- suggestedPinWE.MM_Tag = 3
- suggestedPinWE.primaryPin = pin
- pin.tertiaryPin = suggestedPinWE
- local color = ZO_MAP_PIN_NORMAL_COLOR
- suggestedPinWE:SetColor(color:UnpackRGBA())
- suggestedPinWE:SetDrawLayer(3)
- FyrMM.SetPinAnchor(suggestedPinWE, suggestedPinWE.normalizedX, suggestedPinWE.normalizedY,
- Fyr_MM_Scroll_Map_QuestPins)
- suggestedPinWE:SetHandler("OnMouseUp", PinOnMouseUp)
- suggestedPinWE:SetHandler("OnMouseEnter", PinOnMouseEnter)
- suggestedPinWE:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- local function CreateForwardCampAreaSidePins(pin, size, usable)
- local pinTexture = "esoui/art/mappins/map_areapin.dds"
- local ForwardCampPinNS
- ForwardCampPinNS = GetControl(
- "Fyr_MM_Scroll_Map_ForwardCamps_Pin" .. tostring(FyrMM.currentForwardCamps) .. "_Blob" .. "_NS")
- if ForwardCampPinNS == nil then
- ForwardCampPinNS = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_ForwardCamps_Pin" ..
- tostring(FyrMM.currentForwardCamps) .. "_Blob" .. "_NS",
- Fyr_MM_Scroll_NS_Map_Pins, CT_TEXTURE)
- else
- ForwardCampPinNS:SetParent(Fyr_MM_Scroll_NS_Map_Pins)
- end
- ForwardCampPinNS.m_PinTag = pin.m_PinTag
- ForwardCampPinNS.questIndex = pin.questIndex
- ForwardCampPinNS.m_PinType = pin.m_PinType
- ForwardCampPinNS.PinToolTipText = pin.PinToolTipText
- ForwardCampPinNS.questName = pin.questName
- ForwardCampPinNS.normalizedX = pin.normalizedX
- ForwardCampPinNS.normalizedY = pin.normalizedY
- ForwardCampPinNS.radius = pin.radius
- ForwardCampPinNS.MapId = pin.MapId
- ForwardCampPinNS:SetTexture(pinTexture)
- -- FyrMM.SetPinSize(ForwardCampPinNS, size, 0)
- ForwardCampPinNS:SetDimensions(size, size)
- ForwardCampPinNS.pinAge = pin.pinAge
- ForwardCampPinNS:SetHidden(not usable)
- ForwardCampPinNS.MM_Tag = 2
- ForwardCampPinNS.primaryPin = pin
- pin.secondaryPin = ForwardCampPinNS
- local color = ZO_MAP_PIN_NORMAL_COLOR
- ForwardCampPinNS:SetColor(color:UnpackRGBA())
- ForwardCampPinNS:SetDrawLayer(3)
- FyrMM.SetPinAnchor(ForwardCampPinNS, ForwardCampPinNS.normalizedX, ForwardCampPinNS.normalizedY,
- Fyr_MM_Scroll_Map_Pins) -- Fyr_MM_Scroll_Map_QuestPins
- ForwardCampPinNS:SetHandler("OnMouseUp", PinOnMouseUp)
- ForwardCampPinNS:SetHandler("OnMouseEnter", PinOnMouseEnter)
- ForwardCampPinNS:SetHandler("OnMouseExit", PinOnMouseExit)
- local ForwardCampPinWE
- ForwardCampPinWE = GetControl(
- "Fyr_MM_Scroll_Map_ForwardCamps_Pin" .. tostring(FyrMM.currentForwardCamps) .. "_Blob" .. "_WE")
- if ForwardCampPinWE == nil then
- ForwardCampPinWE = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_ForwardCamps_Pin" ..
- tostring(FyrMM.currentForwardCamps) .. "_Blob" .. "_WE",
- Fyr_MM_Scroll_WE_Map_Pins, CT_TEXTURE)
- else
- ForwardCampPinWE:SetParent(Fyr_MM_Scroll_WE_Map_Pins)
- end
- ForwardCampPinWE.m_PinTag = pin.m_PinTag
- ForwardCampPinWE.questIndex = pin.questIndex
- ForwardCampPinWE.m_PinType = pin.m_PinType
- ForwardCampPinWE.PinToolTipText = pin.PinToolTipText
- ForwardCampPinWE.questName = pin.questName
- ForwardCampPinWE.normalizedX = pin.normalizedX
- ForwardCampPinWE.normalizedY = pin.normalizedY
- ForwardCampPinWE.radius = pin.radius
- ForwardCampPinWE.MapId = pin.MapId
- ForwardCampPinWE:SetTexture(pinTexture)
- -- FyrMM.SetPinSize(ForwardCampPinWE, size, 0)
- ForwardCampPinWE:SetDimensions(size, size)
- ForwardCampPinWE.pinAge = pin.pinAge
- ForwardCampPinWE:SetHidden(not usable)
- ForwardCampPinWE.MM_Tag = 3
- ForwardCampPinWE.primaryPin = pin
- pin.tertiaryPin = ForwardCampPinWE
- ForwardCampPinWE:SetColor(color:UnpackRGBA())
- ForwardCampPinWE:SetDrawLayer(3)
- FyrMM.SetPinAnchor(ForwardCampPinWE, ForwardCampPinWE.normalizedX, ForwardCampPinWE.normalizedY,
- Fyr_MM_Scroll_Map_Pins) -- Fyr_MM_Scroll_Map_QuestPins
- ForwardCampPinWE:SetHandler("OnMouseUp", PinOnMouseUp)
- ForwardCampPinWE:SetHandler("OnMouseEnter", PinOnMouseEnter)
- ForwardCampPinWE:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- local function QuestPinExists(pinType, tag, xLoc, yLoc, radius)
- local l
- for i, v in pairs(QuestPins) do
- if v.Pin ~= nil then
- l = v.Pin
- if l.m_PinTag then
- if l.m_PinTag[1] == tag[1] and l.m_PinTag[2] == tag[2] and l.m_PinTag[3] == tag[3] and l.m_PinType ==
- pinType and l.radius == radius and l.normalizedX == xLoc and l.normalizedY == yLoc then
- RemoveQuestPin(l)
- end
- end
- end
- end
- return false
- end
- function FyrMM.CreateQuestPin(pinType, tag, xLoc, yLoc, radius)
- if QuestPinExists(pinType, tag, xLoc, yLoc, radius) then
- return
- end -- dupe elimination
- FyrMM.questPinCount = FyrMM.questPinCount + 1
- local questPin
- local pinData = {}
- local index = GetQuestFreePinIndex()
- questPin = GetControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index))
- if FyrMM.SV.WheelMap and radius > 0 then
- if questPin == nil then
- questPin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index),
- Fyr_MM_Scroll_CW_Map_Pins, CT_TEXTURE)
- else
- questPin:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- end
- else
- if questPin == nil then
- questPin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_QuestPins_Pin" .. tostring(index),
- Fyr_MM_Scroll_Map_QuestPins, CT_TEXTURE)
- else
- questPin:SetParent(Fyr_MM_Scroll_Map_QuestPins)
- end
- end
- local properType, pinTexture, size, isAreaPin = FyrMM.GetQuestPinInfo(pinType, GetTrackedIsAssisted(
- TRACK_TYPE_QUEST, tag[1]), tag.isBreadcrumb, radius)
- pinType = properType
- questPin.m_PinTag = tag
- questPin.questIndex = tag[1]
- questPin.m_PinType = properType
- questPin.PinToolTipText = GenerateQuestConditionTooltipLine(tag[1], tag[3], tag[2])
- questPin.questName = GetJournalQuestName(tag[1])
- questPin.normalizedX = xLoc
- questPin.normalizedY = yLoc
- questPin.radius = radius
- questPin.MapId = CurrentMap.MapId
- questPin.pinAge = GetFrameTimeMilliseconds()
- pinData.questIndex = tag[1]
- pinData.questName = GetJournalQuestName(tag[1])
- pinData.conditionText = GenerateQuestConditionTooltipLine(tag[1], tag[3], tag[2])
- pinData.stepIndex = tag[3]
- pinData.conditionIndex = tag[2]
- pinData.pinIndex = index
- pinData.normalizedX = xLoc
- pinData.normalizedY = yLoc
- pinData.radius = radius
- pinData.isBreadcrumb = tag.isBreadcrumb
- pinData.isAssisted = GetTrackedIsAssisted(TRACK_TYPE_QUEST, tag[1])
- pinData.MapId = CurrentMap.MapId
- pinData.Pin = questPin
- pinData.tag = tag
- local questdataIndex = questpinDataExists(pinData, QuestPins)
- if questdataIndex == nil then
- table.insert(QuestPins, pinData)
- questdataIndex = questpinDataExists(pinData, QuestPins)
- else
- QuestPins[questdataIndex] = pinData
- end
- questPin.questdataIndex = questdataIndex
- local questPinData = ZOpinData[pinType]
- if (questPinData ~= nil) then
- local _, pulseTexture, glowTexture = GetPinTexture(pinType, questPin)
- questPin:SetTexture(pinTexture)
- FyrMM.SetPinSize(questPin, size, 0)
- if (pulseTexture) then
- ResetAnimation(questPin, RESET_ANIM_ALLOW_PLAY, LONG_LOOP_COUNT, pulseTexture, overlayTexture,
- ZO_MapPin.DoFinalFadeInAfterPing)
- else
- if (glowTexture) then
- ResetAnimation(questPin, RESET_ANIM_HIDE_CONTROL)
- end
- end
- questPin:SetDrawLevel(zo_max(questPinData.level, 1))
- if (questPinData.isAnimated) then
- PlayTextureAnimation(questPin, LOOP_INDEFINITELY)
- end
- if FyrMM.SV.WheelMap and questPin.radius > 0 then
- questPin.MM_Tag = 1
- CreateQuestAreaSidePins(questPin, pinData.isAssisted)
- else
- if questPin.secondaryPin ~= nil then
- questPin.secondaryPin.MM_Tag = nil
- RemoveQuestPin(questPin.secondaryPin)
- end
- if questPin.tertiaryPin ~= nil then
- questPin.tertiaryPin.MM_Tag = nil
- RemoveQuestPin(questPin.tertiaryPin)
- end
- questPin.MM_Tag = nil
- questPin.primaryPin = nil
- questPin.secondaryPin = nil
- questPin.tertiaryPin = nil
- questPin:SetParent(Fyr_MM_Scroll_Map_QuestPins)
- end
- if questPinData.tint then -- compatibility with addons which modifies questpins colors
- if type(questPinData.tint) ~= "function" then
- questPin:SetColor(questPinData.tint:UnpackRGBA())
- else
- if questPin.m_Pin ~= nil then
- questPin:SetColor(questPinData.tint(questPin.m_Pin):UnpackRGBA())
- else
- questPin:SetColor(questPinData.tint(questPin):UnpackRGBA())
- end
- end
- else
- questPin:SetColor(1, 1, 1, 1)
- end
- if isAreaPin then -- apply modified areapin colors from other addons
- if pinData.isAssisted then
- local assistedColor = ZO_MAP_PIN_ASSISTED_COLOR
- questPin:SetColor(assistedColor:UnpackRGBA())
- else
- local color = ZO_MAP_PIN_NORMAL_COLOR
- questPin:SetColor(color:UnpackRGBA())
- end
- end
- questPin:SetHidden(not ZO_WorldMap_IsPinGroupShown(MAP_FILTER_QUESTS))
- FyrMM.SetPinAnchor(questPin, questPin.normalizedX, questPin.normalizedY, Fyr_MM_Scroll_Map_QuestPins)
- if FyrMM.IsValidBorderPin(questPin) then
- FyrMM.CreateBorderPin(questPin)
- end
- if GetTrackedIsAssisted(TRACK_TYPE_QUEST, tag[1]) then
- questPin:SetDrawLayer(3)
- else
- questPin:SetDrawLayer(2)
- end
- questPin:SetHandler("OnMouseUp", PinOnMouseUp)
- questPin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- questPin:SetHandler("OnMouseExit", PinOnMouseExit)
- questPin:SetMouseEnabled(true)
- end
- end
- local function OnQuestPositionRequestComplete(eventCode, taskId, pinType, xLoc, yLoc, radius, insideCurrentMapWorld,
- isBreadcrumb)
- -- xLoc = zo_round(xLoc * 10000) / 10000
- -- yLoc = zo_round(yLoc * 10000) / 10000
- local tag = CurrentTasks[taskId]
- if (tag and insideCurrentMapWorld) then
- if CurrentTasks[taskId].Fetched then
- zo_callLater(FyrMM.RequestQuestPinUpdate, 100)
- if CurrentTasks[taskId].MapId ~= CurrentMap.MapId then
- CurrentTasks[taskId] = nil
- return
- end
- else
- if CurrentTasks[taskId].ZO_MapVisible then
- return
- end
- local pinData = {}
- pinData.questIndex = tag[1]
- pinData.questName = GetJournalQuestName(tag[1])
- pinData.conditionText = GenerateQuestConditionTooltipLine(tag[1], tag[3], tag[2])
- pinData.stepIndex = tag[3]
- pinData.conditionIndex = tag[2]
- pinData.normalizedX = xLoc
- pinData.normalizedY = yLoc
- pinData.radius = radius
- pinData.isBreadcrumb = isBreadcrumb
- pinData.isAssisted = GetTrackedIsAssisted(TRACK_TYPE_QUEST, tag[1])
- pinData.MapId = CurrentMap.MapId
- pinData.tag = tag
- local requestedquestdataIndex = questpinDataExists(pinData, RequestedQuestPins)
- if requestedquestdataIndex == nil then
- table.insert(RequestedQuestPins, pinData)
- else
- RequestedQuestPins[requestedquestdataIndex] = pinData
- end
- pinData = {}
- end
- if tag.MapId == CurrentMap.MapId then
- tag.isBreadcrumb = isBreadcrumb
- FyrMM.CreateQuestPin(pinType, tag, xLoc, yLoc, radius)
- end
- else
- if isBreadcrumb then
- NeedQuestPinUpdate = true
- end
- end
- if tag then
- CurrentTasks[taskId] = nil
- end
- if IsTableEmpty(CurrentTasks) then
- QuestTasksPending = false
- else
- QuestTasksPending = true
- end
- end
- local function AddQuestPins(questIndex)
- if (ZO_WorldMap_IsPinGroupShown(MAP_FILTER_QUESTS)) then
- local assisted = GetTrackedIsAssisted(TRACK_TYPE_QUEST, questIndex)
- if (GetJournalQuestIsComplete(questIndex)) then
- local tag = ZO_MapPin.CreateQuestPinTag(questIndex, QUEST_MAIN_STEP_INDEX, 1)
- if not TaskExists(tag) then
- local taskId = FyrMM.RequestJournalQuestConditionAssistance(questIndex, QUEST_MAIN_STEP_INDEX, 1,
- assisted)
- if taskId ~= nil then
- FyrMM.LastQuestPinRequest = GetFrameTimeMilliseconds()
- CurrentTasks[taskId] = {}
- tag.MapId = CurrentMap.MapId
- CurrentTasks[taskId] = tag
- CurrentTasks[taskId].RequestTimeStamp = FyrMM.LastQuestPinRequest
- end
- end
- else
- for stepIndex = QUEST_MAIN_STEP_INDEX, GetJournalQuestNumSteps(questIndex) do
- for conditionIndex = 1, GetJournalQuestNumConditions(questIndex, stepIndex) do
- local _, _, isFailCondition, isComplete =
- GetJournalQuestConditionValues(questIndex, stepIndex, conditionIndex)
- if (not (isFailCondition or isComplete)) then
- local tag = ZO_MapPin.CreateQuestPinTag(questIndex, stepIndex, conditionIndex)
- if not TaskExists(tag) then
- local taskId = FyrMM.RequestJournalQuestConditionAssistance(questIndex, stepIndex,
- conditionIndex, assisted)
- if taskId ~= nil then
- FyrMM.LastQuestPinRequest = GetFrameTimeMilliseconds()
- CurrentTasks[taskId] = {}
- tag.MapId = CurrentMap.MapId
- CurrentTasks[taskId] = tag
- CurrentTasks[taskId].RequestTimeStamp = FyrMM.LastQuestPinRequest
- end
- end
- end
- end
- end
- end
- end
- end
- function FyrMM.UpdateQuestPins()
- if FyrMM.Halted then
- return
- end
- if not IsTableEmpty(CurrentTasks) and GetFrameTimeMilliseconds() - FyrMM.LastQuestPinRequest >
- FYRMM_QUEST_PIN_REQUEST_TIMEOUT then
- DestroyTasks()
- end
- if not IsTableEmpty(CurrentTasks) then
- return
- end
- if IsTableEmpty(CurrentTasks) and GetFrameTimeMilliseconds() - FyrMM.LastQuestPinRequest <
- FYRMM_QUEST_PIN_REQUEST_MINIMUM_DELAY then
- return
- end -- anti spam
- FyrMM.questPinCount = GetQuestPinCount()
- QuestPinsUpdating = true
- QuestTasksPending = true
- for i = 1, MAX_JOURNAL_QUESTS do
- if (IsValidQuestIndex(i)) then
- if FyrMM.Reloading then
- return
- end
- AddQuestPins(i)
- end
- end
- end
- function FyrMM.RequestQuestPinUpdate()
- if Fyr_MM:IsHidden() then
- return
- end -- test 03/05/2023
- NeedQuestPinUpdate = true
- FyrMM.RegisterUpdates() -- fix for questpins not updating after completing quest
- end
- ---------------------------------------------------
- -- Keep Network updates
- ---------------------------------------------------
- local function AvAPinOnMouseExit(pin)
- FyrMM.SetTargetScale(pin, 1)
- if pin.tooltipId == 4 then
- ZO_Tooltips_HideTextTooltip()
- else
- ZO_KeepTooltip:SetHidden(true)
- end
- end
- local function AvAPinOnMouseEnter(pin)
- FyrMM.SetTargetScale(pin, 1.3)
- if not FyrMM.SV.PinTooltips then
- return
- end
- if pin == nil then
- return
- end
- -- if pin.m_PinType == nil then return end
- -- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType] == nil then return end
- -- if not ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].tooltip then return end
- -- if ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType].tooltip ~= ZO_KeepTooltip then return end
- if pin.tooltipId == nil then
- return
- end
- if pin.tooltipId == 1 then
- ZO_KeepTooltip:SetKeep(pin.keepId, ZO_WorldMap_GetBattlegroundQueryType(), 95)
- ZO_KeepTooltip:SetHidden(false)
- ZO_KeepTooltip:ClearAnchors()
- ZO_KeepTooltip:SetAnchor(TOPLEFT, Fyr_MM, TOPRIGHT, 0, 0)
- return
- end
- if pin.tooltipId == 2 then
- ZO_KeepTooltip:SetForwardCamp(pin.m_Pin:GetForwardCampIndex())
- ZO_KeepTooltip:SetHidden(false)
- ZO_KeepTooltip:ClearAnchors()
- ZO_KeepTooltip:SetAnchor(TOPLEFT, Fyr_MM, TOPRIGHT, 0, 0)
- return
- end
- if pin.tooltipId == 3 then
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AddLine(zo_strformat(SI_AVA_OBJECTIVE_ARTIFACT_TOOLTIP, GetAvAObjectiveInfo(pin.keepId,
- pin.objectiveId, ZO_WorldMap_GetBattlegroundQueryType())))
- return
- end
- if pin.tooltipId == 4 then
- ZO_Tooltips_ShowTextTooltip(self, nil,
- zo_strformat(SI_TOOLTIP_ALLIANCE_RESTRICTED_LINK, GetAllianceName(pin.alliance)))
- end
- end
- function FyrMM.UpdateKeepNetworkPositions()
- if not IsInAvAZone() or Fyr_MM:IsHidden() or not CurrentMap.ready then
- return
- end
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- local Count, l, startX, startY, endX, endY
- for i = 1, 100 do
- l = GetControl("Fyr_MM_Scroll_Map_Links_Link" .. tostring(i))
- if l ~= nil then
- if FyrMM.SV.WheelMap then
- l:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- else
- l:SetParent(Fyr_MM_Scroll_Map_Links)
- end
- if FyrMM.SV.RotateMap then
- l:ClearAnchors()
- l:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(l.startNX, l.startNY))
- l:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(l.endNX, l.endNY))
- else
- startX, startY, endX, endY = zo_round(l.startNX * mWidth - mWidth / 2),
- zo_round(l.startNY * mHeight - mHeight / 2), zo_round(l.endNX * mWidth - mWidth / 2),
- zo_round(l.endNY * mHeight - mHeight / 2)
- l:ClearAnchors()
- l:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, startX, startY)
- l:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, endX, endY)
- end
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksNS_Link" .. tostring(i))
- if l ~= nil then
- if FyrMM.SV.RotateMap then
- l:ClearAnchors()
- l:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(l.startNX, l.startNY))
- l:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(l.endNX, l.endNY))
- else
- startX, startY, endX, endY = l.startNX * mWidth - mWidth / 2, l.startNY * mHeight - mHeight / 2,
- l.endNX * mWidth - mWidth / 2, l.endNY * mHeight - mHeight / 2
- l:ClearAnchors()
- l:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, startX, startY)
- l:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, endX, endY)
- end
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(i))
- if l ~= nil then
- if FyrMM.SV.RotateMap then
- l:ClearAnchors()
- l:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(l.startNX, l.startNY))
- l:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(l.endNX, l.endNY))
- else
- startX, startY, endX, endY = l.startNX * mWidth - mWidth / 2, l.startNY * mHeight - mHeight / 2,
- l.endNX * mWidth - mWidth / 2, l.endNY * mHeight - mHeight / 2
- l:ClearAnchors()
- l:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, startX, startY)
- l:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, endX, endY)
- end
- end
- end
- Count = Fyr_MM_Scroll_Map_Kill_Locations:GetNumChildren()
- for i = 1, Count do
- l = Fyr_MM_Scroll_Map_Kill_Locations:GetChild(i)
- if l ~= nil then
- if l.normalizedX ~= nil and l.normalizedY ~= nil then
- FyrMM.SetPinAnchor(l, l.normalizedX, l.normalizedY, Fyr_MM_Scroll_Map_Kill_Locations)
- end
- end
- end
- Count = Fyr_MM_Scroll_Map_ForwardCamps:GetNumChildren()
- for i = 1, Count do
- l = Fyr_MM_Scroll_Map_ForwardCamps:GetChild(i)
- if l ~= nil then
- if l.normalizedX ~= nil and l.normalizedY ~= nil then
- FyrMM.SetPinAnchor(l, l.normalizedX, l.normalizedY, Fyr_MM_Scroll_Map_ForwardCamps)
- end
- end
- end
- Count = Fyr_MM_Scroll_Map_Objectives:GetNumChildren()
- for i = 1, Count do
- l = Fyr_MM_Scroll_Map_Objectives:GetChild(i)
- if l ~= nil then
- if l.normalizedX ~= nil and l.normalizedY ~= nil then
- FyrMM.SetPinAnchor(l, l.normalizedX, l.normalizedY, Fyr_MM_Scroll_Map_Objectives)
- end
- end
- end
- for i, v in pairs(KeepIndex) do
- l = GetControl("Fyr_MM_Scroll_Map_Keeps_Keep" .. tostring(v))
- if l ~= nil then
- if l.normalizedX ~= nil and l.normalizedY ~= nil then
- FyrMM.SetPinAnchor(l, l.normalizedX, l.normalizedY, Fyr_MM_Scroll_Map_Keeps)
- end
- end
- l = GetControl("Fyr_MM_Scroll_Map_Keeps_Under_Attack_Keep" .. tostring(i))
- if l ~= nil then
- if l.normalizedX ~= nil and l.normalizedY ~= nil then
- FyrMM.SetPinAnchor(l, l.normalizedX, l.normalizedY, Fyr_MM_Scroll_Map_Keeps)
- end
- end
- end
- end
- function FyrMM.KeepNetworkCleanupReminder(from, parent)
- if parent == nil then
- return
- end
- local t = GetGameTimeMilliseconds()
- local Count = parent:GetNumChildren()
- for i = from, Count do
- l = parent:GetChild(i)
- if l ~= nil then
- l:ClearAnchors()
- l.nX = nil
- l.nY = nil
- l.m_PinType = nil
- l.tooltipId = nil
- l.continuousUpdate = nil
- l.objectiveId = nil
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- PinsList[l:GetName()] = nil
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.KeepNetworkCleanupReminder " .. parent:GetName() .. " " ..
- tostring(GetGameTimeMilliseconds() - t))
- end
- end
- function FyrMM.UpdateKeepNetwork()
- if FyrMM.Halted then
- return
- end
- if CurrentMap.MapId < 578 and CurrentMap.MapId > 571 and FyrMM.dirtyLinks then -- clean links once when arriving at base
- KeepIndex = {}
- local LinksDone = false
- local LinksNSDone = false
- local LinksWEDone = false
- local LocksDone = false
- for i = 1, 100 do
- l = GetControl("Fyr_MM_Scroll_Map_Links_Link" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksNS_Link" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksNSDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksWEDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_Locks_Lock" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l.normalizedX = nil
- l.normalizedY = nil
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- else
- LocksDone = true
- end
- if LinksDone and LinksNSDone and LinksWEDone and LocksDone then
- i = 100
- end
- end
- FyrMM.dirtyLinks = false
- end
- if CurrentMap.MapId == 16 then
- FyrMM.dirtyLinks = true
- end -- set links as dirty when on the Cyrodiil big map
- if CurrentMap.MapId ~= 16 and CurrentMap.MapId ~= 660 and (CurrentMap.MapId > 577 or CurrentMap.MapId < 572) then -- no links & keep display when not on Cyrodiil map, Imperial city, or the 6 bases
- KeepIndex = {}
- local LinksDone = false
- local LinksNSDone = false
- local LinksWEDone = false
- local LocksDone = false
- for i = 1, 100 do
- l = GetControl("Fyr_MM_Scroll_Map_Links_Link" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksNS_Link" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksNSDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- else
- LinksWEDone = true
- end
- l = GetControl("Fyr_MM_Scroll_Map_Locks_Lock" .. tostring(i))
- if l ~= nil then
- l:ClearAnchors()
- l.normalizedX = nil
- l.normalizedY = nil
- l:SetHidden(true)
- l:SetMouseEnabled(false)
- -- l:SetTexture(nil)
- l:SetDimensions(0, 0)
- else
- LocksDone = true
- end
- if LinksDone and LinksNSDone and LinksWEDone and LocksDone then
- i = 100
- end
- end
- if not IsActiveWorldBattleground() then -- if in battleground we continue to display the objectives
- FyrMM.KeepRefreshNeeded = false
- return
- end
- end
- if not IsInAvAZone() or (not FyrMM.Visible or Fyr_MM:IsHidden()) or
- (not CurrentMap.ready and not CurrentMap.mapBuilt) then
- return
- end
- if not FyrMM.KeepRefreshNeeded then
- return
- end
- local t = GetGameTimeMilliseconds()
- local historyPercent = 100.0
- local playerAlliance = GetUnitAlliance("player")
- local bgContext = ZO_WorldMap_GetBattlegroundQueryType()
- local mWidth, mHeight = Fyr_MM_Scroll_Map:GetDimensions()
- FyrMM.KeepNetworkCleanupReminder(1, Fyr_MM_Scroll_Map_Keeps)
- FyrMM.KeepNetworkCleanupReminder(1, Fyr_MM_Scroll_Map_Keeps_Under_Attack)
- for i = 1, GetNumKeeps() do
- if FyrMM.Reloading then
- return
- end
- local keepId, kbgContext = GetKeepKeysByIndex(i)
- KeepIndex[keepId] = nil
- if IsLocalBattlegroundContext(kbgContext) then
- KeepIndex[keepId] = i
- local pinType, normalizedX, normalizedY = GetHistoricalKeepPinInfo(keepId, bgContext, historyPercent)
- -- normalizedX = zo_round(normalizedX * 10000) / 10000
- -- normalizedY = zo_round(normalizedY * 10000) / 10000
- local keepAlliance = GetKeepAlliance(keepId, bgContext)
- local keepUnderAttack = GetKeepUnderAttack(keepId, bgContext)
- local keepUnderAttackPinType = ZO_WorldMap_GetUnderAttackPinForKeepPin(pinType)
- if FyrMM.IsCoordinatesInMap(normalizedX, normalizedY) then
- local uakeepControl = GetControl("Fyr_MM_Scroll_Map_Keeps_Under_Attack_Keep" .. tostring(keepId))
- if keepUnderAttack then
- if uakeepControl == nil then
- uakeepControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_Keeps_Under_Attack_Keep" .. tostring(keepId),
- Fyr_MM_Scroll_Map_Keeps_Under_Attack, CT_TEXTURE)
- end
- uakeepControl:SetTexture(GetPinTexture(keepUnderAttackPinType, uakeepControl))
- uakeepControl.nX = normalizedX
- uakeepControl.nY = normalizedY
- uakeepControl.keepId = keepId
- uakeepControl.m_PinType = keepUnderAttackPinType
- uakeepControl:SetHidden(false)
- uakeepControl:SetDrawLayer(1)
- FyrMM.SetPinSize(uakeepControl,
- ZO_MapPin.PIN_DATA[keepUnderAttackPinType].size * FyrMM.pScalePercent, 0)
- FyrMM.SetPinAnchor(uakeepControl, normalizedX, normalizedY, Fyr_MM_Scroll_Map_Keeps_Under_Attack)
- else
- if uakeepControl ~= nil then
- uakeepControl:ClearAnchors()
- uakeepControl.nX = nil
- uakeepControl.nY = nil
- uakeepControl.m_PinType = nil
- uakeepControl:SetHidden(true)
- uakeepControl:SetMouseEnabled(false)
- uakeepControl:SetTexture(nil)
- uakeepControl:SetDimensions(0, 0)
- PinsList[uakeepControl:GetName()] = nil
- end
- end
- local keepControl = GetControl("Fyr_MM_Scroll_Map_Keeps_Keep" .. tostring(i))
- if keepControl == nil then
- keepControl = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Keeps_Keep" .. tostring(i),
- Fyr_MM_Scroll_Map_Keeps, CT_TEXTURE)
- keepControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- keepControl:SetHandler("OnMouseExit", AvAPinOnMouseExit)
- end
- keepControl.nX = normalizedX
- keepControl.nY = normalizedY
- keepControl:SetTexture(GetPinTexture(pinType, keepControl))
- keepControl.keepId = keepId
- keepControl.m_PinType = pinType
- keepControl:SetDrawLayer(3)
- FyrMM.SetPinSize(keepControl, ZO_MapPin.PIN_DATA[pinType].size * FyrMM.pScalePercent, 0)
- keepControl:SetHidden(false)
- FyrMM.SetPinAnchor(keepControl, normalizedX, normalizedY, Fyr_MM_Scroll_Map_Keeps)
- local pinTooltipInfo = ZO_MapPin.TOOLTIP_CREATORS[pinType]
- keepControl.tooltipId = 1 -- Keeps
- keepControl:SetMouseEnabled(true)
- else
- keepControl = GetControl("Fyr_MM_Scroll_Map_Keeps_Keep" .. tostring(keepId))
- uakeepControl = GetControl("Fyr_MM_Scroll_Map_Keeps_Keep" .. tostring(keepId))
- if keepControl ~= nil then
- keepControl:SetHidden(true)
- end
- if uakeepControl ~= nil then
- uakeepControl:SetHidden(true)
- end
- end
- end
- end
- local numForwardCamps = GetNumForwardCamps(bgContext)
- FyrMM.currentForwardCamps = 0
- FyrMM.KeepNetworkCleanupReminder(numForwardCamps + 1, Fyr_MM_Scroll_Map_ForwardCamps)
- for i = 1, numForwardCamps do
- local pinType, normalizedX, normalizedY, radius, usable = GetForwardCampPinInfo(bgContext, i)
- -- normalizedX = zo_round(normalizedX * 10000) / 10000
- -- normalizedY = zo_round(normalizedY * 10000) / 10000
- if (normalizedX > 0 and normalizedX < 1.0001 and normalizedY > 0 and normalizedY < 1.0001) then
- if not usable then
- radius = 0
- end
- FyrMM.currentForwardCamps = FyrMM.currentForwardCamps + 1
- local forwardCampControl = GetControl("Fyr_MM_Scroll_Map_ForwardCamps_Pin" ..
- tostring(FyrMM.currentForwardCamps))
- if forwardCampControl == nil then
- forwardCampControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_ForwardCamps_Pin" .. tostring(FyrMM.currentForwardCamps),
- Fyr_MM_Scroll_Map_ForwardCamps, CT_TEXTURE)
- forwardCampControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- forwardCampControl:SetHandler("OnMouseExit", AvAPinOnMouseExit)
- end
- local forwardCampBlobControl = GetControl("Fyr_MM_Scroll_Map_ForwardCamps_Pin" ..
- tostring(FyrMM.currentForwardCamps) .. "_Blob")
- if forwardCampBlobControl == nil then
- forwardCampBlobControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_ForwardCamps_Pin" .. tostring(FyrMM.currentForwardCamps) .. "_Blob",
- Fyr_MM_Scroll_Map_ForwardCamps, CT_TEXTURE)
- end
- local pin = ZO_Object.New(ZO_MapPin)
- forwardCampControl.nX = normalizedX
- forwardCampControl.nY = normalizedY
- forwardCampBlobControl.nX = normalizedX
- forwardCampBlobControl.nY = normalizedY
- pin.normalizedX = normalizedX
- pin.normalizedY = normalizedY
- pin.radius = radius
- pin.m_PinType = pinType
- pin.m_PinTag = ZO_MapPin.CreateForwardCampPinTag(i)
- forwardCampBlobControl.m_Pin = pin
- forwardCampBlobControl:SetDrawLayer(3)
- forwardCampBlobControl:SetTexture("esoui/art/mappins/map_areapin.dds")
- local color = ZO_MAP_PIN_NORMAL_COLOR
- forwardCampBlobControl:SetColor(color:UnpackRGBA())
- forwardCampControl.m_Pin = pin
- forwardCampControl.m_PinType = pinType
- forwardCampControl:SetDrawLayer(3)
- forwardCampControl:SetTexture(ZO_MapPin.PIN_DATA[pinType].texture)
- local campIconSize = 64 * FyrMM.pScalePercent
- local campBlobSize = mHeight * radius * 2
- FyrMM.SetPinSize(forwardCampControl, campIconSize, 0)
- forwardCampBlobControl:SetDimensions(campBlobSize, campBlobSize)
- if FyrMM.SV.WheelMap then
- forwardCampBlobControl:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- CreateForwardCampAreaSidePins(pin, campBlobSize, usable)
- end
- forwardCampControl:SetHidden(false)
- forwardCampBlobControl:SetHidden(not usable)
- FyrMM.SetPinAnchor(forwardCampControl, normalizedX, normalizedY, Fyr_MM_Scroll_Map_ForwardCamps)
- FyrMM.SetPinAnchor(forwardCampBlobControl, normalizedX, normalizedY, Fyr_MM_Scroll_Map_ForwardCamps)
- forwardCampControl.tooltipId = 2
- forwardCampControl:SetMouseEnabled(true)
- end
- end
- --- Kill Locations (Battles)
- ---
- local killPinCount = 0
- FyrMM.KeepNetworkCleanupReminder(GetNumKillLocations() + 1, Fyr_MM_Scroll_Map_Kill_Locations)
- for i = 1, GetNumKillLocations() do
- local pinType, normalizedX, normalizedY = GetKillLocationPinInfo(i)
- -- normalizedX = zo_round(normalizedX * 10000) / 10000
- -- normalizedY = zo_round(normalizedY * 10000) / 10000
- if (pinType ~= MAP_PIN_TYPE_INVALID) then
- if (ZO_WorldMap_IsPinGroupShown(MAP_FILTER_KILL_LOCATIONS)) then
- if ((normalizedX < 1.001 or normalizedY < 1.001) and (normalizedX > -.001 or normalizedY > -.001)) then
- killPinCount = killPinCount + 1
- local killPin = GetControl("Fyr_MM_Scroll_Map_Kill_Locations_Pin" .. tostring(killPinCount))
- if killPin == nil then
- killPin = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_Kill_Locations_Pin" .. tostring(killPinCount),
- Fyr_MM_Scroll_Map_Kill_Locations, CT_TEXTURE)
- end
- local killPinSize = ZO_MapPin.PIN_DATA[pinType].size * FyrMM.pScalePercent
- killPin:SetTexture(ZO_MapPin.PIN_DATA[pinType].texture)
- FyrMM.SetPinSize(killPin, killPinSize, 0)
- local pin = ZO_Object.New(ZO_MapPin)
- pin.normalizedX = normalizedX
- pin.normalizedY = normalizedY
- pin.m_PinType = pinType
- pin.m_PinTag = i
- killPin.m_Pin = pin
- killPin.m_PinType = pinType
- killPin.nX = normalizedX
- killPin.nY = normalizedY
- killPin:SetDrawLayer(3)
- killPin:SetHidden(false)
- FyrMM.SetPinAnchor(killPin, normalizedX, normalizedY, Fyr_MM_Scroll_Map_Kill_Locations)
- end
- end
- end
- end
- local r, g, b
- local numLinks = GetNumKeepTravelNetworkLinks(bgContext)
- local linkControl, linkControlNS, linkControlWE
- for linkIndex = 1, numLinks do
- local linkType, linkOwner, restrictedToAlliance, startNX, startNY, endNX, endNY =
- GetHistoricalKeepTravelNetworkLinkInfo(linkIndex, bgContext, historyPercent)
- -- startNX = zo_round(startNX * 10000) / 10000
- -- startNY = zo_round(startNY * 10000) / 10000
- -- endNX = zo_round(endNX * 10000) / 10000
- -- endNY = zo_round(endNY * 10000) / 10000
- if startNX < 1 or startNY < 1 or endNX < 1 or endNY < 1 then
- local startX, startY, endX, endY = zo_round(startNX * mWidth - mWidth / 2),
- zo_round(startNY * mHeight - mHeight / 2), zo_round(endNX * mWidth - mWidth / 2),
- zo_round(endNY * mHeight - mHeight / 2)
- local linkControl = GetControl("Fyr_MM_Scroll_Map_Links_Link" .. tostring(linkIndex))
- if linkControl == nil then
- linkControl = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Links_Link" .. tostring(linkIndex),
- Fyr_MM_Scroll_Map_Links, CT_LINE)
- end
- local linkControlNS = GetControl("Fyr_MM_Scroll_Map_LinksNS_Link" .. tostring(linkIndex))
- if linkControlNS == nil then
- linkControlNS = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_LinksNS_Link" .. tostring(linkIndex),
- Fyr_MM_Scroll_NS_Map_Pins, CT_LINE)
- end
- local linkControlWE = GetControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(linkIndex))
- if GetControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(linkIndex)) == nil then
- linkControlWE = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_LinksWE_Link" .. tostring(linkIndex),
- Fyr_MM_Scroll_WE_Map_Pins, CT_LINE)
- end
- linkControl.startNX = startNX
- linkControl.startNY = startNY
- linkControl.endNX = endNX
- linkControl.endNY = endNY
- linkControl:SetHidden(false)
- linkControl:SetDrawLayer(1)
- linkControlNS.startNX = startNX
- linkControlNS.startNY = startNY
- linkControlNS.endNX = endNX
- linkControlNS.endNY = endNY
- linkControlNS:SetHidden(false)
- linkControlNS:SetDrawLayer(1)
- linkControlWE.startNX = startNX
- linkControlWE.startNY = startNY
- linkControlWE.endNX = endNX
- linkControlWE.endNY = endNY
- linkControlWE:SetHidden(false)
- linkControlWE:SetDrawLayer(1)
- local linkThickness = math.floor((zo_round(80 * FyrMM.pScalePercent) / 10) / 2) * 2
- if linkThickness < 6 then
- linkThickness = 6
- end
- linkControl:SetThickness(linkThickness)
- linkControlNS:SetThickness(linkThickness)
- linkControlWE:SetThickness(linkThickness)
- if (GetKeepFastTravelInteraction()) then
- if (linkOwner == playerAlliance) then
- if (linkType == FAST_TRAVEL_LINK_ACTIVE) then
- linkControl:SetColor(ZO_KeepNetwork.LINK_READY_COLOR:UnpackRGBA())
- linkControlNS:SetColor(ZO_KeepNetwork.LINK_READY_COLOR:UnpackRGBA())
- linkControlWE:SetColor(ZO_KeepNetwork.LINK_READY_COLOR:UnpackRGBA())
- else
- linkControl:SetColor(ZO_KeepNetwork.LINK_NOT_READY_COLOR:UnpackRGBA())
- linkControlNS:SetColor(ZO_KeepNetwork.LINK_NOT_READY_COLOR:UnpackRGBA())
- linkControlWE:SetColor(ZO_KeepNetwork.LINK_NOT_READY_COLOR:UnpackRGBA())
- end
- else
- r, g, b = GetAllianceColor(linkOwner):UnpackRGB()
- linkControl:SetColor(r, g, b, ZO_KeepNetwork.ALLIANCE_OWNER_ALPHA[linkOwner])
- linkControlNS:SetColor(r, g, b, ZO_KeepNetwork.ALLIANCE_OWNER_ALPHA[linkOwner])
- linkControlWE:SetColor(r, g, b, ZO_KeepNetwork.ALLIANCE_OWNER_ALPHA[linkOwner])
- end
- else
- r, g, b = GetAllianceColor(linkOwner):UnpackRGB()
- linkControl:SetColor(r, g, b, ZO_KeepNetwork.ALLIANCE_OWNER_ALPHA[linkOwner])
- linkControlNS:SetColor(r, g, b, ZO_KeepNetwork.ALLIANCE_OWNER_ALPHA[linkOwner])
- linkControlWE:SetColor(r, g, b, ZO_KeepNetwork.ALLIANCE_OWNER_ALPHA[linkOwner])
- end
- if (linkType == FAST_TRAVEL_LINK_IN_COMBAT) then
- linkControl:SetTexture("EsoUI/Art/AvA/AvA_transitLine_dashed.dds")
- linkControlNS:SetTexture("EsoUI/Art/AvA/AvA_transitLine_dashed.dds")
- linkControlWE:SetTexture("EsoUI/Art/AvA/AvA_transitLine_dashed.dds")
- else
- linkControl:SetTexture("EsoUI/Art/AvA/AvA_transitLine.dds")
- linkControlNS:SetTexture("EsoUI/Art/AvA/AvA_transitLine.dds")
- linkControlWE:SetTexture("EsoUI/Art/AvA/AvA_transitLine.dds")
- end
- if FyrMM.SV.WheelMap then
- linkControl:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- else
- linkControl:SetParent(Fyr_MM_Scroll_Map_Links)
- end
- linkControl:ClearAnchors()
- linkControlNS:ClearAnchors()
- linkControlWE:ClearAnchors()
- if FyrMM.SV.RotateMap then
- linkControl:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(startNX, startNY))
- linkControl:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(endNX, endNY))
- linkControlNS:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(startNX, startNY))
- linkControlNS:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(endNX, endNY))
- linkControlWE:SetAnchor(TOPLEFT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(startNX, startNY))
- linkControlWE:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll, CENTER, GetRotatedPosition(endNX, endNY))
- else
- linkControl:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, startX, startY)
- linkControl:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, endX, endY)
- linkControlNS:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, startX, startY)
- linkControlNS:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, endX, endY)
- linkControlWE:SetAnchor(TOPLEFT, Fyr_MM_Scroll_Map_Links, CENTER, startX, startY)
- linkControlWE:SetAnchor(BOTTOMRIGHT, Fyr_MM_Scroll_Map_Links, CENTER, endX, endY)
- end
- -- Link Locks
- if (linkOwner == ALLIANCE_NONE and restrictedToAlliance ~= ALLIANCE_NONE) then
- local lockControl = GetControl("Fyr_MM_Scroll_Map_Locks_Lock" .. tostring(linkIndex))
- if lockControl == nil then
- lockControl = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Locks_Lock" .. tostring(linkIndex),
- Fyr_MM_Scroll_Map_Locks, CT_TEXTURE)
- lockControl:SetAlpha(0.4)
- end
- lockControl:SetTexture("/esoui/art/ava/ava_transitlocked.dds")
- FyrMM.SetPinSize(lockControl, 16 * FyrMM.pScalePercent, 0)
- lockControl:SetHidden(false)
- r, g, b = GetAllianceColor(restrictedToAlliance):UnpackRGB()
- lockControl:SetColor(r, g, b, 1)
- lockControl.alliance = restrictedToAlliance
- lockControl:SetDrawLayer(2)
- if FyrMM.SV.WheelMap then
- lockControl:SetParent(Fyr_MM_Scroll_CW_Map_Pins)
- else
- lockControl:SetParent(Fyr_MM_Scroll_Map_Links)
- end
- lockControl:ClearAnchors()
- lockControl:SetAnchor(CENTER, linkControl, CENTER, 0, 0)
- lockControl.Lock = true
- lockControl.tooltipId = 4
- lockControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- lockControl:SetHandler("OnMouseExit", AvAPinOnMouseExit)
- lockControl:SetMouseEnabled(true)
- end
- end
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "FyrMM.UpdateKeepNetwork " .. tostring(GetGameTimeMilliseconds() - t))
- end
- FyrMM.KeepRefreshNeeded = false
- end
- function FyrMM.RequestKeepRefresh()
- FyrMM.KeepRefreshNeeded = true
- FyrMM.lastKeepRefresh = FyrMM.lastKeepRefresh or 0
- if not IsInAvAZone() or FyrMM.SV.HidePvPPins then
- return
- end
- if FyrMM.lastKeepRefresh ~= GetSecondsSinceMidnight() or FyrMM.lastKeepRefresh == 0 then
- FyrMM.UpdateKeepNetwork()
- FyrMM.lastKeepRefresh = GetSecondsSinceMidnight()
- -- d("refreshing keep network "..GetTimeString())
- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "Keep refresh request ")
- end
- end
- function FyrMM.UpdateAVABGobjectives()
- if FyrMM.Halted or FyrMM.SV.HidePvPPins then
- return
- end
- if (not IsInAvAZone() and not IsActiveWorldBattleground()) or (not FyrMM.Visible or Fyr_MM:IsHidden()) or
- (not CurrentMap.ready and not CurrentMap.mapBuilt) then
- return
- end
- if FyrMM.UpdateAVABGobjectivesBusy then
- return
- end
- FyrMM.UpdateAVABGobjectivesBusy = true
- local bgContext = ZO_WorldMap_GetBattlegroundQueryType()
- local numObjectives = GetNumObjectives()
- FyrMM.KeepNetworkCleanupReminder(1, Fyr_MM_Scroll_Map_Objectives)
- for i = 1, numObjectives do
- local okeepId, objectiveId, obgContext = GetAvAObjectiveKeysByIndex(i)
- if (IsLocalBattlegroundContext(obgContext)) then
- if ZO_WorldMap_IsObjectiveShown(okeepId, objectiveId, obgContext) and
- DoesObjectiveExist(okeepId, objectiveId, obgContext) then
- local opinType, currentX, currentY, continuousUpdate =
- GetAvAObjectivePinInfo(okeepId, objectiveId, bgContext)
- local spawnPinType, spawnX, spawnY = GetObjectiveSpawnPinInfo(okeepId, objectiveId, bgContext)
- local returnPinType, returnX, returnY, returnContinuousUpdate =
- GetObjectiveReturnPinInfo(okeepId, objectiveId, bgContext)
- local visible = IsObjectiveObjectVisible(okeepId, objectiveId, bgContext)
- local alliance = GetCarryableObjectiveHoldingAllianceInfo(okeepId, objectiveId, bgContext)
- local auraR, auraG, auraB, auraA = GetAllianceColor(alliance):UnpackRGBA()
- if spawnPinType ~= MAP_PIN_TYPE_INVALID and visible then
- local objectiveSpawnControl = GetControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveSpawn" .. tostring(objectiveId))
- if objectiveSpawnControl == nil then
- objectiveSpawnControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveSpawn" .. tostring(objectiveId),
- Fyr_MM_Scroll_Map_Objectives, CT_TEXTURE)
- objectiveSpawnControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- objectiveSpawnControl:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- objectiveSpawnControl.nX = spawnX
- objectiveSpawnControl.nY = spawnY
- objectiveSpawnControl.m_PinType = spawnPinType
- objectiveSpawnControl:SetDrawLayer(3)
- objectiveSpawnControl:SetDrawLevel(ZO_MapPin.PIN_DATA[spawnPinType].level)
- objectiveSpawnControl:SetTexture(GetPinTexture(spawnPinType, objectiveSpawnControl))
- FyrMM.SetPinSize(objectiveSpawnControl, ZO_MapPin.PIN_DATA[spawnPinType].size * FyrMM.pScalePercent,
- 0)
- objectiveSpawnControl:SetHidden(false)
- FyrMM.SetPinAnchor(objectiveSpawnControl, spawnX, spawnY, Fyr_MM_Scroll_Map_Objectives)
- objectiveSpawnControl.keepId = okeepId
- objectiveSpawnControl.objectiveId = objectiveId
- objectiveSpawnControl.tooltipId = 3
- objectiveSpawnControl:SetMouseEnabled(true)
- if FyrMM.SV.borderAVABG then -- create borderpin
- AVABGobjectivesToBorderPins = AVABGobjectivesToBorderPins or {}
- local playerBGalliance = GetUnitBattlegroundAlliance("player")
- -- chaosball base & your "capture the relic" base
- local display = false
- if spawnPinType == MAP_PIN_TYPE_BGPIN_MURDERBALL_SPAWN_NEUTRAL then
- display = true
- elseif spawnPinType == MAP_PIN_TYPE_BGPIN_FLAG_SPAWN_FIRE_DRAKES and playerBGalliance == 1 then
- display = true
- elseif spawnPinType == MAP_PIN_TYPE_BGPIN_FLAG_SPAWN_PIT_DAEMONS and playerBGalliance == 2 then
- display = true
- elseif spawnPinType == MAP_PIN_TYPE_BGPIN_FLAG_SPAWN_STORM_LORDS and playerBGalliance == 3 then
- display = true
- end
- if objectiveSpawnControl and display then
- objectiveSpawnControl.AVABGtype = "spawn"
- AVABGobjectivesToBorderPins["spawn" .. tostring(objectiveId)] = objectiveSpawnControl
- end
- end
- end
- if returnPinType ~= MAP_PIN_TYPE_INVALID and visible then -- Diamond shape icon
- local objectiveReturnControl = GetControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveReturn" .. tostring(objectiveId))
- if objectiveReturnControl == nil then
- objectiveReturnControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveReturn" .. tostring(objectiveId),
- Fyr_MM_Scroll_Map_Objectives, CT_TEXTURE)
- objectiveReturnControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- objectiveReturnControl:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- objectiveReturnControl.nX = currentX
- objectiveReturnControl.nY = currentY
- objectiveReturnControl.m_PinType = returnPinType
- objectiveReturnControl.continuousUpdate = returnContinuousUpdate
- objectiveReturnControl:SetDrawLayer(3)
- objectiveReturnControl:SetDrawLevel(ZO_MapPin.PIN_DATA[returnPinType].level)
- objectiveReturnControl:SetTexture(GetPinTexture(returnPinType, objectiveReturnControl))
- FyrMM.SetPinSize(objectiveReturnControl,
- ZO_MapPin.PIN_DATA[returnPinType].size * FyrMM.pScalePercent, 0)
- objectiveReturnControl:SetHidden(false)
- FyrMM.SetPinAnchor(objectiveReturnControl, currentX, currentY, Fyr_MM_Scroll_Map_Objectives)
- objectiveReturnControl.keepId = okeepId
- objectiveReturnControl.objectiveId = objectiveId
- objectiveReturnControl.tooltipId = 3
- objectiveReturnControl:SetMouseEnabled(true)
- -- if FyrMM.SV.borderAVABG then -- create borderpin
- -- AVABGobjectivesToBorderPins = AVABGobjectivesToBorderPins or {}
- -- if objectiveReturnControl then
- -- objectiveReturnControl.AVABGtype = "return"
- -- AVABGobjectivesToBorderPins["return"..tostring(objectiveId)] = objectiveReturnControl
- -- end
- -- end
- end
- if opinType ~= MAP_PIN_TYPE_INVALID and visible then
- local objectiveControl = GetControl("Fyr_MM_Scroll_Map_Objectives_Objective" ..
- tostring(objectiveId))
- if objectiveControl == nil then
- objectiveControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_Objectives_Objective" .. tostring(objectiveId),
- Fyr_MM_Scroll_Map_Objectives, CT_TEXTURE)
- objectiveControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- objectiveControl:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- objectiveControl.nX = currentX
- objectiveControl.nY = currentY
- objectiveControl.m_PinType = opinType
- objectiveControl.continuousUpdate = continuousUpdate
- objectiveControl:SetDrawLayer(3)
- objectiveControl:SetDrawLevel(ZO_MapPin.PIN_DATA[opinType].level)
- objectiveControl:SetTexture(GetPinTexture(opinType, objectiveControl))
- FyrMM.SetPinSize(objectiveControl, (ZO_MapPin.PIN_DATA[opinType].size * FyrMM.pScalePercent), 0)
- objectiveControl:SetHidden(false)
- FyrMM.SetPinAnchor(objectiveControl, currentX, currentY, Fyr_MM_Scroll_Map_Objectives)
- objectiveControl.keepId = okeepId
- objectiveControl.objectiveId = objectiveId
- objectiveControl.tooltipId = 3
- objectiveControl:SetMouseEnabled(true)
- if FyrMM.SV.borderAVABG then -- create borderpin
- AVABGobjectivesToBorderPins = AVABGobjectivesToBorderPins or {}
- if objectiveControl then
- objectiveControl.AVABGtype = "objective"
- AVABGobjectivesToBorderPins["objective" .. tostring(objectiveId)] = objectiveControl
- end
- end
- if objectiveControl then
- local auraPinType, red, green, blue = GetObjectiveAuraPinInfo(okeepId, objectiveId, bgContext)
- if auraPinType ~= MAP_PIN_TYPE_INVALID and visible then
- local objectiveAuraControl = GetControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveAura" .. tostring(objectiveId))
- if objectiveAuraControl == nil then
- objectiveAuraControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveAura" .. tostring(objectiveId),
- Fyr_MM_Scroll_Map_Objectives, CT_TEXTURE)
- objectiveAuraControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- objectiveAuraControl:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- local auraTag = ZO_MapPin.CreateObjectivePinTag(okeepId, objectiveId, bgContext)
- objectiveAuraControl.nX = currentX
- objectiveAuraControl.nY = currentY
- objectiveAuraControl.m_PinType = auraPinType
- objectiveAuraControl.m_PinTag = auraTag
- objectiveAuraControl.continuousUpdate = continuousUpdate
- objectiveAuraControl:SetDrawLayer(3)
- objectiveAuraControl:SetDrawLevel(ZO_MapPin.PIN_DATA[auraPinType].level)
- objectiveAuraControl:SetTexture(GetPinTexture(auraPinType, objectiveAuraControl))
- FyrMM.SetPinSize(objectiveAuraControl,
- (ZO_MapPin.PIN_DATA[auraPinType].size * FyrMM.pScalePercent), 0)
- objectiveAuraControl:SetHidden(false)
- FyrMM.SetPinAnchor(objectiveAuraControl, currentX, currentY, Fyr_MM_Scroll_Map_Objectives)
- objectiveAuraControl.keepId = okeepId
- objectiveAuraControl.objectiveId = objectiveId
- objectiveAuraControl.tooltipId = 3
- objectiveAuraControl:SetColor(red, green, blue)
- objectiveAuraControl.tint = ZO_ColorDef:New(red, green, blue)
- objectiveAuraControl:SetMouseEnabled(true)
- if FyrMM.SV.borderAVABG then -- create borderpin
- AVABGobjectivesToBorderPins = AVABGobjectivesToBorderPins or {}
- if objectiveAuraControl then
- objectiveAuraControl.AVABGtype = "aura"
- AVABGobjectivesToBorderPins["aura" .. tostring(objectiveId)] = objectiveAuraControl
- end
- end
- elseif visible and ZO_MapPin.PIN_DATA[opinType].level == 105 and alliance ~= ALLIANCE_NONE then -- let's make an aura pin for elder scrolls which doesn't exist in game :)
- local objectiveAuraControl = GetControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveAura" .. tostring(objectiveId))
- if objectiveAuraControl == nil then
- objectiveAuraControl = WINDOW_MANAGER:CreateControl(
- "Fyr_MM_Scroll_Map_Objectives_ObjectiveAura" .. tostring(objectiveId),
- Fyr_MM_Scroll_Map_Objectives, CT_TEXTURE)
- objectiveAuraControl:SetHandler("OnMouseEnter", AvAPinOnMouseEnter)
- objectiveAuraControl:SetHandler("OnMouseExit", PinOnMouseExit)
- end
- local auraTag = ZO_MapPin.CreateObjectivePinTag(okeepId, objectiveId, bgContext)
- objectiveAuraControl.nX = currentX
- objectiveAuraControl.nY = currentY
- objectiveAuraControl.m_PinType = 9999
- objectiveAuraControl.m_PinTag = auraTag
- objectiveAuraControl.continuousUpdate = continuousUpdate
- objectiveAuraControl:SetDrawLayer(3)
- objectiveAuraControl:SetDrawLevel(104)
- objectiveAuraControl:SetTexture("MiniMap/Textures/scroll_aura.dds")
- FyrMM.SetPinSize(objectiveAuraControl, (64 * FyrMM.pScalePercent), 0)
- objectiveAuraControl:SetHidden(false)
- FyrMM.SetPinAnchor(objectiveAuraControl, currentX, currentY, Fyr_MM_Scroll_Map_Objectives)
- objectiveAuraControl.keepId = okeepId
- objectiveAuraControl.objectiveId = objectiveId
- objectiveAuraControl.tooltipId = 3
- objectiveAuraControl:SetColor(auraR, auraG, auraB, auraA)
- objectiveAuraControl.tint = ZO_ColorDef:New(auraR, auraG, auraB, auraA)
- objectiveAuraControl:SetMouseEnabled(true)
- if FyrMM.SV.borderAVABG then -- create borderpin
- AVABGobjectivesToBorderPins = AVABGobjectivesToBorderPins or {}
- if objectiveAuraControl then
- objectiveAuraControl.AVABGtype = "aura"
- AVABGobjectivesToBorderPins["aura" .. tostring(objectiveId)] = objectiveAuraControl
- end
- end
- end
- end
- end
- end
- end
- end
- FyrMM.UpdateAVABGobjectivesBusy = false
- end
- -------------------------------------------------------------
- -- Miscelaneous functions
- -------------------------------------------------------------
- function FyrMM.IsCoordinatesInMap(nX, nY)
- if nX <= 1 and nX >= 0 and nY <= 1 and nY >= 0 then
- return true
- else
- return false
- end
- end
- function FyrMM.SetCurrentMapZoom(newZoom)
- CurrentMap.ZoomLevel = newZoom
- if FyrMM.SV.ZoomTable ~= nil then
- if not CurrentMap.filename or CurrentMap.filename == "" then
- local filename, _, _ = GetCurrentMapTextureFileInfo()
- CurrentMap.filename = string.lower(filename)
- end
- FyrMM.SV.ZoomTable[CurrentMap.filename] = newZoom
- -- d("set new zoom to "..newZoom.." for "..CurrentMap.filename )
- end
- Fyr_MM_ZoomLevel:SetText(newZoom)
- end
- function FyrMM.UnregisterUpdates(fromRegister)
- if FyrMM.HaltTimeOffset + 1000 > GetFrameTimeMilliseconds() then
- return
- end
- -- if not fromRegister then d("unregister updates") end
- FyrMM.Halted = true
- FyrMM.HaltTimeOffset = GetFrameTimeMilliseconds()
- -- EVENT_MANAGER:UnregisterForUpdate("OnUpdateFyrMMMapView")
- EVENT_MANAGER:UnregisterForUpdate("OnUpdateFyrMMMapPins")
- EVENT_MANAGER:UnregisterForUpdate("OnUpdateFyrMMMapGroupPins")
- -- EVENT_MANAGER:UnregisterForUpdate("OnUpdateFyrMMMapZone")
- EVENT_MANAGER:UnregisterForUpdate("OnUpdateFyrMMMapPosition")
- -- EVENT_MANAGER:UnregisterForUpdate("OnUpdateFyrMMMapKeepNetwork")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapMovingObjectivesUpdate")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapRWUpdate")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapRescale")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapWayshrineDistances")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapQuestGiverDistances")
- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapBorderPins")
- end
- function FyrMM.RegisterUpdates()
- if not FyrMM.Halted then
- return
- end
- FyrMM.UnregisterUpdates(true)
- CancelUpdates()
- FyrMM.Halted = false
- FyrMM.HaltTimeOffset = 0
- -- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMMapView", FyrMM.SV.ViewRefreshRate, FyrMM.UpdateMapTiles)
- -- d("register updates")
- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMMapPins", FyrMM.SV.PinRefreshRate, FyrMM.PinUpdate)
- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMMapGroupPins", FyrMM.SV.MapRefreshRate, FyrMM.RefreshGroup)
- -- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMMapZone", FyrMM.SV.ZoneRefreshRate, FyrMM.ZoneUpdate)
- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMMapPosition", FyrMM.SV.MapRefreshRate, FyrMM.PositionUpdate)
- -- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMMapKeepNetwork", FyrMM.SV.KeepNetworkRefreshRate, FyrMM.UpdateKeepNetwork)
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapMovingObjectivesUpdate", FyrMM.SV.MapRefreshRate,
- FyrMM.UpdateAVABGobjectives)
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapRWUpdate", 1001, UpdateWheelPins)
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapRescale", 60, RescalePinPositions)
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapWayshrineDistances", 5000, WayshrineDistances)
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapQuestGiverDistances", 2000, QuestGiverDistances)
- EVENT_MANAGER:RegisterForUpdate("FyrMiniMapBorderPins", 2000, FyrMM.PlaceBorderPins)
- end
- -------------------------------------------------------------
- -- On Initialized
- -------------------------------------------------------------
- function FyrMM.LoadScreen() -- Initialize Player group events
- if not FyrMM.SV.StartupInfo then
- d("|ceeeeeeMiniMap by Fyrakin continued by |c3CB371@Masteroshi430|r |ceeeeee v" .. FyrMM.Panel.version .. "|r")
- end
- FyrMM.SV.PanelVersion = FyrMM.Panel.version
- if FYRMM_ZOOM_INCREMENT_AMOUNT == nil then
- FYRMM_ZOOM_INCREMENT_AMOUNT = 1
- end
- EVENT_MANAGER:RegisterForEvent("MiniMapOnUnitCreated", EVENT_UNIT_CREATED, FyrMM.GroupEvent)
- EVENT_MANAGER:RegisterForEvent("MiniMapOnUnitDestroyed", EVENT_UNIT_DESTROYED, FyrMM.GroupEvent)
- EVENT_MANAGER:RegisterForEvent("MiniMapOnGroupDisbanded", EVENT_GROUP_DISBANDED, FyrMM.GroupEvent)
- EVENT_MANAGER:RegisterForEvent("MiniMapOnLeaderUpdated", EVENT_LEADER_UPDATE, FyrMM.GroupEvent)
- FyrMM.GroupEvent()
- FyrMM.UpdateQuestPins()
- FyrMM.getHouseStatus()
- local pinTooltipInfo = ZO_MapPin.TOOLTIP_CREATORS[MAP_PIN_TYPE_PLAYER]
- Fyr_MM_Player:SetHandler("OnMouseEnter", function(Fyr_MM_Player)
- FyrMM.SetTargetScale(Fyr_MM_Player, 1.3)
- if not FyrMM.SV.PinTooltips then
- return
- end
- InitializeTooltip(InformationTooltip, Fyr_MM, TOPLEFT, 0, 0)
- InformationTooltip:AppendUnitName("player")
- end)
- Fyr_MM_Player:SetHandler("OnMouseExit", function(Fyr_MM_Player)
- FyrMM.SetTargetScale(Fyr_MM_Player, 1)
- ClearTooltip(InformationTooltip)
- end)
- Fyr_MM_Player:SetMouseEnabled(true)
- EVENT_MANAGER:UnregisterForEvent("MiniMap", EVENT_PLAYER_ACTIVATED)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_PLAYER_ACTIVATED, FyrMM.getHouseStatus)
- end
- function FyrMM.InitialPreload(task)
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.InitialPreload Start:")
- end
- task = task or 0
- if task == 0 then
- -- d("go")
- FyrMM.InitialPreloadTimeStamp = GetFrameTimeMilliseconds()
- FyrMM.SV.DebugLog = nil
- if FyrMM.Reloading then
- return
- end
- end
- local time = task + 30
- if task == 0 then
- FyrMM.SetMapToPlayerLocation()
- CurrentMap.ZoneIndex = GetCurrentMapZoneIndex()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 1 then
- FyrMM.UpdateMapInfo()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 2 then
- FyrMM.UpdateMapTiles(true)
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 3 then
- FyrMM.Show()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 4 then
- FyrMM.MapHalfDiagonal()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 5 then
- FyrMM.PositionUpdate()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 6 then
- FyrMM.GroupEvent()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 7 then
- FyrMM.UpdateQuestPins()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 8 then
- CurrentMap.needRescale = true
- RescalePinPositions()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 9 then
- if FyrMM.SV.BorderPins then
- FyrMM.PlaceBorderPins()
- end
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 10 then
- if IsInAvAZone() then
- FyrMM.RequestKeepRefresh()
- end
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task == 11 then
- FyrMM.PinUpdate()
- FyrMM.UpdateAntiquityDigSites()
- zo_callLater(function()
- FyrMM.InitialPreload(task + 1)
- end, time)
- return
- elseif task >= 12 then
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.InitialPreload Done." ..
- tostring(GetGameTimeMilliseconds() - FyrMM.InitialPreloadTimeStamp))
- end
- FyrMM.RegisterUpdates()
- end
- -- d("preload time ="..GetFrameTimeMilliseconds()-FyrMM.InitialPreloadTimeStamp) -- 450/500ms is too much!
- end
- function FyrMM.CheckForNewCustomPins()
- if not IsTableEmpty(FyrMM.CustomPinCheckList) then
- for i, n in pairs(FyrMM.CustomPinCheckList) do
- for p, j in pairs(n) do
- if j.Id == 0 then
- if j.m_PinType ~= nil and j.normalizedX ~= nil and j.normalizedY ~= nil then
- local r = {
- m_PinType = i,
- m_PinTag = j.m_PinTag,
- normalizedX = j.normalizedX,
- normalizedY = j.normalizedY,
- radius = j.radius
- }
- table.insert(FyrMM.CustomPinList[i], r)
- FyrMM.CustomPinCheckList[i][p].Id = #FyrMM.CustomPinList[i]
- end
- end
- end
- end
- end
- detectedNewCustomPin = false
- end
- function FyrMM.FastTravelInteraction(Interacting, Index, EventCode)
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "FyrMM.FastTravelInteraction (" .. tostring(Interacting) .. ") " ..
- tostring(Index))
- end
- if Interacting then
- FyrMM.FastTravelOpen = true
- FyrMM.UnregisterUpdates()
- CancelUpdates()
- FyrMM.Reloading = true
- else
- -- CurrentTasks = {}
- FyrMM.Reloading = false
- FyrMM.FastTravelOpen = false
- -- CurrentMap.filename = "reset" -- test 15/11/2022
- -- if FyrMM.CheckingZone == false then FyrMM.ZoneCheck() end -- test 15/11/2022
- end
- end
- function FyrMM.LoadCustomPinList()
- if Fyr_MM:IsHidden() then
- return
- end
- -- d("Load custom pins")
- if PRCustomPins then
- if not IsTableEmpty(PRCustomPins) then
- FyrMM.CustomPinList = {}
- FyrMM.CustomPinCheckList = {}
- local t = 0
- for i, n in pairs(PRCustomPins) do
- t = t + 1
- zo_callLater(function()
- FyrMM.LoadCustomPinGroup(i)
- end, t)
- end
- end
- end
- end
- function FyrMM.ResetCustomPinList()
- if Fyr_MM:IsHidden() then
- return
- end
- if PRCustomPins and not IsTableEmpty(PRCustomPins) then
- FyrMM.CustomPinList = {}
- FyrMM.CustomPinCheckList = {}
- for i, n in pairs(PRCustomPins) do
- zo_callLater(function()
- FyrMM.UpdateCustomPinGroup(i)
- end, i)
- end
- end
- end
- local _FindPin = _G["ZO_WorldMapPins"].FindPin
- local function FindPin(obj, pinTypeString, pinType, pinIndex)
- if FyrMM.LoadingCustomPins then
- if FyrMM.LoadingCustomPins[pinType] then
- return nil
- end
- end
- return _FindPin(obj, pinTypeString, pinType, pinIndex)
- end
- _G["ZO_WorldMapPins"].FindPin = FindPin
- local _CreatePin = _G["ZO_WorldMapPins"].CreatePin
- local function CreatePin(obj, pinType, pinTag, x, y, radius, borderInformation)
- if not obj or not pinType then
- return
- end
- if not PinRef then
- PinRef = obj
- FyrMM.PinRef = obj
- PRCustomPins = obj.customPins
- if PinRef and PinRef.playerPin and PinRef.playerPin.PIN_DATA then
- ZOpinData = PinRef.playerPin.PIN_DATA
- FyrMM.ZOpinData = ZOpinData
- end
- end
- local mapId = FyrMM.GetMapId()
- if CurrentMap.MapId ~= mapId and not Fyr_MM:IsHidden() and FyrMM.CheckingZone == false then
- FyrMM.ZoneCheck()
- -- if MapId ~= "unknown" then
- -- CurrentMap.MapId = mapId
- -- end
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "CreatePin detected New Map ID:" .. tostring(mapId))
- end
- end
- CustomPinMapId = CurrentMap.MapId
- if not FyrMM.FastTravelOpen and x ~= nil and y ~= nil and CustomWaypoints[pinType] and CustomPinMapId ~= 0 then -- "unknown"
- if pinType == MAP_PIN_TYPE_PING and FyrMM.Ping ~= nil then
- FyrMM.Ping.nX = x
- FyrMM.Ping.nY = y
- FyrMM.Ping:RefreshAnchor()
- end
- if pinType == MAP_PIN_TYPE_RALLY_POINT and FyrMM.Rally ~= nil then
- FyrMM.Rally.nX = x
- FyrMM.Rally.nY = y
- FyrMM.Rally:RefreshAnchor()
- end
- if pinType == MAP_PIN_TYPE_PLAYER_WAYPOINT and FyrMM.Waypoint ~= nil then
- FyrMM.Waypoint.nX = x
- FyrMM.Waypoint.nY = y
- FyrMM.Waypoint:RefreshAnchor()
- end
- end
- local newPin = false
- local key = ""
- local r = {}
- if PRCustomPins[pinType] or ZONE_EXPLORATION_PIN_TYPES[pinType] then
- key = tostring(x) .. ":" .. tostring(y) .. ":" .. tostring(radius)
- r = {
- m_PinType = pinType,
- m_PinTag = pinTag,
- normalizedX = x,
- normalizedY = y,
- radius = radius
- }
- if FyrMM.CustomPinCheckList[pinType] == nil then
- FyrMM.CustomPinCheckList[pinType] = {}
- end
- if CurrentMap.MapId == mapId and not FyrMM.FastTravelOpen then
- if not FyrMM.LoadingCustomPins[pinType] then
- if FyrMM.CustomPinCheckList[pinType][key] == nil then
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "Detected new Pin:" .. tostring(pinTag) .. " " ..
- tostring(pinType))
- end
- if pinType ~= nil then
- if FyrMM.CustomPinList[pinType] == nil then
- FyrMM.CustomPinList[pinType] = {}
- end
- table.insert(FyrMM.CustomPinList[pinType], r)
- FyrMM.CustomPinCheckList[pinType][key] = r
- FyrMM.CustomPinCheckList[pinType][key].Id = #FyrMM.CustomPinList[pinType]
- detectedNewCustomPin = true
- end
- end
- end
- end
- end
- if FyrMM.LoadingCustomPins[pinType] then
- key = tostring(x) .. ":" .. tostring(y) .. ":" .. tostring(radius) -- added to test
- r = {
- m_PinType = pinType,
- m_PinTag = pinTag,
- normalizedX = x,
- normalizedY = y,
- radius = radius
- } -- added to test
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug", "Create Pin:" .. tostring(pinTag) .. " " .. tostring(pinType))
- end
- if pinType then
- if FyrMM.CustomPinList[pinType] == nil then
- FyrMM.CustomPinList[pinType] = {}
- end
- table.insert(FyrMM.CustomPinList[pinType], r)
- FyrMM.CustomPinCheckList[pinType][key] = r
- FyrMM.CustomPinCheckList[pinType][key].Id = #FyrMM.CustomPinList[pinType]
- end
- local timeout = 100
- if string.sub(PRCustomPins[pinType].pinTypeString, 1, 4) == "DEST" then -- destinations addon pintypes
- timeout = 200
- end
- zo_callLater(function()
- FyrMM.LoadingCustomPins[pinType] = false
- end, timeout) -- was 100
- -- Compatibility with WaypointIt code:
- if WaypointIt then
- local func = function()
- return false
- end
- r.IsGroup = func
- r.IsPOI = func
- r.IsLocation = func
- r.IsQuest = func
- r.IsAvAObjective = func
- r.IsKeep = func
- r.IsMapPing = func
- r.IsKillLocation = func
- r.IsFastTravelKeep = func
- r.IsFastTravelWayShrine = func
- r.IsForwardCamp = func
- r.IsAvARespawn = func
- r.UpdateLocation = function()
- end
- r.GetNormalizedPosition = function(self)
- return self.normalizedX, self.normalizedY
- end
- r.GetPinTypeAndTag = function(self)
- return self.m_PinType, self.m_PinTag
- end
- r.PIN_DATA = ZOpinData
- end
- --
- return r
- else
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "Passed Create Pin:" .. tostring(pinTag) .. " " .. tostring(pinType))
- end
- local pin = _CreatePin(obj, pinType, pinTag, x, y, radius, borderInformation)
- return pin
- end
- end
- _G["ZO_WorldMapPins"].CreatePin = CreatePin
- function FyrMM.LoadCustomPinGroup(Type)
- if Fyr_MM:IsHidden() then
- return
- end
- if PRCustomPins and PRCustomPins[Type] and PRCustomPins[Type].enabled and PRCustomPins[Type].layoutCallback and type(PRCustomPins[Type].layoutCallback) == "function" then
- local gameTime = GetGameTimeMilliseconds()
- if FyrMM.LoadingCustomPins[Type] then
- zo_callLater(function()
- FyrMM.LoadCustomPinGroup(Type)
- end, 100)
- return
- end
- if FyrMM.UpdatingCustomPins[Type] or Fyr_MM:IsHidden() then
- return
- end
- if FyrMM.CustomPinList == nil then
- FyrMM.CustomPinList = {}
- end
- FyrMM.CustomPinList[Type] = {}
- FyrMM.LoadingCustomPins[Type] = true
- PRCustomPins[Type].layoutCallback(PinRef)
- zo_callLater(function()
- FyrMM.LoadingCustomPins[Type] = false
- end, 100) -- 500
- if FyrMM.DebugMode then
- CALLBACK_MANAGER:FireCallbacks("FyrMMDebug",
- "FyrMM.LoadCustomPinGroup " .. tostring(Type) .. " Done. " ..
- tostring(GetGameTimeMilliseconds() - gameTime))
- end
- end
- end
- local function InitFinish()
- FyrMM.Initialized = true
- if FyrMM.SV.MenuAutoHide then
- zo_callLater(FyrMM.MenuFadeOut, 3000)
- end
- end
- function FyrMM.UpdateCustomPinGroup(pinType)
- --[[ d("UpdateCustomPinGroup triggered for "..pinType) --]]
- if pinType >= MAP_PIN_TYPE_INVALID then
- -- d("UpdateCustomPinGroup "..pinType)
- if FyrMM.UpdatingCustomPins[pinType] then --[[ d("UpdateCustomPinGroup "..pinType.." not done because FyrMM.UpdatingCustomPins[pinType]") --]]
- return
- end
- if Fyr_MM:IsHidden() then --[[ d("UpdateCustomPinGroup "..pinType.." not done because Fyr_MM:IsHidden()") --]]
- return
- end
- if FyrMM.CustomPinList[pinType] then
- if #FyrMM.CustomPinList[pinType] == 0 then --[[ d("UpdateCustomPinGroup "..pinType.." FyrMM.CustomPinList[pinType] is empty")--]]
- return
- end
- FyrMM.UpdatingCustomPins[pinType] = true
- for i, n in pairs(FyrMM.CustomPinList[pinType]) do
- if n.pin then
- local pin = GetControl(n.pin:GetName())
- -- d("method 1: removing pin "..n.pin:GetName())
- RemoveCustomPin(pin)
- else
- local Index = n.Index or i
- if CustomPinKeyIndex[pinType] then
- local pin = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" ..
- tostring(CustomPinKeyIndex[pinType][Index]))
- -- d("method 2: removing pin Fyr_MM_Scroll_Map_Pins_Pin"..tostring(CustomPinKeyIndex[pinType][Index]))
- RemoveCustomPin(pin)
- end
- end
- end
- zo_callLater(function()
- FyrMM.CustomPinList[pinType] = {}
- FyrMM.UpdatingCustomPins[pinType] = false
- FyrMM.LoadCustomPinGroup(pinType)
- CheckCustomPinConsistence(pinType)
- FyrMM.customPinsUpdateCount = nil
- end, 30)
- else
- --[[ d("UpdateCustomPinGroup FyrMM.CustomPinList[pinType] is nil") --]]
- return
- end
- end
- end
- local function SetPinLocation(pin, nX, nY, radius)
- pin.nX = nX
- pin.nY = nY
- pin.radius = radius
- if CustomPinCrossReference[pin] then
- CustomPinCrossReference[pin].nX = nX
- CustomPinCrossReference[pin].nY = nY
- CustomPinCrossReference[pin].radius = radius
- FyrMM.SetPinAnchor(CustomPinCrossReference[pin], nX, nY, Fyr_MM_Scroll_Map_Pins)
- end
- end
- function FyrMM.getHouseStatus() -- we check if we are in a house
- if GetCurrentZoneHouseId() > 0 then
- FyrMM.isInHouse = true
- else
- FyrMM.isInHouse = false
- end
- end
- local function OnInit() -- Initialize Map and Update events after add-on load
- Fyr_MM_Frame_Control:SetAnchor(CENTER, Fyr_MM, CENTER, 0, 0)
- Fyr_MM_Wheel_Background:SetAnchor(CENTER, Fyr_MM, CENTER, 0, 0)
- Fyr_MM_Wheel_Background:SetTexture("MiniMap/Textures/wheelbackground.dds")
- Fyr_MM_Scroll_WheelNS:SetAnchor(CENTER, Fyr_MM_Scroll, CENTER, 0, 0)
- Fyr_MM_Scroll_WheelWE:SetAnchor(CENTER, Fyr_MM_Scroll, CENTER, 0, 0)
- Fyr_MM_Scroll_WheelCenter:SetAnchor(CENTER, Fyr_MM_Scroll, CENTER, 0, 0)
- MenuAnimation = ZO_AlphaAnimation:New(Fyr_MM_Menu)
- FyrMM.LAM = LibAddonMenu2
- FyrMM.CPL = FyrMM.LAM:RegisterAddonPanel("FyrMiniMap", FyrMM.Panel)
- FyrMM.SettingsPanel = FyrMM.LAM:RegisterOptionControls("FyrMiniMap", FyrMM.Options)
- Fyr_MM:SetHandler("OnMouseWheel", function(self, delta, ctrl, alt, shift)
- if not FyrMM.SV.MouseWheel then
- return
- end
- if delta < 0 then
- FyrMM.ZoomOut()
- elseif delta > 0 then
- FyrMM.ZoomIn()
- end
- end)
- Fyr_MM_Time:SetHandler("OnMouseUp", function(self, button, upInside, ctrl, alt, shift, command) -- not working
- if upInside then
- FyrMM.TimeFormat = FyrMM.TimeFormat + 1
- if FyrMM.TimeFormat > 2 then
- FyrMM.TimeFormat = 0
- end
- FyrMM.SV.TimeFormat = FyrMM.TimeFormat
- end
- end)
- if not FyrMM.SV.HideZoneLabel then
- FyrMM.UpdateLabels()
- end
- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMHideCheck", 100, FyrMM.HideCheck)
- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMLogPosition", 30, LogPosition)
- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMSpeedMeasure", 301, SpeedMeasure)
- EVENT_MANAGER:RegisterForUpdate("OnUpdateFyrMMRefreshEventUnits", 100, FyrMM.RefreshEventUnits)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_ADDED, function(_, questIndex)
- if IsJournalQuestIndexInTrackedZoneStory(questIndex) then
- RemoveCustomPin(FyrMM.ZoneStoryPin)
- FyrMM.ZoneStoryPin = nil
- end
- FyrMM.RequestQuestPinUpdate()
- end) -- testing 27/11/2022
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_ADVANCED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_COMPLETE_DIALOG, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_COMPLETE, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_CONDITION_COUNTER_CHANGED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_LIST_UPDATED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_OFFERED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_OPTIONAL_STEP_ADVANCED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_MOUSE_REQUEST_ABANDON_QUEST, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_REMOVED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_TOOL_UPDATED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_ACTIVE_QUEST_TOOL_CLEARED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_ACTIVE_QUEST_TOOL_CHANGED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_OBJECTIVES_UPDATED, FyrMM.RequestQuestPinUpdate)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_POI_UPDATED, DelayedPOIPins)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_DISCOVERY_EXPERIENCE, function()
- FyrMM.Wayshrines()
- end)
- -- ava
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEPS_INITIALIZED, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_ALLIANCE_OWNER_CHANGED, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_END_INTERACTION, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_GATE_STATE_CHANGED, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_GUILD_CLAIM_UPDATE, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_INITIALIZED, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_OWNERSHIP_CHANGED_NOTIFICATION, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_RESOURCE_UPDATE, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_START_INTERACTION, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KEEP_UNDER_ATTACK_CHANGED, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_KILL_LOCATIONS_UPDATED, FyrMM.RequestKeepRefresh)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_FORWARD_CAMPS_UPDATED, FyrMM.RequestKeepRefresh)
- FOCUSED_QUEST_TRACKER:RegisterCallback("QuestTrackerAssistStateChanged", function()
- FyrMM.UpdateQuestPinPositions()
- end)
- FOCUSED_QUEST_TRACKER:RegisterCallback("QuestTrackerRefreshedMapPins", function()
- FyrMM.RequestQuestPinUpdate()
- end)
- CALLBACK_MANAGER:RegisterCallback("OnFyrMiniNewMapEntered", DelayedReload)
- CALLBACK_MANAGER:RegisterCallback("OnFyrMiniMapChanged", FyrMM.UpdateLabels)
- CALLBACK_MANAGER:RegisterCallback("FyrMMDebug", function(value)
- if FyrMM.DebugMode then
- FyrMM.Debug_d(value)
- end
- end)
- CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", function(manual)
- local filename, _, _ = GetCurrentMapTextureFileInfo()
- if manual == nil and string.lower(CurrentMap.filename) ~= string.lower(filename) and not FyrMM.FastTravelOpen then
- FyrMM.Refresh = true
- FyrMM.UpdateLabels()
- FyrMM.ZoneCheck()
- return false
- elseif manual == nil and FyrMM.SV.ZoneNameContents ~= "Classic (Map only)" and not FyrMM.FastTravelOpen then -- update zone name for Map & Area and Area only option
- if not FyrMM.SV.HideZoneLabel then
- FyrMM.UpdateLabels()
- end
- return false
- else -- change is manual
- FyrMM.Refresh = false
- end
- end)
- CALLBACK_MANAGER:RegisterCallback("OnWorldMapModeChanged", function(mode)
- zo_callLater(function()
- if ZO_WorldMap:IsHidden() then
- if SetMapToPlayerLocation() ~= SET_MAP_RESULT_CURRENT_MAP_UNCHANGED then
- CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged")
- end
- FyrMM.ZoneCheck()
- else
- FyrMM.UnregisterUpdates()
- CancelUpdates()
- end
- -- EVENT_MANAGER:UnregisterForUpdate("FyrMiniMapOnWorldMapModeChanged")
- end, 20)
- end)
- function ZO_WorldMapPins_Manager:RefreshCustomPins(optionalPinType)
- for pinTypeId, pinData in pairs(self.customPins) do
- if optionalPinType == nil or optionalPinType == pinTypeId then
- self:RemovePins(pinData.pinTypeString)
- if optionalPinType == pinTypeId and not Fyr_MM:IsHidden() then
- FyrMM.UpdateCustomPinGroup(optionalPinType)
- end -- and not Fyr_MM:IsHidden() is aworkaround for destinations addon's pins disapearing when opening world map 21/12/2022
- if pinData.enabled then
- pinData.layoutCallback(self)
- end
- elseif optionalPinType == pinData.pinTypeString and not Fyr_MM:IsHidden() then
- FyrMM.UpdateCustomPinGroup(pinTypeId) -- compatibility with map pins addon and other addons using pinTypeString to remove pins
- end
- end
- end
- ZO_PreHook(ZO_MapPin, "SetLocation", function(ref, xLoc, yLoc, radius)
- SetPinLocation(ref, xLoc, yLoc, radius)
- end)
- -- ZO_PreHook(ZO_WorldMapPins, "RemovePins", function(ref, PinTypeStr, majorIndex, keyIndex) if PinTypeStr ~= nil and majorIndex ~= nil and keyIndex ~= nil then RemoveCustomPins(PinTypeStr, majorIndex, keyIndex) end end) -- totally unnecessary
- -- SecurePostHook(ZO_WorldMapPins, "RefreshCustomPins", function(ref, pinType) if pinType then FyrMM.UpdateCustomPinGroup(pinType) end end) -- FyrMM.DelayedResetCustomPinGroup(pinType)
- -- this was causing huge lags 03/05/2023
- -- ZO_PreHook(FISHING_MANAGER or INTERACTIVE_WHEEL_MANAGER, "StopInteraction", function() zo_callLater(FyrMM.RequestQuestPinUpdate,1000) return false end)
- ZO_PreHook(COMPASS, "PerformFullAreaQuestUpdate", FyrMM.RequestQuestPinUpdate)
- ZO_PreHook(ZO_WorldMap, "SetHidden", FyrMM.WorldMapShowHide)
- -- ZO_PreHookHandler(ZO_GameMenu_InGame, "OnShow", function() zo_callLater(FyrMM.HideCheck,10) end)
- -- ZO_PreHookHandler(ZO_GameMenu_InGame, "OnHide", function() zo_callLater(FyrMM.HideCheck,10) end)
- -- ZO_PreHookHandler(ZO_InteractWindow, "OnShow", function() zo_callLater(FyrMM.HideCheck,10) end)
- -- ZO_PreHookHandler(ZO_InteractWindow, "OnHide", function() zo_callLater(FyrMM.HideCheck,10) end)
- -- ZO_PreHookHandler(ZO_KeybindStripControl, "OnShow", function() zo_callLater(FyrMM.HideCheck,10) end)
- -- ZO_PreHookHandler(ZO_KeybindStripControl, "OnHide", function() zo_callLater(FyrMM.HideCheck,10) end)
- -- ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnShow", function() zo_callLater(FyrMM.HideCheck,10) end)
- -- ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnHide", function() zo_callLater(FyrMM.HideCheck,10) end)
- if FyrMM.CustomPinsEnabled then
- for i = 1, 1200 do -- 1200
- local pin = GetControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(i))
- if pin == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_Pins_Pin" .. tostring(i), Fyr_MM_Scroll_Map_Pins,
- CT_TEXTURE)
- pin:SetDrawLayer(1)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- SetPinFunctions(pin)
- end
- end
- end
- for i = 1, 50 do -- 50
- local pin = GetControl("Fyr_MM_Scroll_Map_WayshrinePins_Pin" .. tostring(i))
- if pin == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_WayshrinePins_Pin" .. tostring(i),
- Fyr_MM_Scroll_Map_WayshrinePins, CT_TEXTURE)
- pin.nDistance = function(self)
- if self.nX == nil then
- return 1
- end
- return math.sqrt((zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nX * 10000)) +
- (zo_round(CurrentMap.PlayerNY * 10000) - zo_round(self.nY * 10000)) *
- (zo_round(CurrentMap.PlayerNX * 10000) - zo_round(self.nY * 10000))) / 10000
- end
- pin:SetDrawLayer(1)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- pin:SetHandler("OnMouseUp", PinOnMouseUp)
- SetPinFunctions(pin)
- end
- end
- for i = 1, 50 do -- 50
- local pin = GetControl("Fyr_MM_Scroll_Map_LocationPins_Pin" .. tostring(i))
- if pin == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_LocationPins_Pin" .. tostring(i),
- Fyr_MM_Scroll_Map_LocationPins, CT_TEXTURE)
- pin:SetDrawLayer(1)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- SetPinFunctions(pin)
- end
- end
- for i = 1, 100 do -- 100
- local pin = GetControl("Fyr_MM_Scroll_Map_POIPins_Pin" .. tostring(i))
- if pin == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Scroll_Map_POIPins_Pin" .. tostring(i),
- Fyr_MM_Scroll_Map_POIPins, CT_TEXTURE)
- pin:SetDrawLayer(1)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- SetPinFunctions(pin)
- end
- end
- for i = 1, 100 do -- 100
- local pin = GetControl("Fyr_MM_Axis_Border_Pin" .. tostring(i))
- if pin == nil then
- pin = WINDOW_MANAGER:CreateControl("Fyr_MM_Axis_Border_Pin" .. tostring(i), Fyr_MM_Axis_Border_Pins,
- CT_TEXTURE)
- pin:SetDrawLayer(1)
- SetBorderPinHandlers(pin)
- end
- end
- for i = 1, 24 do -- 24
- local pin = GetControl("Fyr_MM_Scroll_Map_GroupPins_group" .. tostring(i))
- if pin then
- pin:SetDrawLayer(1)
- pin:SetHandler("OnMouseEnter", PinOnMouseEnter)
- pin:SetHandler("OnMouseExit", PinOnMouseExit)
- SetPinFunctions(pin)
- end
- end
- zo_callLater(InitFinish, 100)
- end
- function FyrMM.MenuFadeIn()
- if Fyr_MM_Menu:GetAlpha() > 0 or FyrMM.SV.MenuDisabled or FyrMM.MenuFadingIn or Fyr_MM:IsHidden() then
- return
- end
- FyrMM.MenuFadingIn = true
- if FyrMM.SV.ZoneFrameLocationOption == "Default" then
- Fyr_MM_ZoneFrame:ClearAnchors()
- if FyrMM.SV.WheelMap then
- Fyr_MM_ZoneFrame:SetAnchor(TOP, Fyr_MM_Menu, BOTTOM, 0, -Fyr_MM_Menu:GetHeight() / 5)
- else
- Fyr_MM_ZoneFrame:SetAnchor(TOP, Fyr_MM_Menu, BOTTOM, 0, -Fyr_MM_Menu:GetHeight() / 2.5)
- end
- Fyr_MM_ZoneFrame:SetMovable(false)
- end
- if FyrMM.OverMiniMap or FyrMM.OverMenu then
- MenuAnimation:FadeIn(0, 1000, ZO_ALPHA_ANIMATION_OPTION_FORCE_ALPHA, function()
- FyrMM.MenuFadingIn = false
- end)
- end
- end
- function FyrMM.MenuFadeOut()
- if not FyrMM.SV.MenuAutoHide or FyrMM.OverMiniMap or FyrMM.OverMenu or Fyr_MM_Menu:GetAlpha() == 0 or
- FyrMM.SV.MenuDisabled or FyrMM.MenuFadingOut then
- return
- end
- FyrMM.MenuFadingOut = true
- MenuAnimation:FadeOut(0, 1000, ZO_ALPHA_ANIMATION_OPTION_FORCE_ALPHA, function()
- FyrMM.MenuFadingOut = false
- if FyrMM.SV.ZoneFrameLocationOption == "Default" then
- Fyr_MM_ZoneFrame:ClearAnchors()
- Fyr_MM_ZoneFrame:SetAnchor(TOP, Fyr_MM_Border, BOTTOM)
- Fyr_MM_ZoneFrame:SetMovable(false)
- end
- end)
- end
- local function UpdateZoomTable()
- if FyrMM.SV.ZoomTable then
- local t = {}
- for i, n in pairs(FyrMM.SV.ZoomTable) do
- t[i] = n
- end
- FyrMM.SV.ZoomTable = t
- FyrMM.SV.MapTable = nil
- end
- if FyrMM.SV.MapTable then
- FyrMM.SV.ZoomTable = {}
- for i, n in pairs(FyrMM.SV.MapTable) do
- FyrMM.SV.ZoomTable[i] = n.ZoomLevel
- end
- FyrMM.SV.MapTable = nil
- end
- end
- local function OnLoaded(eventCode, addOnName)
- if addOnName ~= "MiniMap" then
- return
- end
- FyrMM.Initialized = false
- MM_CreateDataTables()
- FyrMM.SV = ZO_SavedVars:NewAccountWide("FyrMMSV", 5, nil, FyrMM.Defaults, nil)
- if FyrMM.SV then
- UpdateZoomTable()
- MM_LoadSavedVars()
- end
- FyrMM.API_Check()
- Fyr_MM:SetResizeHandleSize(MOUSE_CURSOR_RESIZE_NS)
- Fyr_MM:SetHandler("OnMouseEnter", function()
- FyrMM.OverMiniMap = true
- FyrMM.MenuFadeIn()
- Fyr_MM_Close:SetAlpha(1)
- end)
- Fyr_MM:SetHandler("OnMouseExit", function()
- FyrMM.OverMiniMap = false
- zo_callLater(FyrMM.MenuFadeOut, 3000)
- Fyr_MM_Close:SetAlpha(0)
- end)
- Fyr_MM_Menu:SetHandler("OnMouseEnter", function()
- FyrMM.OverMenu = true
- FyrMM.MenuFadeIn()
- Fyr_MM_Close:SetAlpha(1)
- end)
- Fyr_MM_Menu:SetHandler("OnMouseExit", function()
- FyrMM.OverMenu = false
- zo_callLater(FyrMM.MenuFadeOut, 3000)
- Fyr_MM_Close:SetAlpha(0)
- end)
- Fyr_MM:SetHandler("OnMouseUp", function(self)
- if not FyrMM.SV.LockPosition then
- local width = Fyr_MM:GetWidth()
- local height = Fyr_MM:GetHeight()
- MM_SetMapWidth(width)
- MM_SetMapHeight(height)
- FyrMM.SV.position.offsetX = Fyr_MM:GetLeft()
- FyrMM.SV.position.offsetY = Fyr_MM:GetTop()
- FyrMM.MapHalfDiagonal()
- MM_RefreshPanel()
- else
- local pos = {}
- pos.anchorTo = GetControl(pos.anchorTo)
- Fyr_MM:SetAnchor(FyrMM.SV.position.point, pos.anchorTo, FyrMM.SV.position.relativePoint,
- FyrMM.SV.position.offsetX, FyrMM.SV.position.offsetY)
- Fyr_MM:SetDimensions(FyrMM.SV.MapWidth, FyrMM.SV.MapHeight)
- end
- end)
- Fyr_MM_Coordinates:SetHandler("OnMouseUp", function(self)
- local pos = {}
- _, pos[1], pos[2], pos[3], pos[4], pos[5] = Fyr_MM_Coordinates:GetAnchor()
- if pos[2] then
- pos[2] = pos[2]:GetName()
- end
- FyrMM.SV.CoordinatesAnchor = pos
- end)
- Fyr_MM_ZoneFrame:SetHandler("OnMouseUp", function(self)
- local pos = {}
- _, pos[1], pos[2], pos[3], pos[4], pos[5] = Fyr_MM_ZoneFrame:GetAnchor()
- if pos[1] == nil then
- return
- end
- if pos[2] then
- pos[2] = pos[2]:GetName()
- end
- pos[1] = 1
- local zoneFrameX, _ = Fyr_MM_ZoneFrame:GetCenter()
- pos[4] = zoneFrameX
- FyrMM.SV.ZoneFrameAnchor = pos
- d("Zone frame anchor set to: " .. pos[1] .. " " .. pos[2] .. " " .. pos[3] .. " " .. pos[4] .. " " .. pos[5])
- end)
- Fyr_MM_Scroll:SetScrollBounding(0)
- Fyr_MM_Player_incombat:SetTexture("esoui/art/mappins/ava_attackburst_32.dds")
- Fyr_MM_Player_incombat:SetAlpha(0.50)
- AxisSwitch()
- zo_callLater(OnInit, 1000)
- end
- -----------------------------------------
- -- Key bind functions
- -----------------------------------------
- function FyrMM.ZoomOut()
- if not FyrMM.Visible or Fyr_MM:IsHidden() or ZoomAnimating then
- return
- end
- local zoomLevel = CurrentMap.ZoomLevel
- zoomLevel = zoomLevel - FYRMM_ZOOM_INCREMENT_AMOUNT
- if zoomLevel < FYRMM_ZOOM_MIN then
- zoomLevel = FYRMM_ZOOM_MIN
- end
- PlaySound(SOUNDS.MAP_ZOOM_OUT)
- if FyrMM.SV.RotateMap then
- Fyr_MM_Scroll:SetHorizontalScroll(0)
- Fyr_MM_Scroll:SetVerticalScroll(0)
- FyrMM.WheelScroll(0, 0)
- end
- if not ZoomAnimating and zoomLevel ~= CurrentMap.ZoomLevel then
- AnimateZoom(zoomLevel)
- end
- end
- function FyrMM.ZoomIn()
- if not FyrMM.Visible or Fyr_MM:IsHidden() or ZoomAnimating then
- return
- end
- local zoomLevel = CurrentMap.ZoomLevel
- zoomLevel = zoomLevel + FYRMM_ZOOM_INCREMENT_AMOUNT
- if zoomLevel > FYRMM_ZOOM_MAX then
- zoomLevel = FYRMM_ZOOM_MAX
- end
- PlaySound(SOUNDS.MAP_ZOOM_IN)
- if FyrMM.SV.RotateMap then
- Fyr_MM_Scroll:SetHorizontalScroll(0)
- Fyr_MM_Scroll:SetVerticalScroll(0)
- FyrMM.WheelScroll(0, 0)
- end
- if not ZoomAnimating and zoomLevel ~= CurrentMap.ZoomLevel then
- AnimateZoom(zoomLevel)
- end
- end
- function FyrMM.ToggleVisible()
- if not FyrMM.worldMapShowing and ZO_InteractWindow:IsHidden() and ZO_KeybindStripControl:IsHidden() then
- if FyrMM.Visible then
- PlaySound(SOUNDS.MAP_WINDOW_CLOSE)
- FyrMM.manuallyHidden = true
- else
- PlaySound(SOUNDS.MAP_WINDOW_OPEN)
- FyrMM.manuallyHidden = false
- end
- FyrMM.Visible = not FyrMM.Visible
- end
- end
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_QUEST_POSITION_REQUEST_COMPLETE, OnQuestPositionRequestComplete)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_ADD_ON_LOADED, OnLoaded)
- -- EVENT_MANAGER:RegisterForEvent( "MiniMap", EVENT_ZONE_CHANGED, FyrMM.UpdateLabels)
- -- EVENT_MANAGER:RegisterForEvent( "MiniMap", EVENT_ZONE_UPDATE, function (eventCode, unitTag, newZoneName) d(eventCode) d(unitTag) d(newZoneName) end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_PLAYER_ACTIVATED, FyrMM.LoadScreen)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_START_FAST_TRAVEL_INTERACTION, function(eventCode, index)
- FyrMM.FastTravelInteraction(true, index, eventCode)
- end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_END_FAST_TRAVEL_INTERACTION, function(eventCode)
- FyrMM.FastTravelInteraction(false, nil, eventCode)
- end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_START_FAST_TRAVEL_KEEP_INTERACTION, function(eventCode, index)
- FyrMM.FastTravelInteraction(true, index, eventCode)
- end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_END_FAST_TRAVEL_KEEP_INTERACTION, function(eventCode)
- FyrMM.FastTravelInteraction(false, nil, eventCode)
- end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_MOUNTED_STATE_CHANGED, function(eventCode, mounted)
- CurrentMap.PlayerMounted = mounted
- end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_PLAYER_NOT_SWIMMING, function(eventCode)
- CurrentMap.PlayerSwimming = false
- end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_PLAYER_SWIMMING, function(eventCode)
- CurrentMap.PlayerSwimming = true
- end)
- EVENT_MANAGER:RegisterForEvent("MiniMap", EVENT_ANTIQUITY_DIG_SITES_UPDATED, function(eventCode, antiquityId)
- FyrMM.UpdateAntiquityDigSites()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement