WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR API and Graphics Changes (https://www.wowinterface.com/forums/forumdisplay.php?f=175)
-   -   Shadowlands API changes? (https://www.wowinterface.com/forums/showthread.php?t=57937)

Voxxel 04-14-20 02:12 PM

Shadowlands API changes?
 
Hi there,

Are the Shadowlands API changes announced for now?

Kanegasi 04-14-20 02:42 PM

Server-side changes have not been announced yet, nor has any organized patch notes concerning API.

However, you're welcome to browse this github diff between live servers and a UI extract from the beta: https://github.com/Gethe/wow-ui-sour...a?diff=unified

Voxxel 04-15-20 07:12 AM

Thank you very much!

Drudatz 08-16-20 04:42 PM

frame:SetBackdrop("something") doesnt work anymore and SL Beta tells me SetBackdrop is nil.
Anyone knows what replaces SetBackdrop?

EDITH: nvm found it: https://us.forums.blizzard.com/en/wo...beta/586355/17

"Instead of always creating backdrops on every frame, they require each frame to explicitly inherit backdrops. There is no change in functionality, only the default setting has been changed in an effort to improve performance."

Seerah 08-16-20 06:47 PM

Try this thread: https://www.wowinterface.com/forums/...ad.php?t=58109

Drudatz 08-17-20 12:57 PM

Anyone knows with what GetCurrencyListSize() was replaced cause it aint working on Beta anymore?

Fizzlemizz 08-17-20 01:02 PM

Code:

local numTokenTypes = C_CurrencyInfo.GetCurrencyListSize();
A good place to start looking.

Drudatz 08-17-20 01:18 PM

Quote:

Originally Posted by Fizzlemizz (Post 336640)
[code]A good place to start looking.

thank you! I was looking for something like that but didnt find it :-(

arith 08-23-20 11:38 PM

Several of currency related function calls have been replace with C_CurrencyInfo API calls.
So the return values also changed.

Check here for some more details.

Goldpaw 08-29-20 01:46 AM

Not sure about the code in general, but I know that NAMEPLATE_FONT and NAMEPLATE_SPELLCAST_FONT doesn't accept file paths, they have to be the name of a font object instead. Like "GameFontWhite" or "GameFontNormalSmall".

Voxxel 08-29-20 11:43 AM

I've asked about the API changes because my good old lua code seems to have stopped working in 9.x. It's a simple code to print out quest IDs into chat if any quest is accepted or completed. (useful for tracking hidden quests)

Code:

    local RealQuestBlacklist = {} -- [questID] = true, Ignore any questIDs in the list
    local QUEST_TIMEOUT = 1
    local function ScrapeQTip(self)
        local tipName = self:GetName()
        local name, description = _G[tipName .. 'TextLeft1']:GetText(), _G[tipName ..'TextLeft3']:GetText()
        if name then
            print(format('Quest Completed: |cffffff00|Hquest:%d|h[%s]|h|r (%d) %s', self.questID, name, self.questID, description or ''))
        elseif self.questID ~= 0 then
            print('Quest Completed: |cffffff00' .. self.questID)
        end
        self:SetScript('OnTooltipSetQuest', nil) -- If it gets to this point we don't want this potentially firing again
        self.questID = nil
    end
   
    local QTips = {}
    local function GetQTip() -- Recycle old tooltip or create new one if none available
        local now = GetTime()
        for i, tip in ipairs(QTips) do
            if not tip.questID or now - tip.lastUpdate > QUEST_TIMEOUT then -- If it hasn't finished within this time frame then recycle it anyway
                tip.lastUpdate = now
                return tip
            end
        end
        local tip = CreateFrame('GameTooltip',  'SemlarsQTip' .. (#QTips + 1), WorldFrame, 'GameTooltipTemplate')
        tip:Show()
        tip:SetHyperlink('quest:0')
        tip.lastUpdate = now
        tinsert(QTips, tip)
        return tip
    end
   
    function FetchQuestInfo(questID)
        local tip = GetQTip()
        tip:SetOwner(WorldFrame, 'ANCHOR_NONE')
        tip.questID = questID or 0
        tip:SetScript('OnTooltipSetQuest', ScrapeQTip)
        tip:SetHyperlink('quest:' .. tip.questID)
    end
   
    local OldQuests, NewQuests = {}, {}
    local f = CreateFrame('frame')
    f:SetScript('OnEvent', function(self, event, ...) return self[event] and self[event](self, ...) end)
   
   
    function f:QUEST_COMPLETED(questID) -- Fake event that fires whenever we complete a quest
                    print('Quest Completed: |cffffff00' .. questID)
        FetchQuestInfo(questID)
    end
   
    -- QUEST_TURNED_IN first argument is quest ID
   
    --function f:QUEST_TURNED_IN(questID) -- Blacklist real quests we've completed
        --RealQuestBlacklist[questID] = true
    --end f:RegisterEvent('QUEST_TURNED_IN')
   
    local eventFired = false
    local throttleRate, timeSince = 0.1, 0
    local function OnUpdate(self, elapsed) -- Limit new quest checks to if CRITERIA_UPDATE has fired within the last x seconds (throttleRate)
        timeSince = timeSince + elapsed
        if timeSince >= throttleRate then
            if eventFired then
                GetQuestsCompleted(NewQuests)
                for questID in pairs(NewQuests) do
                    if not OldQuests[questID] then
                        OldQuests[questID] = true
                        if not RealQuestBlacklist[questID] then -- Ignore real questIDs
                            self:QUEST_COMPLETED(questID)
                        end
                    end
                end
                eventFired = false
            end
            timeSince = 0
        end
    end
   
    function f:PLAYER_REGEN_ENABLED() -- Exit combat
        --self:RegisterEvent('CRITERIA_UPDATE')
        throttleRate = 0.1 -- Out of combat throttle rate
    end f:RegisterEvent('PLAYER_REGEN_ENABLED')
   
    function f:PLAYER_REGEN_DISABLED() -- Enter combat
        --self:UnregisterEvent('CRITERIA_UPDATE')
        throttleRate = 3 -- In-combat throttle rate
    end f:RegisterEvent('PLAYER_REGEN_DISABLED')
   
    function f:CRITERIA_UPDATE()
        eventFired = true
    end -- Don't register this until after PLAYER_LOGIN
   
    function f:PLAYER_LOGIN()
        GetQuestsCompleted(OldQuests)
        local hasQuests = false
        for questID in pairs(OldQuests) do
            hasQuests = true
            break
        end
        if not hasQuests then print('Failed to load completed quests, api function is bugged |cffff00ff(RELOG)|r.') end
        self:RegisterEvent('CRITERIA_UPDATE')
        self:SetScript('OnUpdate', OnUpdate)
    end f:RegisterEvent('PLAYER_LOGIN')
    function f:QUEST_ACCEPTED(index, questID)
        print('QUEST_ACCEPTED', questID)
        -- FetchQuestInfo(questID) -- uncomment if you want it to do the same thing as completed quests
    end f:RegisterEvent('QUEST_ACCEPTED')


It's a part of an old, never released rare scanner addon, I just cut this part for myself so there may be some leftovers here and there (since I don't speak the lua language at all.) On retail this code prints out every accepted and completed quest but on Beta/PTR it says "QUEST_ACCEPTED nil" for the accepted quests and nothing for completed ones.

The error log is:
Code:

Message: Interface\AddOns\raredar\code.lua:94: attempt to call global 'GetQuestsCompleted' (a nil value)
Time: Sat Aug 29 19:23:28 2020
Count: 1
Stack: Interface\AddOns\raredar\code.lua:94: attempt to call global 'GetQuestsCompleted' (a nil value)
[string "@Interface\AddOns\raredar\code.lua"]:94: in function `?'
[string "@Interface\AddOns\raredar\code.lua"]:44: in function <Interface\AddOns\raredar\code.lua:44>

Locals: self = <unnamed> {
 0 = <userdata>
 QUEST_COMPLETED = <function> defined @Interface\AddOns\raredar\code.lua:47
 PLAYER_REGEN_ENABLED = <function> defined @Interface\AddOns\raredar\code.lua:79
 PLAYER_LOGIN = <function> defined @Interface\AddOns\raredar\code.lua:93
 CRITERIA_UPDATE = <function> defined @Interface\AddOns\raredar\code.lua:89
 PLAYER_REGEN_DISABLED = <function> defined @Interface\AddOns\raredar\code.lua:84
 QUEST_ACCEPTED = <function> defined @Interface\AddOns\raredar\code.lua:104
}
(*temporary) = nil
(*temporary) = <table> {
}
(*temporary) = "attempt to call global 'GetQuestsCompleted' (a nil value)"
OldQuests = <table> {
}
OnUpdate = <function> defined @Interface\AddOns\raredar\code.lua:60

I see they've removed the 'GetQuestsCompleted' command but could you please help me if this is replaced with something rather than just deleted?

Also, if no replacements, do you know any addon that does the same thing? Or do you have any idea how to change this code chunk to print IDs for accepted and completed quests in 9.x?

Thank you very much in advance.

Rilgamon 08-29-20 02:05 PM

GetAllCompletedQuestIDs exists in C_QuestLog namespace.

https://www.townlong-yak.com/framexm...umentation.lua

Voxxel 08-31-20 09:37 AM

Thank you,

It works differently, so I see it's not enough just to replace the function's name in the code. Wowpedia says "it now returns quest IDs in a sequentially ordered table instead of associative." - but I don't know what does it mean. ^^

Do you have any idea how to change this chunk of code to make it work again?

Fizzlemizz 08-31-20 10:03 AM

Lua Code:
  1. local completed = C_QuestLog.GetAllCompletedQuestIDs()
  2. for i=1, #completed do
  3.       local id = completed[i]
  4.       -- do whatever with the id
  5. end

Voxxel 09-03-20 02:27 AM

Thank you!


All times are GMT -6. The time now is 07:19 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI