Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove QoL rerender if currentstep index don't change #296

Merged
merged 16 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions APR-Core/Arrow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ APR.ArrowFrame.Button:SetPoint("BOTTOM", APR.ArrowFrame, "BOTTOM", 0, -40)
APR.ArrowFrame.Button:SetScript("OnMouseDown", function(self, button)
APR.ArrowFrame.Button:Hide()
print("APR: " .. L["SKIP_WAYPOINT"])
_G.NextQuestStep()
APR:NextQuestStep()
APR.Arrow.x = 0
APR.Arrow.y = 0
end)
Expand Down Expand Up @@ -161,7 +161,7 @@ function APR.Arrow:SetQPTT()
return
end

if (APR.Arrow.currentStep ~= CurStep and step.Coord and CheckIsInRouteZone()) then
if (APR.Arrow.currentStep ~= CurStep and step.Coord and APR:CheckIsInRouteZone()) then
self:SetArrowActive(true, step.Coord.x, step.Coord.y)
APR.Arrow.currentStep = CurStep
end
Expand Down Expand Up @@ -190,7 +190,7 @@ function APR.Arrow:CalculPosition()

if trigger.Range > distance then
APR.Arrow.currentStep = 0
_G.NextQuestStep()
APR:NextQuestStep()
return
end
end
Expand Down Expand Up @@ -218,7 +218,7 @@ function APR.Arrow:CalculPosition()
APR.Arrow.x = 0
if questStep.Waypoint then
APR.Arrow.currentStep = 0
_G.NextQuestStep()
APR:NextQuestStep()
end
return
end
Expand Down
3 changes: 0 additions & 3 deletions APR-Core/Bindings.xml

This file was deleted.

2 changes: 1 addition & 1 deletion APR-Core/Buff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ end
APR.Buff.Event = CreateFrame("Frame")
APR.Buff.Event:RegisterEvent("UNIT_AURA")
APR.Buff.Event:SetScript("OnEvent", function(self, event, ...)
local steps = GetSteps(APR.ActiveRoute and APRData[APR.PlayerID][APR.ActiveRoute] or nil)
local steps = APR:GetSteps(APR.ActiveRoute and APRData[APR.PlayerID][APR.ActiveRoute] or nil)
if event == "UNIT_AURA" then
local target, info = ...;
if steps and steps.Buffs then
Expand Down
19 changes: 17 additions & 2 deletions APR-Core/ChangeLog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ end

function APR.changelog:SetChangeLog()
local news = {
{ "v3.3.0", "2024-06-03" },
"#Features",
"- Reduce the number of renderings of the Quest Order Liste Frame to no longer cause freezes",
"- Reduce the number of renderings of the Current Step Frame to no longer cause freezes",
"- Added APR prefix to utils function to avoid conflict with other addon",

"#Bug",
"- Fixed update of Qpart objective during combat",
"- Removed unwanted Qpart 29765-1 (Cryin' My Eyes Out)",
"- Fix TOC addon version to display",
"- Updated Pickup 31261 to dropQuest (Captain Jack's Dead)",
"- Merged quest 29717 with 29716 pickup step in Jade forest (Down Kitty!)",
"- Fixed waypoint questID for Jade forest",
"- Added 81638 and 81976 quest for mop remix in horde Jade forest (Home Is Where the Hearthstone Is, Bazaar, Isn't It?)",

{ "v3.2.9", "2024-06-01" },
"#Features",
"- Changed event for GetFP to detect new taxi node",
Expand Down Expand Up @@ -143,7 +158,7 @@ function APR.changelog:SetChangeLog()
"- Added command to reset all the custom route (/apr resetcustom)",
"- Support of all MoP zone for both faction",

{ "v3.2.0", "2024-05-14" },
{ "v3.2.0", "2024-05-14" },
"#Features",
"- Updated the position of the minimap buttons",
"- Added auto-retry for auto-accept on PickUp steps",
Expand Down Expand Up @@ -215,7 +230,7 @@ function APR.changelog:SetChangeLog()
"#WoW",
"- Update interface addon version to 10.2.6",

{ "v3.1.9", "2024-03-06" },
{ "v3.1.9", "2024-03-06" },
"#Bugs",
"- Fix DF starting zone with zone step",
"- Add coord for all the step of DF alliance starting zone",
Expand Down
4 changes: 2 additions & 2 deletions APR-Core/Commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function APR.command:SlashCmd(input)
elseif (inputText == "skip" or inputText == "s" or inputText == "skippiedoodaa") then
-- Command for skipping the current quest step
print("APR: " .. L["SKIP"])
NextQuestStep()
APR:NextQuestStep()
elseif (inputText == "rollback" or inputText == "rb") then
-- Command for rollback the current quest step
print("APR: " .. L["ROLLBACK"])
PreviousQuestStep()
APR:PreviousQuestStep()
elseif (inputText == "qol") then
APR.settings.profile.showQuestOrderList = not APR.settings.profile.showQuestOrderList
APR.questOrderList:RefreshFrameAnchor()
Expand Down
17 changes: 7 additions & 10 deletions APR-Core/Config_Route.lua
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ function SetRouteListTab(widget, name)

-- Copy the routes into a new table for sorting
for fileName, routeName in pairs(routes) do
if not Contains(APRCustomPath[APR.PlayerID], routeName) then
if not APR:Contains(APRCustomPath[APR.PlayerID], routeName) then
tinsert(sortedRoutes, { fileName = fileName, routeName = routeName })
end
end
Expand Down Expand Up @@ -530,7 +530,7 @@ function SetRouteListTab(widget, name)
status = L["ROUTE_COMPLETED"]
elseif APRData[APR.PlayerID][route.fileName] then
if not APRData[APR.PlayerID][route.fileName .. '-TotalSteps'] then
_G.GetTotalSteps(route.fileName)
APR:GetTotalSteps(route.fileName)
end
status = APRData[APR.PlayerID][route.fileName] ..
"/" .. APRData[APR.PlayerID][route.fileName .. '-TotalSteps']
Expand Down Expand Up @@ -638,7 +638,7 @@ end
function IsRouteDisabled(tab, routeName)
if string.find(tab, "Dragonflight") and (APR.Level < 60 and APR.ClassId ~= APR.Classes["Dracthyr"]) then
return true
elseif routeName == "01-10 Exile's Reach" and not Contains({ 1409, 1726, 1727, 1728 }, APR:GetPlayerParentMapID()) then
elseif routeName == "01-10 Exile's Reach" and not APR:Contains({ 1409, 1726, 1727, 1728 }, APR:GetPlayerParentMapID()) then
return true
end
return false
Expand All @@ -659,7 +659,7 @@ end
function APR.routeconfig:GetStartingZonePrefab()
if APR.ClassId == APR.Classes["Dracthyr"] then
tinsert(APRCustomPath[APR.PlayerID], "Dracthyr Start")
elseif Contains({ 1409, 1726, 1727, 1728 }, APR:GetPlayerParentMapID()) then
elseif APR:Contains({ 1409, 1726, 1727, 1728 }, APR:GetPlayerParentMapID()) then
tinsert(APRCustomPath[APR.PlayerID], "01-10 Exile's Reach")
elseif not (C_QuestLog.IsQuestFlaggedCompleted(59926) or C_QuestLog.IsQuestFlaggedCompleted(56775)) and APR.Level < APR.MinBoostLvl then -- first quest from Exile's Reach + boost
--None skipable starting zone
Expand Down Expand Up @@ -849,11 +849,8 @@ function APR.routeconfig:CheckIsCustomPathEmpty()
end
if not self:HasRouteInCustomPaht() then
APR.ActiveRoute = nil
APR.currentStep:RemoveQuestStepsAndExtraLineTexts()

APR.currentStep:Reset()
APR.currentStep:AddExtraLineText("NO_ROUTE", L["NO_ROUTE"], true)
APR.currentStep:ButtonDisable()
APR.currentStep:ProgressBar()
APR:SendMessage("APR_MAP_UPDATE")
APR.map:RemoveMapLine()
APR.map:RemoveMinimapLine()
Expand All @@ -869,9 +866,9 @@ APR.routeconfig.eventFrame:SetScript("OnEvent", function(self, event, ...)
if (event == "PLAYER_LEVEL_UP") then
local arg1, _ = ...;
APR.Level = arg1
if not IsTableEmpty(APRCustomPath[APR.PlayerID]) then
if not APR:IsTableEmpty(APRCustomPath[APR.PlayerID]) then
local _, currentRouteName = next(APRCustomPath[APR.PlayerID])
if Contains(notSkippableRoute, currentRouteName) then
if APR:Contains(notSkippableRoute, currentRouteName) then
return
elseif APR.Level == 10 then
APR.questionDialog:CreateQuestionPopup(format(L["RESET_ROUTE_FOR_SPEEDRUN"], APR.Level), function()
Expand Down
3 changes: 1 addition & 2 deletions APR-Core/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function APR:OnInitialize()

-- APR Global Variables, UI oriented
BINDING_HEADER_APR = APR.title -- Header text for APR's main frame
_G["BINDING_NAME_" .. "CLICK APRItemButton:LeftButton"] = L["USE_QUEST_ITEM"]
_G["BINDING_NAME_" .. "CLICK APR_ItemButton:LeftButton"] = L["USE_QUEST_ITEM"]

-- Register tot party frame
C_ChatInfo.RegisterAddonMessagePrefix("APRPartyData")
Expand Down Expand Up @@ -150,7 +150,6 @@ APR.CoreEventFrame:SetScript("OnEvent", function(self, event, ...)
APR_LoadInTimer:SetLooping("NONE")
APR_LoadInTimer:SetScript("OnFinished", function(self, event, ...)
APR.BookingList["UpdateMapId"] = true
APR.BookingList["UpdateQuest"] = true

APR.RouteSelection:RefreshFrameAnchor()
local CQIDs = C_QuestLog.GetAllCompletedQuestIDs()
Expand Down
30 changes: 24 additions & 6 deletions APR-Core/CurrentStep.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ APR.currentStep.questsExtraTextList = {}
-- Height of the quest frame
APR.currentStep.FrameHeight = 0

-- Save the previous
APR.currentStep.previousState = {}


--Local constant
local FRAME_WIDTH = 235
local FRAME_HEADER_OPFFSET = -50
Expand Down Expand Up @@ -420,7 +424,7 @@ function APR.currentStep:SetProgressBar(CurStep)
if APR.ActiveRoute then
if not APRData[APR.PlayerID]
[APR.ActiveRoute .. '-TotalSteps'] then
_G.GetTotalSteps()
APR:GetTotalSteps()
end
local curStepDisplayed = CurStep - (APRData[APR.PlayerID][APR.ActiveRoute .. '-SkippedStep'] or 0)
APR.currentStep:ProgressBar(APR.ActiveRoute, APRData[APR.PlayerID]
Expand All @@ -442,7 +446,7 @@ local function AddStepsFrame(questDesc, extraLineText, noStars)
font:SetWidth(FRAME_WIDTH)
font:SetPoint("TOPLEFT", 5, -5)
if extraLineText then
font:SetText(TextWithStars(extraLineText, noStars and 0 or 2))
font:SetText(APR:TextWithStars(extraLineText, noStars and 0 or 2))
else
font:SetText('- ' .. questDesc)
end
Expand All @@ -456,6 +460,7 @@ local function AddStepsFrame(questDesc, extraLineText, noStars)
tileSize = 16
})
container:SetBackdropColor(unpack(APR.settings.profile.currentStepbackgroundColorAlpha))
container.font = font

return container
end
Expand All @@ -466,7 +471,7 @@ local function AddExtraLineTextFrame(extraLineText, noStars)
end

-- Add/Update quest steps
function APR.currentStep:UpdateQuestSteps(questID, textObjective, objectiveIndex)
function APR.currentStep:AddQuestSteps(questID, textObjective, objectiveIndex)
if InCombatLockdown() or not APR.settings.profile.currentStepShow then
return
end
Expand Down Expand Up @@ -495,6 +500,20 @@ function APR.currentStep:UpdateQuestSteps(questID, textObjective, objectiveIndex
self:ReOrderQuestSteps()
end

function APR.currentStep:UpdateQuestStep(questID, textObjective, objectiveIndex)
if not APR.settings.profile.currentStepShow then
return
end

local questKey = questID .. "-" .. objectiveIndex
local existingContainer = self.questsList[questKey]

if not existingContainer then
return
end
existingContainer.font:SetText('- ' .. textObjective)
end

local getExtraLineHeight = function()
-- Always reset to header offset with a new extra line
local height = FRAME_HEADER_OPFFSET
Expand Down Expand Up @@ -615,7 +634,7 @@ function APR.currentStep:AddStepButton(questsListKey, itemID, attribute)
return
end

local IconButton = CreateFrame("Button", "$parentIconButton", container,
local IconButton = CreateFrame("Button", "APR_ItemButton", container,
"SecureActionButtonTemplate, BackdropTemplate")
IconButton:SetSize(25, 25)
PositionStepButtons(container, IconButton)
Expand Down Expand Up @@ -685,9 +704,8 @@ function APR.currentStep:UpdateStepButtonCooldowns()
end

--- Disable Button, Reset ProgressBar and Remove all quest and extra line
function APR.currentStep:Disable()
function APR.currentStep:Reset()
self:ButtonDisable()
self:ProgressBar()
self:RemoveQuestStepsAndExtraLineTexts()
self:RefreshCurrentStepFrameAnchor()
end
4 changes: 3 additions & 1 deletion APR-Core/Heirloom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ function APR.heirloom:AddHeirloomIcons()

for _, heirloom in ipairs(heirlooms) do
local button
if heirloom.name == "map" and PlayerHasToy(heirloom.id) and (APR.Faction == heirloom.faction or heirloom.faction == "Neutral") and not Contains({ 1409, 1726, 1727, 1728 }, APR:GetPlayerParentMapID()) then -- heirloom not availble in the tuto zone
if heirloom.name == "map" and PlayerHasToy(heirloom.id) and
(APR.Faction == heirloom.faction or heirloom.faction == "Neutral") and
not APR:Contains({ 1409, 1726, 1727, 1728 }, APR:GetPlayerParentMapID()) then -- heirloom not availble in the tuto zone
button = CreateMapButton(HeirloomFrame_body, heirloom.id)
elseif heirloom.name == "heirloom" then
button = CreateHeirloomButton(HeirloomFrame_body, heirloom.icon)
Expand Down
4 changes: 2 additions & 2 deletions APR-Core/Map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function APR.map:CreatePin(index, step, size, color, textColor, textScale)

-- GameTooltip
-- pinFrame:SetScript("OnEnter", function(self)
-- local string, key = GetStepString(step)
-- local string, key = APR:GetStepString(step)
-- GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
-- GameTooltip:AddLine(index .. " - " .. string)
-- GameTooltip:AddLine(step[key],
Expand Down Expand Up @@ -328,7 +328,7 @@ end
function APR.map:AddMapPins()
self:RemoveMapIcons()
self:RemoveMiniMapIcons()
if not APR.settings.profile.enableAddon or not APR.settings.profile.mapshowNextSteps and not APR.settings.profile.minimapshowNextSteps or not CheckIsInRouteZone() then
if not APR.settings.profile.enableAddon or not APR.settings.profile.mapshowNextSteps and not APR.settings.profile.minimapshowNextSteps or not APR:CheckIsInRouteZone() then
return
end

Expand Down
2 changes: 1 addition & 1 deletion APR-Core/Party.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function APR.party:CheckIfPartyMemberIsFriend()
for groupindex = 1, 5 do
local nameOfPartyMember = UnitName("party" .. groupindex)
if (nameOfPartyMember) then
if Contains(FriendListTable, nameOfPartyMember) then
if APR:Contains(FriendListTable, nameOfPartyMember) then
return true
end
end
Expand Down
Loading