Thread Tools Display Modes
04-28-24, 09:41 AM   #1
Sharpedge
A Theradrim Guardian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 66
Need some more help....

I now have ran into a small issue. In my PvP Stats window it will display the Conquest Cap. What is showing is the "current" conquest and not the total towards the cap. Can anyone shed some light on this please?

Code:
local function UpdatePvPStatsFrame()
    if not IsAddOnLoaded("Blizzard_PVPUI") then
        LoadAddOn("Blizzard_PVPUI")
    end

        C_Timer.After(2, function()  -- Delay for 2 seconds to ensure the AddOn is fully loaded and ready
        local conquestInfo = C_CurrencyInfo.GetCurrencyInfo(Constants.CurrencyConsts.CONQUEST_CURRENCY_ID)
        local weeklyProgress = C_WeeklyRewards.GetConquestWeeklyProgress()
        local honorInfo = C_CurrencyInfo.GetCurrencyInfo(HONOR_CURRENCY_ID)
        local lifetimeHonorableKills, _ = GetPVPLifetimeStats()
        local honorLevel = UnitHonorLevel("player")
        local currentConquestPoints = conquestInfo.quantity
        local currencyInfo = C_CurrencyInfo.GetCurrencyInfo(Constants.CurrencyConsts.CONQUEST_CURRENCY_ID);
        local conquestCap = currencyInfo.maxQuantity;  -- Dynamically fetch the current conquest cap

        if not weeklyCap or weeklyCap == 0 then
            weeklyCap = 1350  
        end

        local rating = GetPersonalRatedInfo(SOLO_SHUFFLE_INDEX)
        local soloShuffleRating = rating or "N/A"

        pvpStatsFrame.honorableKillsValue:SetText(lifetimeHonorableKills)
        pvpStatsFrame.conquestValue:SetText(currentConquestPoints)
        pvpStatsFrame.conquestCapValue:SetText(currentConquestPoints .. " / " .. conquestCap)
        pvpStatsFrame.honorValue:SetText(honorInfo.quantity)
        pvpStatsFrame.honorLevelValue:SetText(honorLevel)
        pvpStatsFrame.soloShuffleRatingValue:SetText(soloShuffleRating)

        local canUseRated = C_PvP.CanPlayerUseRatedPVPUI()
        local canUsePremade = C_LFGInfo.CanPlayerUsePremadeGroup()

        if canUseRated then
            PVPQueueFrame_SetCategoryButtonState(PVPQueueFrame.CategoryButton2, true)
            PVPQueueFrame.CategoryButton2.tooltip = nil
        end

        if canUsePremade then
            PVPQueueFrame_SetCategoryButtonState(PVPQueueFrame.CategoryButton3, true)
            PVPQueueFrame.CategoryButton3.tooltip = nil
        end
    end)
end

pvpStatsFrame:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
pvpStatsFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
pvpStatsFrame:RegisterEvent("WEEKLY_REWARDS_UPDATE")
pvpStatsFrame:SetScript("OnEvent", UpdatePvPStatsFrame)
pvpStatsFrame:SetScript("OnShow", UpdatePvPStatsFrame)
  Reply With Quote
04-28-24, 10:13 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,938
It looks like it could be the max for that stage - like maxXP per level etc.

Here's the block of code where they use the value and that's what makes me think that, but maybe your PvP knowledge will understand it more.

https://github.com/Gethe/wow-ui-sour...VPUI.lua#L1977
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
04-28-24, 10:27 AM   #3
Sharpedge
A Theradrim Guardian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 66
I tried this and it shows as 0 earned for the week.....I even added debug print and it shows o. I'll have to keep at it. But thank you for the reference.

Code:
local function UpdatePvPStatsFrame()
    if not IsAddOnLoaded("Blizzard_PVPUI") then
        LoadAddOn("Blizzard_PVPUI")
    end

    C_Timer.After(2, function()  -- Delay for 2 seconds to ensure the AddOn is fully loaded and ready
        local conquestInfo = C_CurrencyInfo.GetCurrencyInfo(Constants.CurrencyConsts.CONQUEST_CURRENCY_ID)
        local weeklyProgress = C_WeeklyRewards.GetConquestWeeklyProgress()
        local honorInfo = C_CurrencyInfo.GetCurrencyInfo(HONOR_CURRENCY_ID)
        local lifetimeHonorableKills, _ = GetPVPLifetimeStats()
        local honorLevel = UnitHonorLevel("player")
        local currentConquestPoints = conquestInfo.quantity
        local conquestCap = conquestInfo.maxQuantity;  -- Dynamically fetch the current conquest cap
        local earnedThisWeek = conquestInfo.quantityEarnedThisWeek  -- Total conquest points earned this week
		
		print("Current Conquest Points: ", conquestInfo.quantity)
        print("Earned This Week: ", conquestInfo.quantityEarnedThisWeek)
        print("Weekly Cap: ", conquestInfo.maxQuantity)

        if not conquestCap or conquestCap == 0 then
            conquestCap = 1350  
        end

        local rating = GetPersonalRatedInfo(SOLO_SHUFFLE_INDEX)
        local soloShuffleRating = rating or "N/A"

        -- Display data
        pvpStatsFrame.honorableKillsValue:SetText(lifetimeHonorableKills)
        pvpStatsFrame.conquestValue:SetText(currentConquestPoints)
        pvpStatsFrame.conquestCapValue:SetText(earnedThisWeek .. " / " .. conquestCap)
        pvpStatsFrame.honorValue:SetText(honorInfo.quantity)
        pvpStatsFrame.honorLevelValue:SetText(honorLevel)
        pvpStatsFrame.soloShuffleRatingValue:SetText(soloShuffleRating)

        -- Adjust buttons based on PvP availability
        local canUseRated = C_PvP.CanPlayerUseRatedPVPUI()
        local canUsePremade = C_LFGInfo.CanPlayerUsePremadeGroup()

        if canUseRated then
            PVPQueueFrame_SetCategoryButtonState(PVPQueueFrame.CategoryButton2, true)
            PVPQueueFrame.CategoryButton2.tooltip = nil
        end

        if canUsePremade then
            PVPQueueFrame_SetCategoryButtonState(PVPQueueFrame.CategoryButton3, true)
            PVPQueueFrame.CategoryButton3.tooltip = nil
        end
    end)
end

-- Registering events to update PvP stats when relevant data changes
pvpStatsFrame:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
pvpStatsFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
pvpStatsFrame:RegisterEvent("WEEKLY_REWARDS_UPDATE")
pvpStatsFrame:SetScript("OnEvent", UpdatePvPStatsFrame)
pvpStatsFrame:SetScript("OnShow", UpdatePvPStatsFrame)
EDIT:
I forgot to add this
Code:
local progress = math.min(currencyInfo.totalEarned, maxProgress);
....so it's all good now.

Last edited by Sharpedge : 04-28-24 at 01:53 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Need some more help....


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off