Skip to content

Commit

Permalink
Added Special Assignment quests into the world map
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 30, 2024
1 parent 21a0c8a commit 40ec683
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ api.lua
media/options_visibility_context.afphoto~lock~
luac.out
*.afphoto~lock~
annotations.txt
1 change: 1 addition & 0 deletions WorldQuestTrackerMixin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
<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="WorldQuestTrackerPOIPinTemplate" mixin="WorldQuestTrackerPinMixin" virtual="true"></Frame>
<Frame name="WorldQuestTrackerExtraMapTextureTemplate" mixin="WorldQuestTrackerPinMixin" virtual="true"></Frame>
</Ui>
3 changes: 3 additions & 0 deletions WorldQuestTracker_Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ end
WorldQuestTracker.OnMapHasChanged = function(self)
WorldQuestTracker.AdjustThatThingInTheBottomLeftCorner()

WorldQuestTrackerDataProvider:GetMap():RemoveAllPinsByTemplate("WorldQuestTrackerPOIPinTemplate")
WorldQuestTracker.HideAllPOIPins()

local mapID = WorldMapFrame.mapID
WorldQuestTracker.InitializeWorldWidgets()

Expand Down
4 changes: 4 additions & 0 deletions WorldQuestTracker_Initialize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ do
quest_summary_minimized = false,
show_summary_minimize_button = true,

pins_discovered = {
["worldquest-Capstone-questmarker-epic-Locked"] = {},
},

zone_map_config = {
summary_show = true,
quest_summary_scale = 1.2,
Expand Down
70 changes: 62 additions & 8 deletions WorldQuestTracker_WorldMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1176,21 +1176,30 @@ function WorldQuestTracker.BuildMapChildrenTable(parentMap, t)
t = t or {}
local newChildren = {}
for mapID, mapTable in pairs(WorldQuestTracker.mapTables) do
if (mapTable.show_on_map [parentMap]) then
t [mapID] = true
newChildren [mapID] = true
if (mapTable.show_on_map[parentMap]) then
t[mapID] = true
newChildren[mapID] = true
end
end

if (next(newChildren)) then
for newMapChildren, _ in pairs(newChildren) do
for newMapChildren in pairs(newChildren) do
WorldQuestTracker.BuildMapChildrenTable(newMapChildren, t)
end
end

return t
end

WorldQuestTracker.POIPins = {}
--hide all poi pins
function WorldQuestTracker.HideAllPOIPins()
for i = 1, #WorldQuestTracker.POIPins do
WorldQuestTracker.POIPins[i]:Hide()
end
end

local worldQuestLockedIndex = 1
-- ~world -- ~update
function WorldQuestTracker.UpdateWorldQuestsOnWorldMap(noCache, showFade, isQuestFlaggedRecheck, forceCriteriaAnimation, questList)
if (UnitLevel("player") < 50) then --this has to be improved
Expand All @@ -1204,6 +1213,51 @@ function WorldQuestTracker.UpdateWorldQuestsOnWorldMap(noCache, showFade, isQues
return
end

WorldQuestTrackerDataProvider:GetMap():RemoveAllPinsByTemplate("WorldQuestTrackerPOIPinTemplate")

for poiId, poiInfo in pairs(WorldQuestTracker.db.profile.pins_discovered["worldquest-Capstone-questmarker-epic-Locked"]) do
---@cast poiInfo wqt_poidata

--double check if the quest is on the map
if (C_AreaPoiInfo.GetAreaPOIInfo(poiInfo.mapID, poiInfo.poiID)) then
local pin = WorldQuestTrackerDataProvider:GetMap():AcquirePin("WorldQuestTrackerPOIPinTemplate")

if (not pin.widget) then
local button = WorldQuestTracker.CreateZoneWidget(worldQuestLockedIndex, "WorldQuestTrackerLockedQuestButton", worldFramePOIs) --, "WorldQuestTrackerPOIPinTemplate"
button.IsWorldZoneQuestButton = true
button:SetPoint("center", pin, "center", 0, 0)
worldQuestLockedIndex = worldQuestLockedIndex + 1
pin.button = button
pin.widget = button
pin:SetSize(20, 20)

button:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
if (poiInfo.tooltipSetId) then
GameTooltip_AddWidgetSet(GameTooltip, poiInfo.tooltipSetId, 0)
end
GameTooltip:Show()
end)

button:SetScript("OnHide", function(self)
GameTooltip:Hide()
end)

button.UpdateTooltip = nil

WorldQuestTracker.POIPins[#WorldQuestTracker.POIPins+1] = button
end

WorldQuestTracker.ResetWorldQuestZoneButton(pin.button)
pin:SetPosition(poiInfo.worldX, poiInfo.worldY)
pin.button.Texture:SetMask("")
pin.button.Texture:SetAtlas("worldquest-Capstone-questmarker-epic-Locked")
pin.button.Texture:SetSize(32, 32)
pin.button.poiInfo = poiInfo
pin.button:Show()
end
end

WorldQuestTracker.RefreshStatusBarVisibility()

WorldQuestTracker.ClearZoneSummaryButtons()
Expand Down Expand Up @@ -1388,14 +1442,14 @@ function WorldQuestTracker.UpdateWorldQuestsOnWorldMap(noCache, showFade, isQues
end

--quantidade de quest para a faccao
configTable.factionFrame.amount = factionAmountForEachMap [mapId]
configTable.factionFrame.amount = factionAmountForEachMap[mapId]
end

--force retry in case the game just opened and the server might not has sent all quests
forceRetryForHub [WorldMapFrame.mapID] = forceRetryForHub [WorldMapFrame.mapID] or forceRetryForHubAmount
if (forceRetryForHub [WorldMapFrame.mapID] > 0) then
forceRetryForHub[WorldMapFrame.mapID] = forceRetryForHub[WorldMapFrame.mapID] or forceRetryForHubAmount
if (forceRetryForHub[WorldMapFrame.mapID] > 0) then
needAnotherUpdate = true
forceRetryForHub [WorldMapFrame.mapID] = forceRetryForHub [WorldMapFrame.mapID] - 1
forceRetryForHub[WorldMapFrame.mapID] = forceRetryForHub[WorldMapFrame.mapID] - 1
end

if (needAnotherUpdate) then
Expand Down
82 changes: 73 additions & 9 deletions WorldQuestTracker_ZoneMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ function WorldQuestTracker.CreateZoneWidget(index, name, parent, pinTemplate) --
button:SetFrameLevel(button.OriginalFrameLevel + 50)

if (self.OnEnterAnimation) then

if (not WorldQuestTracker.db.profile.hoverover_animations) then
return
end
Expand Down Expand Up @@ -220,12 +219,10 @@ function WorldQuestTracker.CreateZoneWidget(index, name, parent, pinTemplate) --
end
self.OnEnterAnimation:Play()
end

end
end)

button:HookScript("OnLeave", function(self)

if (button.OriginalFrameLevel) then
button:SetFrameLevel(button.OriginalFrameLevel)
end
Expand Down Expand Up @@ -730,6 +727,75 @@ function WorldQuestTracker.UpdateZoneWidgets(forceUpdate)
--pin.Texture:SetScale(0.7)
--end

---@class poiinfo : table
---@field areaPoiID number
---@field description string
---@field addPaddingAboveTooltipWidgets boolean
---@field isAlwaysOnFlightmap boolean
---@field isPrimaryMapForPOI boolean
---@field tooltipWidgetSet number
---@field highlightVignettesOnHover boolean
---@field name string
---@field position table
---@field shouldGlow boolean
---@field isCurrentEvent boolean
---@field highlightWorldQuestsOnHover boolean
---@field atlasName string

WorldQuestTrackerDataProvider:GetMap():RemoveAllPinsByTemplate("WorldQuestTrackerPOIPinTemplate")
WorldQuestTracker.HideAllPOIPins()

for pin in map:EnumeratePinsByTemplate("AreaPOIPinTemplate") do
local atlasName = pin.Texture:GetAtlas()
pin.Texture:SetAlpha(0.934)
if (atlasName == "worldquest-Capstone-questmarker-epic-Locked") then
--how to identify the point of interest?
if (not WorldQuestTracker.db.profile.pins_discovered["worldquest-Capstone-questmarker-epic-Locked"][pin.areaPoiID]) then
local poiInfo = pin:GetPoiInfo() --table
local mapData = pin:GetMap() --function

local poiId = poiInfo.areaPoiID
local mapId = mapData:GetMapID()
local position = poiInfo.position
local mapInfo = C_Map.GetMapInfo(mapId)
local parentMapInfo = C_Map.GetMapInfo(mapInfo.parentMapID)

--need check if a waypoint already exists
local mapPoint = UiMapPoint.CreateFromCoordinates(mapId, position.x, position.y)
C_Map.SetUserWaypoint(mapPoint)
local worldPosition = C_Map.GetUserWaypointPositionForMap(parentMapInfo.mapID)
C_Map.ClearUserWaypoint()

---@class wqt_poidata
---@field poiID number
---@field mapID number
---@field zoneX number
---@field zoneY number
---@field continentID number
---@field worldX number
---@field worldY number
---@field tooltipSetId number

local pointOfInterestData = {
["poiID"] = poiId,
["mapID"] = mapId,
["zoneX"] = pin.normalizedX,
["zoneY"] = pin.normalizedY,
["continentID"] = parentMapInfo.mapID,
["worldX"] = worldPosition.x,
["worldY"] = worldPosition.y,
["tooltipSetId"] = poiInfo.tooltipWidgetSet,
}

WorldQuestTracker.db.profile.pins_discovered["worldquest-Capstone-questmarker-epic-Locked"][poiId] = pointOfInterestData
end

pin.Texture:SetScale(1.2)
else
pin.Texture:SetScale(1)
end
end

for pin in map:EnumeratePinsByTemplate("QuestPinTemplate") do
pin:SetAlpha(0.923)
end
Expand Down Expand Up @@ -1073,7 +1139,6 @@ function WorldQuestTracker.UpdateZoneWidgets(forceUpdate)
end

if (WorldQuestTracker.WorldMap_GoldIndicator) then

WorldQuestTracker.WorldMap_GoldIndicator.text = floor(total_Gold / 10000)

if (total_Resources >= 1000) then
Expand Down Expand Up @@ -1164,7 +1229,6 @@ function WorldQuestTracker.UpdateZonePOIs(forceUpdate)
end
end
end

--elseif (iconData.dataType == "icon") then
end
end
Expand Down Expand Up @@ -1521,6 +1585,7 @@ function WorldQuestTracker.ScheduleZoneMapUpdate(seconds, isForceUpdate)
end
WorldQuestTracker.ScheduledZoneUpdate:Cancel()
end

WorldQuestTracker.ScheduledZoneUpdate = C_Timer.NewTimer(seconds or 1, do_zonemap_update)
WorldQuestTracker.ScheduledZoneUpdate.IsForceUpdate = isForceUpdate
end
Expand Down Expand Up @@ -1657,14 +1722,14 @@ function WorldQuestTracker.GetOrCreateZoneSummaryWidget(index, parent, pool)
local on_enter_animation = DF:CreateAnimationHub(button, nil, function()
--button:SetScale(1.1, 1.1)
end)
on_enter_animation.Step1 = DF:CreateAnimation(on_enter_animation, "scale", 1, 0.05, 1, 1, 1.05, 1.05)
on_enter_animation.Step2 = DF:CreateAnimation(on_enter_animation, "scale", 2, 0.05, 1.05, 1.05, 1.0, 1.0)
on_enter_animation.Step1 = DF:CreateAnimation(on_enter_animation, "Scale", 1, 0.05, 1, 1, 1.05, 1.05)
on_enter_animation.Step2 = DF:CreateAnimation(on_enter_animation, "Scale", 2, 0.05, 1.05, 1.05, 1.0, 1.0)
button.OnEnterAnimation = on_enter_animation

local on_leave_animation = DF:CreateAnimationHub(button, nil, function()
--button:SetScale(1.0, 1.0)
end)
on_leave_animation.Step1 = DF:CreateAnimation(on_leave_animation, "scale", 1, 0.1, 1.1, 1.1, 1, 1)
on_leave_animation.Step1 = DF:CreateAnimation(on_leave_animation, "Scale", 1, 0.1, 1.1, 1.1, 1, 1)
button.OnLeaveAnimation = on_leave_animation

local mouseoverHighlight = WorldQuestTracker.AnchoringFrame:CreateTexture(nil, "overlay")
Expand Down Expand Up @@ -1836,7 +1901,6 @@ end
-- ~summary

function WorldQuestTracker.UpdateZoneSummaryToggleButton(canShow)

if (not WorldQuestTracker.ZoneSummaryToogleButton) then
local button = CreateFrame("button", nil, ZoneSumaryFrame, "BackdropTemplate")
button:SetSize(12, 12)
Expand Down

0 comments on commit 40ec683

Please sign in to comment.