Skip to content

Commit

Permalink
Major source code cleanup, organization and split big files into two …
Browse files Browse the repository at this point in the history
…other files
  • Loading branch information
Tercioo committed Sep 3, 2024
1 parent c45f3d8 commit 5f9a842
Show file tree
Hide file tree
Showing 15 changed files with 2,559 additions and 2,021 deletions.
94 changes: 22 additions & 72 deletions WorldQuestTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function WorldQuestTracker:OnInit()
WorldQuestTracker.dbChr.ActiveQuests = WorldQuestTracker.dbChr.ActiveQuests or {}

local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
SharedMedia:Register ("statusbar", "Iskar Serenity", [[Interface\AddOns\WorldQuestTracker\media\bar_serenity]])
SharedMedia:Register("statusbar", "Iskar Serenity", [[Interface\AddOns\WorldQuestTracker\media\bar_serenity]])

C_Timer.After (5, function()
WorldQuestTracker.InitiateFlyMasterTracker()
Expand Down Expand Up @@ -312,6 +312,8 @@ function WorldQuestTracker:OnInit()
end
end

WorldQuestTracker.MapChangedTime = time()-1

C_Timer.After (3, save_player_name)
C_Timer.After (10, save_player_name)

Expand All @@ -321,6 +323,13 @@ function WorldQuestTracker:OnInit()
WorldQuestTracker:ZONE_CHANGED_NEW_AREA()
end

function WorldQuestTracker.FinishedUpdate_Zone()
return true
end
function WorldQuestTracker.FinishedUpdate_World()
return true
end

function WorldQuestTracker.IsInvasionPoint()
if (ff:IsShown()) then
return
Expand Down Expand Up @@ -369,6 +378,10 @@ function WorldQuestTracker:OnInit()
end
end

if (WorldQuestTracker.DoesMapHasWorldQuests(WorldMapFrame.mapID)) then
WorldQuestTracker.PreloadWorldQuestsForMap(WorldMapFrame.mapID)
end

WorldQuestTracker.UpdateExtraMapTextures()

local mapInfo = WorldQuestTracker.GetMapInfo()
Expand Down Expand Up @@ -489,6 +502,8 @@ function WorldQuestTracker:OnInit()

--FlashClientIcon()

WorldQuestTracker.RemoveQuestFromCache(questID)

if (isWorldQuest(questID)) then --wait, is this inception?
local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, allowDisplayPastCritical, gold, goldFormated, rewardName, rewardTexture, numRewardItems, itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable, stackAmount = WorldQuestTracker.GetOrLoadQuestData (questID)
local questHistory = WorldQuestTracker.db.profile.history
Expand Down Expand Up @@ -877,73 +892,7 @@ local wait_ShowTutorialAlert = function()
WorldQuestTracker.ShowTutorialAlert()
end

local tutorial_one = function()

local widget = WorldQuestTracker.WorldSummaryQuestsSquares [1]

local alert = CreateFrame ("frame", "WorldQuestTrackerTutorialAlert1", worldFramePOIs, "MicroButtonAlertTemplate")
alert:SetFrameLevel(302)
alert.label = L["S_TUTORIAL_CLICKTOTRACK"]
alert.Text:SetSpacing (4)
MicroButtonAlert_SetText2 (alert, alert.label)

if (widget and widget:IsShown()) then
alert:SetPoint("bottom", widget, "top", 0, 28)
else
alert:SetPoint("topleft", worldFramePOIs, "topleft", 64, -270)
end

alert.CloseButton:HookScript ("OnClick", hook_AlertCloseButton)
alert:Show()

WorldQuestTracker.db.profile.TutorialPopupID = WorldQuestTracker.db.profile.TutorialPopupID + 1
end

local tutorial_two = function()
if (WorldQuestTrackerToggleQuestsSummaryButton and WorldQuestTrackerToggleQuestsSummaryButton:IsShown()) then
local alert = CreateFrame ("frame", "WorldQuestTrackerTutorialAlert2", worldFramePOIs, "MicroButtonAlertTemplate")
alert:SetFrameLevel(302)
alert.label = L["S_TUTORIAL_WORLDBUTTONS"]
alert.Text:SetSpacing (4)
MicroButtonAlert_SetText2 (alert, alert.label)

alert:SetPoint("bottom", WorldQuestTrackerToggleQuestsSummaryButton, "top", 0, 28)

alert.CloseButton:HookScript ("OnClick", hook_AlertCloseButton)
alert.Arrow:ClearAllPoints()
alert.Arrow:SetPoint("topleft", alert, "bottomleft", 70, 0)
alert:Show()

WorldQuestTracker.db.profile.TutorialPopupID = WorldQuestTracker.db.profile.TutorialPopupID + 1

else
C_Timer.After (2, WorldQuestTracker.ShowTutorialAlert)
end
end

local tutorial_three = function()
local alert = CreateFrame ("frame", "WorldQuestTrackerTutorialAlert3", worldFramePOIs, "MicroButtonAlertTemplate")
alert:SetFrameLevel(302)
alert.label = L["S_TUTORIAL_STATISTICS_BUTTON"]
alert.Text:SetSpacing (4)
MicroButtonAlert_SetText2 (alert, alert.label)
alert:SetPoint("bottomleft", WorldQuestTrackerStatisticsButton, "topleft", 0, 32)
alert.Arrow:ClearAllPoints()
alert.Arrow:SetPoint("topleft", alert, "bottomleft", 10, 0)
alert.CloseButton:HookScript ("OnClick", hook_AlertCloseButton)
alert:Show()

WorldQuestTracker.db.profile.TutorialPopupID = WorldQuestTracker.db.profile.TutorialPopupID + 1
end

local tutorial_four = function()
--tutorial four was the tutorial for the centralized button, which has been removed
--it just increases the tutorial ID here
WorldQuestTracker.db.profile.TutorialPopupID = WorldQuestTracker.db.profile.TutorialPopupID + 1
end

function WorldQuestTracker.ShowTutorialAlert()

if (true) then
--disabled tutorials for 9.0.1, due to "MicroButtonAlertTemplate" being nil, need to replace with the new animation
return
Expand All @@ -967,8 +916,6 @@ function WorldQuestTracker.ShowTutorialAlert()

WorldMapFrame:SetMapID (WorldQuestTracker.MapData.ZoneIDs.KULTIRAS)
WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)

--C_Timer.After (4, tutorial_one)
return

elseif (WorldQuestTracker.db.profile.TutorialPopupID == 2) then
Expand Down Expand Up @@ -1034,19 +981,20 @@ function WorldQuestTracker.CreateLoadingIcon()
local anim1 = animGroup1:CreateAnimation ("Alpha")
anim1:SetOrder (1)
anim1:SetFromAlpha (0)
anim1:SetToAlpha (1)
anim1:SetToAlpha (0.834)
anim1:SetDuration (2)
f.FadeIN = animGroup1

local animGroup2 = f:CreateAnimationGroup()
local anim2 = animGroup2:CreateAnimation ("Alpha")
f.FadeOUT = animGroup2
anim2:SetOrder (2)
anim2:SetFromAlpha (1)
anim2:SetFromAlpha (0.834)
anim2:SetToAlpha (0)
anim2:SetDuration (4)
animGroup2:SetScript("OnFinished", function()
f:Hide()
WorldQuestTracker.LoadingAnimation.IsPlaying = false
end)

f.Text = f:CreateFontString (nil, "overlay", "GameFontNormal")
Expand Down Expand Up @@ -1097,17 +1045,19 @@ end
function WorldQuestTracker.IsPlayingLoadAnimation()
return WorldQuestTracker.LoadingAnimation.IsPlaying
end

function WorldQuestTracker.PlayLoadingAnimation()
do return end
if (not WorldQuestTracker.IsPlayingLoadAnimation()) then
WorldQuestTracker.LoadingAnimation:Show()
WorldQuestTracker.LoadingAnimation.FadeIN:Play()
WorldQuestTracker.LoadingAnimation.Loop:Play()
WorldQuestTracker.LoadingAnimation.IsPlaying = true
end
end

function WorldQuestTracker.StopLoadingAnimation()
WorldQuestTracker.LoadingAnimation.FadeOUT:Play()
WorldQuestTracker.LoadingAnimation.IsPlaying = false
end

----------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions WorldQuestTracker.toc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ WorldQuestTracker_Tracker.lua

WorldQuestTracker_Core.lua

WorldQuestTracker_MapChange.lua
WorldQuestTracker_FrameAPI.lua
WorldQuestTracker_MapAPI.lua
WorldQuestTracker_Summary.lua
WorldQuestTracker_GroupFinder.lua
WorldQuestTracker_RareFinder.lua
WorldQuestTracker_ZoneMap.lua
Expand Down
Loading

0 comments on commit 5f9a842

Please sign in to comment.