Skip to content

Commit

Permalink
Yes
Browse files Browse the repository at this point in the history
  • Loading branch information
derfloh205 committed Dec 18, 2023
1 parent 091ffb6 commit 6d64cd4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions CraftSim.toc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## IconTexture: Interface\Icons\inv_misc_coin_02
## SavedVariables: CraftSimDebugData, CraftSimOptions, CraftSimGGUIConfig, CraftSimPriceOverridesV2, CraftSimRecipeIDs, CraftSimProfessionInfoCache, CraftSimProfessionSkillLineIDCache, CraftSimCraftData, CraftSimRecipeMap, CraftSimLoadedProfessionRecipes, CraftSimCustomerHistoryV2, CraftSimCustomerHistory
## Dependencies: Blizzard_Professions
## OptionalDeps: Auctionator, TradeSkillMaster, RECrystallize, OribosExchange

embeds.xml

Expand Down
3 changes: 2 additions & 1 deletion Data/News.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ function CraftSim.NEWS:GET_NEWS()
local news = {
f.bb(" Hello and thank you for using CraftSim!\n"),
f.bb(" ( You are awesome! )"),
newP("12.0.3"),
newP("12.0.4"),
f.p .. "Hotfixes regarding " ..f.bb("CustomerHistory") .. " Data Migration",
f.p .. "Added price source addons to optional deps......",
newP("12.0.0"),
f.P .. "Reworked " .. f.bb("Customer History") .. ". Now includes:",
f.a .. "- " .. f.g("A Whisper Button"),
Expand Down
6 changes: 2 additions & 4 deletions Main/CraftSim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ end
function CraftSim.MAIN:ADDON_LOADED(addon_name)
if addon_name == CraftSimAddonName then
CraftSim.LOCAL:Init()
CraftSim.PRICE_API:InitPriceSource()

CraftSim.MAIN:handleCraftSimOptionsUpdates()

CraftSim.FRAME:InitDebugFrame()
Expand Down Expand Up @@ -387,7 +389,6 @@ function CraftSim.MAIN:ADDON_LOADED(addon_name)
CraftSim.TOOLTIP:Init()
CraftSim.MAIN:HookToEvent()
CraftSim.MAIN:HookToProfessionsFrame()
--CraftSim.FRAME:HandleAuctionatorOverlaps()
CraftSim.MAIN:HandleAuctionatorHooks()
CraftSim.MAIN:InitCraftRecipeHooks()
CraftSim.ACCOUNTSYNC:Init()
Expand Down Expand Up @@ -495,9 +496,6 @@ function CraftSim.MAIN:PLAYER_LOGIN()
end
end

CraftSim.PRICE_API:InitPriceSource()
--CraftSim.MAIN:HandleCollapsedFrameSave()

-- show one time note
if CraftSimOptions.optionsShowNews then
CraftSim.NEWS:ShowNews()
Expand Down
16 changes: 8 additions & 8 deletions Pricing/PriceAPIs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ CraftSimDEBUG_PRICE_API = {name = "Debug"}
CraftSimDebugData = CraftSimDebugData or {}
CraftSim.PRICE_APIS.available = true

local systemPrint = print
local print = CraftSim.UTIL:SetDebugPrint(CraftSim.CONST.DEBUG_IDS.PRICE_APIS)

function CraftSim.PRICE_API:InitPriceSource()
local loadedSources = CraftSim.PRICE_APIS:GetAvailablePriceSourceAddons()
systemPrint("loaded sources: " .. #loadedSources)

if #loadedSources == 0 then
CraftSim.UTIL:SystemPrint(CraftSim.GUTIL:ColorizeText("CraftSim:",CraftSim.GUTIL.COLORS.BRIGHT_BLUE) .. " " .. CraftSim.LOCAL:GetText(CraftSim.CONST.TEXT.POPUP_NO_PRICE_SOURCE_SYSTEM))
Expand Down Expand Up @@ -59,25 +61,23 @@ end
function CraftSim.PRICE_APIS:GetAvailablePriceSourceAddons()
local loadedAddons = {}
for _, addonName in pairs(CraftSim.CONST.SUPPORTED_PRICE_API_ADDONS) do
if IsAddOnLoaded(addonName) then
if select(2, C_AddOns.IsAddOnLoaded(addonName)) then
table.insert(loadedAddons, addonName)
end
end
return loadedAddons
end

function CraftSim.PRICE_APIS:IsPriceApiAddonLoaded()
local loaded = false
for _, name in pairs(CraftSim.CONST.SUPPORTED_PRICE_API_ADDONS) do
if IsAddOnLoaded(name) then
if select(2, C_AddOns.IsAddOnLoaded(name)) then
return true
end
end
return false
end

function CraftSim.PRICE_APIS:IsAddonPriceApiAddon(addon_name)
local loading = false
for _, name in pairs(CraftSim.CONST.SUPPORTED_PRICE_API_ADDONS) do
if addon_name == name then
return true
Expand All @@ -87,10 +87,10 @@ function CraftSim.PRICE_APIS:IsAddonPriceApiAddon(addon_name)
end

function CraftSim.PRICE_APIS:InitAvailablePriceAPI()
local _, tsmLoaded = IsAddOnLoaded(CraftSimTSM.name)
local _, auctionatorLoaded = IsAddOnLoaded(CraftSimAUCTIONATOR.name)
local _, recrystallizeLoaded = IsAddOnLoaded(CraftSimRECRYSTALLIZE.name)
local _, exchangeLoaded = IsAddOnLoaded(CraftSimEXCHANGE.name)
local _, tsmLoaded = C_AddOns.IsAddOnLoaded(CraftSimTSM.name)
local _, auctionatorLoaded = C_AddOns.IsAddOnLoaded(CraftSimAUCTIONATOR.name)
local _, recrystallizeLoaded = C_AddOns.IsAddOnLoaded(CraftSimRECRYSTALLIZE.name)
local _, exchangeLoaded = C_AddOns.IsAddOnLoaded(CraftSimEXCHANGE.name)
if tsmLoaded then
CraftSim.PRICE_API = CraftSimTSM
elseif auctionatorLoaded then
Expand Down

0 comments on commit 6d64cd4

Please sign in to comment.