Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - Returns the correct difficulty color compared to the player
- local GetQuestDifficultyColor = function(level, playerLevel)
- level = level - (playerLevel or K.Level)
- if (level > 4) then
- return "|CFFCC1A1A"
- elseif (level > 2) then
- return "|CFFFF8040"
- elseif (level >= -2) then
- return "|CFFE5B226"
- elseif (level >= -GetQuestGreenRange()) then
- return "|CFF59C959"
- else
- return "|CFF787878"
- end
- end
- local function AreaLabel_OnUpdate(self)
- self:ClearLabel(MAP_AREA_LABEL_TYPE.AREA_NAME)
- local map = self.dataProvider:GetMap()
- if (map:IsCanvasMouseFocus()) then
- local name, description
- local mapID = map:GetMapID()
- local normalizedCursorX, normalizedCursorY = map:GetNormalizedCursorPosition()
- local positionMapInfo = C_Map.GetMapInfoAtPosition(mapID, normalizedCursorX, normalizedCursorY)
- if (positionMapInfo and (positionMapInfo.mapID ~= mapID)) then
- name = positionMapInfo.name
- local playerMinLevel, playerMaxLevel, playerFaction
- if (K.WorldMapLevelZoneData[positionMapInfo.mapID]) then
- playerMinLevel = K.WorldMapLevelZoneData[positionMapInfo.mapID].min
- playerMaxLevel = K.WorldMapLevelZoneData[positionMapInfo.mapID].max
- playerFaction = K.WorldMapLevelZoneData[positionMapInfo.mapID].faction
- end
- if (playerFaction) then
- local englishFaction = UnitFactionGroup("player")
- if (playerFaction == "Alliance") then
- description = string.format(FACTION_CONTROLLED_TERRITORY, FACTION_ALLIANCE)
- elseif (playerFaction == "Horde") then
- description = string.format(FACTION_CONTROLLED_TERRITORY, FACTION_HORDE)
- end
- if (englishFaction == playerFaction) then
- description = "|CFF40D326" .. description.."|r" .. FONT_COLOR_CODE_CLOSE
- else
- description = "|CFFF52E24" .. description.."|r" .. FONT_COLOR_CODE_CLOSE
- end
- end
- if (name and playerMinLevel and playerMaxLevel and (playerMinLevel > 0) and (playerMaxLevel > 0)) then
- local playerLevel = K.Level
- local color
- if (playerLevel < playerMinLevel) then
- color = GetQuestDifficultyColor(playerMinLevel, playerLevel)
- elseif (playerLevel > playerMaxLevel) then
- -- subtract 2 from the maxLevel so zones entirely below the player's level won't be yellow
- color = GetQuestDifficultyColor(playerMaxLevel - 2, playerLevel)
- else
- color = "|CFFE5B226"
- end
- if (playerMinLevel ~= playerMaxLevel) then
- name = name..color.." ("..playerMinLevel.."-"..playerMaxLevel..")|r"..FONT_COLOR_CODE_CLOSE
- else
- name = name..color.." ("..playerMaxLevel..")|r"..FONT_COLOR_CODE_CLOSE
- end
- end
- else
- name = MapUtil.FindBestAreaNameAtMouse(mapID, normalizedCursorX, normalizedCursorY)
- end
- if name then
- self:SetLabel(MAP_AREA_LABEL_TYPE.AREA_NAME, name, description)
- end
- end
- self:EvaluateLabels()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement