Skip to content

Commit

Permalink
Fixed an issue with the tracker not being responsible when completing…
Browse files Browse the repository at this point in the history
… a world quest
  • Loading branch information
Tercioo committed Jul 28, 2024
1 parent fb266bb commit e0cfa50
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 19 deletions.
52 changes: 36 additions & 16 deletions WorldQuestTracker_Tracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1464,20 +1464,6 @@ function WorldQuestTracker.UpdateQuestsInArea()
end


--ao completar uma world quest remover a quest do tracker e da refresh nos widgets
hooksecurefunc(BonusObjectiveTracker, "OnQuestTurnedIn", function(self, questID)
for i = #WorldQuestTracker.QuestTrackList, 1, -1 do
if (WorldQuestTracker.QuestTrackList[i].questID == questID) then
tremove (WorldQuestTracker.QuestTrackList, i)
WorldQuestTracker.RefreshTrackerWidgets()
break
end
end
end)




-- ~blizzard objective tracker
function WorldQuestTracker.IsQuestOnObjectiveTracker (quest)
local tracker = ObjectiveTrackerFrame
Expand Down Expand Up @@ -1521,11 +1507,12 @@ local onObjectiveTrackerChanges = function() --this will be called several times

local objectiveTrackerHeight = 0
for moduleFrame in pairs (ObjectiveTrackerManager.moduleToContainerMap) do
if (type(moduleFrame) == "table" and moduleFrame.GetObjectType and moduleFrame:GetObjectType() == "Frame") then
if (type(moduleFrame) == "table" and moduleFrame.GetObjectType and moduleFrame:GetObjectType() == "Frame" and moduleFrame:IsShown()) then
objectiveTrackerHeight = objectiveTrackerHeight + moduleFrame:GetHeight()
end
end
WorldQuestTracker.TrackerHeight = objectiveTrackerHeight + 10
WorldQuestTracker.TrackerHeight = objectiveTrackerHeight + 50

WorldQuestTracker.RefreshTrackerAnchor()

--need to refresh again on next tick due to some modules being updated after the tracker
Expand Down Expand Up @@ -1563,6 +1550,39 @@ else
end)
end

--ao completar uma world quest remover a quest do tracker e da refresh nos widgets
hooksecurefunc(BonusObjectiveTracker, "OnQuestTurnedIn", function(self, questID)
for i = #WorldQuestTracker.QuestTrackList, 1, -1 do
if (WorldQuestTracker.QuestTrackList[i].questID == questID) then
local questRemoved = tremove(WorldQuestTracker.QuestTrackList, i)
WorldQuestTracker.RefreshTrackerWidgets()
onObjectiveTrackerChanges()
break
end
end
end)

local questEventFrame = CreateFrame("frame")
questEventFrame:RegisterEvent("QUEST_TURNED_IN")
questEventFrame:SetScript("OnEvent", function(self, event, ...)
C_Timer.After(0, onObjectiveTrackerChanges)
end)

hooksecurefunc(C_SuperTrack, "SetSuperTrackedQuestID", function()
C_Timer.After(0, onObjectiveTrackerChanges)
end)

hooksecurefunc(QuestUtil, "TrackWorldQuest", function()
C_Timer.After(0, onObjectiveTrackerChanges)
end)

hooksecurefunc(QuestUtil, "UntrackWorldQuest", function()
C_Timer.After(0, onObjectiveTrackerChanges)
end)




--[=[
["1"] = "ReleaseFrame",
["2"] = "ShowRewardsToast",
Expand Down
1 change: 1 addition & 0 deletions libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
---@field UnitGroupRolesAssigned fun(unitId: unit, bUseSupport:boolean?, specId: specializationid?) : string there's no self here
---@field IsDragonflight fun():boolean
---@field IsDragonflightAndBeyond fun():boolean
---@field IsDragonflightOrBelow fun():boolean
---@field IsTimewalkWoW fun():boolean
---@field IsClassicWow fun():boolean
---@field IsTBCWow fun():boolean
Expand Down
10 changes: 8 additions & 2 deletions libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 551
local dversion = 552
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -113,7 +113,13 @@ end
---return if the wow version the player is playing is dragonflight or an expansion after it
---@return boolean
function DF.IsDragonflightAndBeyond()
return select(4, GetBuildInfo()) >= 100000
return 110000 >= 100000
end

---return true if the wow version is Dragonflight or below
---@return boolean
function DF.IsDragonflightOrBelow()
return 110000 < 110000
end

---return if the wow version the player is playing is a classic version of wow
Expand Down
22 changes: 22 additions & 0 deletions libs/DF/schedules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,28 @@ function detailsFramework.Schedules.AfterById(time, callback, id, ...)
return newTimer
end

--Schedules a callback function to be executed after a specified time delay.
--It uniquely identifies each scheduled task by an ID, if another schedule with the same id is made, it will be ignore until the previous one is finished.
function detailsFramework.Schedules.AfterByIdNoCancel(time, callback, id, ...)
if (not detailsFramework.Schedules.ExecuteTimerTableNoCancel) then
detailsFramework.Schedules.ExecuteTimerTableNoCancel = {}
end

local alreadyHaveTimer = detailsFramework.Schedules.ExecuteTimerTableNoCancel[id]
if (alreadyHaveTimer) then
return
end

local newTimer = detailsFramework.Schedules.NewTimer(time, callback, ...)
detailsFramework.Schedules.ExecuteTimerTableNoCancel[id] = newTimer

C_Timer.After(time, function()
detailsFramework.Schedules.ExecuteTimerTableNoCancel[id] = nil
end)

return newTimer
end

--schedule a function to be called after 'time'
--prompt example: create a schedule that runs the function 'variable name' after 'time' amount of seconds
function detailsFramework.Schedules.After(time, callback)
Expand Down
19 changes: 18 additions & 1 deletion luaserver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ function LibStub:IterateLibraries()end
---@field spellID number
---@field originalIconID number

---@class spellchargeinfo
---@field currentCharges number
---@field maxCharges number
---@field cooldownStartTime number
---@field cooldownDuration number
---@field chargeModRate number

---@class privateaura_anchor : table
---@field unitToken unit
---@field auraIndex number
Expand Down Expand Up @@ -1719,6 +1726,15 @@ function bit.ror(x, y) return 0 end
---@return number
function GetServerTime() return 0 end

C_Spell = {}

---@param spellID number
---@return spellinfo
function C_Spell.GetSpellInfo(spellID) return {} end

---@param spellID number
---@return spellchargeinfo
function C_Spell.GetSpellCharges(spellID) return {} end

C_Timer = {}
---@param delay number
Expand Down Expand Up @@ -5294,8 +5310,9 @@ IsAttackSpell = function(spellId) return true end
IsAutoRepeatSpell = function(spellId) return true end

---@param spellId number
---@param spellBank string
---@return boolean
IsPassiveSpell = function(spellId) return true end
IsPassiveSpell = function(spellId, spellBank) return true end

---@param spellName string
---@param target string
Expand Down

0 comments on commit e0cfa50

Please sign in to comment.