Skip to content

Commit

Permalink
Added Emerald Dream map to the world map of dragonisles
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jan 30, 2024
1 parent 6eb8493 commit 289e0dd
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 2 deletions.
90 changes: 90 additions & 0 deletions WorldQuestTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,94 @@ function WorldQuestTracker.Debug (message, color)
end
end

WorldQuestTracker.ExtraMapTextures = {}

function WorldQuestTracker.UpdateExtraMapTextures()
local mapID = WorldQuestTracker.GetCurrentMapAreaID()
for texturePath, textureInfo in pairs (WorldQuestTracker.ExtraMapTextures) do
if (textureInfo.MapID == mapID) then
textureInfo.Pin:Show()
else
textureInfo.Pin:Hide()
end
end

--alternative way to deal with it:
--[=[
local map = WorldQuestTrackerDataProvider:GetMap()
for pin in map:EnumeratePinsByTemplate("WorldQuestTrackerWorldMapPinTemplate") do
if (pin.MapTextureInfo.MapID ~= WorldMapFrame.mapID) then
pin.Texture:Hide()
else
pin.Texture:Show()
end
end
--]=]
end

---@param mapID number the mapID to show the texture, if the map does not match, the texture won't be shown
---@param texturePath any
---@param x number the x position of the texture
---@param y number the y position of the texture
---@param width number
---@param height number
---@param onClickMapID number the mapID to switch when the texture is clicked
function WorldQuestTracker.AddExtraMapTexture(mapID, texturePath, x, y, width, height, onClickMapID)
local mapTextureInfo = WorldQuestTracker.ExtraMapTextures[texturePath]
if (not mapTextureInfo) then
width = width * 4
height = height * 4

local pin = WorldQuestTrackerDataProvider:GetMap():AcquirePin("WorldQuestTrackerExtraMapTextureTemplate", "questPin")
pin:SetPosition(x, y)
pin:SetSize(width, height)

local texture = pin:CreateTexture(nil, "overlay")
texture:SetTexture(texturePath)
texture:SetSize(width, height)
texture:SetPoint("topleft", pin, "topleft", 0, 0)
texture:SetAlpha(0.834)
pin.Child = texture

local textureHighlight = pin:CreateTexture(nil, "overlay")
textureHighlight:SetTexture(texturePath)
textureHighlight:SetSize(width, height)
textureHighlight:SetPoint("topleft", pin, "topleft", 0, 0)
textureHighlight:SetAlpha(0.15)
textureHighlight:SetVertexColor(1, 0.7, 0)
textureHighlight:SetBlendMode("ADD")
textureHighlight:Hide()

pin:SetScript("OnEnter", function()
textureHighlight:Show()
end)

pin:SetScript("OnLeave", function()
textureHighlight:Hide()
end)

pin:SetScript("OnMouseUp", function()
WorldMapFrame:SetMapID(onClickMapID)
WorldQuestTracker.UpdateZoneWidgets(true)
end)

mapTextureInfo = {
MapID = mapID,
Texture = texture,
Pin = pin
}

pin.MapTextureInfo = mapTextureInfo
WorldQuestTracker.ExtraMapTextures[texturePath] = mapTextureInfo

--debug
--print("WorldQuestTracker.AddExtraMapTexture", texturePath, x, y, width, height)
--print(texture, pin, mapTextureInfo)
--DetailsFramework:DebugVisibility(texture)
--DetailsFramework:DebugVisibility(pin)
end
end

function WorldQuestTracker:OnInit()
do
local languageCurrentVersion = 1
Expand Down Expand Up @@ -266,6 +354,8 @@ function WorldQuestTracker:OnInit()
end
end

WorldQuestTracker.UpdateExtraMapTextures()

local mapInfo = WorldQuestTracker.GetMapInfo()
local mapFileName = mapInfo and mapInfo.name

Expand Down
1 change: 1 addition & 0 deletions WorldQuestTrackerMixin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
<Frame name="WorldQuestTrackerPinTemplate" mixin="WorldQuestTrackerPinMixin" virtual="true"></Frame>
<Frame name="WorldQuestTrackerRarePinTemplate" mixin="WorldQuestTrackerPinMixin" virtual="true"></Frame>
<Frame name="WorldQuestTrackerWorldMapPinTemplate" mixin="WorldQuestTrackerPinMixin" virtual="true"></Frame>
<Frame name="WorldQuestTrackerExtraMapTextureTemplate" mixin="WorldQuestTrackerPinMixin" virtual="true"></Frame>
</Ui>
2 changes: 2 additions & 0 deletions WorldQuestTracker_Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ WorldQuestTracker.OnMapHasChanged = function(self)
C_Timer.After(0.5, check_for_quests_on_unknown_map)
end

WorldQuestTracker.UpdateExtraMapTextures()

--is the map a zone map with world quests?
if (WorldQuestTracker.MapData.WorldQuestZones [mapID]) then
--hide the toggle world quests button
Expand Down
5 changes: 3 additions & 2 deletions WorldQuestTracker_WorldMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1589,13 +1589,14 @@ local scheduledIconUpdate = function(questTable)

elseif (mapID == WorldQuestTracker.MapData.ZoneIDs.EMERALDDREAM) then
if (x and y) then --no zaralek mapID, but zaralek quests shown on worldmap
newX = 0.70 + x * 0.50
newY = 0.30 + y * 0.50
newX = 0.66 + x * 0.50
newY = 0.13 + y * 0.50
--button.blackGradient:Hide()
--button.flagText:Hide()
--self.bgFlag:Hide()
WorldQuestTracker.ClearZoneWidget(button)
button.circleBorder:Show()
WorldQuestTracker.AddExtraMapTexture(WorldQuestTracker.MapData.ZoneIDs.DRAGONISLES, [[Interface\AddOns\WorldQuestTracker\media\maps\emerald_dream]], 0.885, 0.38, 224, 224, mapID)
end
end

Expand Down
Binary file added media/maps/emerald_dream.tga
Binary file not shown.

0 comments on commit 289e0dd

Please sign in to comment.