Thread Tools Display Modes
04-23-23, 06:31 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Access Player Statistics

I am trying to access the players statistics data as shown in the achievement frame statistics tab.

I assume there is a table of statistics yet I have not been able to find it.

I have looked in the StatsFrame.xml and StatsFrame.lua files but can see nothing that defines the statistics table.

How do I find the appropriate statistics table?
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
04-23-23, 09:48 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Are you meaning, how to get achievement information?
and GetAchievementCriteriaInfo

In Blizzard_AchievementUI.lua probably start at:
Code:
function AchievementStatTemplateMixin:Init(elementData)
You'll see where it's setting header text (if elementData.header) else the stat name text and quantity.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 04-23-23 at 10:12 PM.
  Reply With Quote
04-24-23, 05:55 PM   #3
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Heya Fizzlemizz

I don't need the achievements, I want the player stats, such as how many deaths, items consumed, flight paths taken, etc.

These stats are displayed in the Statistic Tab in the achievement UI.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
04-24-23, 07:33 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,322
Might want to check out GetStatistic(). GetStatisticsCategoryList() appears to return a list of statistic CategoryIDs that can be enumerated through with the generic achievement functions to find the AchievementID you want.

For example:
Lua Code:
  1. for _,catid in ipairs(GetStatisticsCategoryList()) do
  2.     for i=1,GetCategoryNumAchievements(catid,true) do
  3.         local achid,achname=GetAchievementInfo(catid,i);
  4.         print(("(%d) %s: %d"):format(achid,achname,GetStatistic(achid)));
  5.     end
  6. end

This prints the entire list of statistics, their related AchievementID for later tracking, and the current statistic value. It takes a few seconds to complete.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 04-24-23 at 08:18 PM.
  Reply With Quote
04-24-23, 08:11 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
The AchievementStatTemplateMixin:Init function is called to fill each row of the stats list.

The GetAchievementInfo function returns information including the stat name, then either GetStatistic or GetAchievementCriteriaInfo depending.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
04-25-23, 12:49 AM   #6
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Fizzlemizz and SDPhantom

Thanks for your help, your answers make sense and the code provided absolutely works.

Cheers
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Access Player Statistics

Thread Tools
Display Modes

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