Add achievement sniffer
This commit is contained in:
13
FreshShit/AchievementSniffer/event.lua
Normal file
13
FreshShit/AchievementSniffer/event.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
--- PLAYER_TARGET_CHANGED
|
||||||
|
function()
|
||||||
|
local targetGuid = UnitGUID("target")
|
||||||
|
if not targetGuid then return end
|
||||||
|
if not string.match(targetGuid, "Player") then return end
|
||||||
|
local targetName = UnitName("target")
|
||||||
|
if not aura_env.config.recsan and WeakAurasSaved.Cyka.AchievementSniffer[targetName] then return end
|
||||||
|
-- aura_env.Scan(targetName)
|
||||||
|
local canInspect = CanInspect("target", true)
|
||||||
|
if canInspect then
|
||||||
|
SetAchievementComparisonUnit("target")
|
||||||
|
end
|
||||||
|
end
|
9
FreshShit/AchievementSniffer/event2.lua
Normal file
9
FreshShit/AchievementSniffer/event2.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
--- INSPECT_ACHIEVEMENT_READY
|
||||||
|
function()
|
||||||
|
local targetGuid = UnitGUID("target")
|
||||||
|
if not targetGuid then return end
|
||||||
|
if not string.match(targetGuid, "Player") then return end
|
||||||
|
local targetName = UnitName("target")
|
||||||
|
if not aura_env.config.recsan and WeakAurasSaved.Cyka.AchievementSniffer[targetName] then return end
|
||||||
|
aura_env.Scan(targetName)
|
||||||
|
end
|
135
FreshShit/AchievementSniffer/info
Normal file
135
FreshShit/AchievementSniffer/info
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
main achievement frame is AchievementFrame
|
||||||
|
The tabs are
|
||||||
|
AchievementFrameTab1 2 3
|
||||||
|
First is "Achievements", 2nd guild and 3rd statistics
|
||||||
|
Statistics might also be useful but that would be hard to tell, for now
|
||||||
|
|
||||||
|
AchievementFrame > AchievementFrameComparison
|
||||||
|
The comparison frame is AchievementFrameComparisonContainer (N/A)
|
||||||
|
Scroll buttons are AchievementFrameComparisonContainerScrollBarScrollDownButton (scrollDown) and AchievementFrameComparisonContainerScrollBarScrollUpButton (scrollUp)
|
||||||
|
|
||||||
|
The actual individual achievement data is in
|
||||||
|
AchievementFrameComparisonContainerScrollChild (ScrollChild) (not a typo)
|
||||||
|
It has achievements listed as:
|
||||||
|
AchievementFrameComparisonContainerButton1 .. 10
|
||||||
|
Always seems to be 10
|
||||||
|
Scrolling should move 1 new into the view and 1 old out of view
|
||||||
|
|
||||||
|
The buttons themselves represent one row (one achievement)
|
||||||
|
Our achievement is found in
|
||||||
|
AchievementFrameComparisonContainerButton1Player (player)
|
||||||
|
AchievementFrameComparisonContainerButton1Friend (friend)
|
||||||
|
Ours has names while friend has no names
|
||||||
|
So we will have to use names from Player and dates from Friend
|
||||||
|
|
||||||
|
Name, title, is under AchievementFrameComparisonContainerButton1PlayerLabel (label)
|
||||||
|
Friend date achieved is under AchievementFrameComparisonContainerButton1FriendStatus (status)
|
||||||
|
|
||||||
|
We can also get achievement ID from the button frame
|
||||||
|
AchievementFrameComparisonContainerButton1P under the "id" property
|
||||||
|
|
||||||
|
Categories are under
|
||||||
|
AchievementFrameCategories (N/A) > AchievementFrameCategoriesContainer (N/A)
|
||||||
|
|
||||||
|
Structure is the same as AchievementFrameComparisonContainer
|
||||||
|
We have scroll child and scroll up/down
|
||||||
|
Although there's no scrolling so I'm not sure what we scroll
|
||||||
|
Not true - the buttons are categories to be expanded into
|
||||||
|
And clicking one does expand
|
||||||
|
So after we click we have to recalculate their positions
|
||||||
|
|
||||||
|
In AchievementFrameCategoriesContainer we have many buttons which correspond to categories
|
||||||
|
The best way of browsing them that I can see is reading the title of each
|
||||||
|
Since we are only interested in a few
|
||||||
|
AchievementFrameCategoriesContainerButton1 .. n
|
||||||
|
|
||||||
|
The title is the same structure as the achievement title
|
||||||
|
AchievementFrameCategoriesContainerButton1Label (label)
|
||||||
|
Under each button of course
|
||||||
|
|
||||||
|
We can also get the category ID and name from the button frame
|
||||||
|
AchievementFrameCategoriesContainerButton1
|
||||||
|
Under "categoryID" and "name"
|
||||||
|
|
||||||
|
|
||||||
|
[11:20 PM] [Virag's DT]: 23:20:04 INSPECT_ACHIEVEMENT_READY - (2) table: 000001AF07021540
|
||||||
|
Fires when the achievement frame is ready
|
||||||
|
Argument #2 is the GUID of the player
|
||||||
|
None is fired when the frame is closed...
|
||||||
|
I guess we'll have to check each frame we go over
|
||||||
|
|
||||||
|
See
|
||||||
|
canInspect = CanInspect("unit", showError)
|
||||||
|
Arguments:
|
||||||
|
unit - A unit to inspect (string, unitID)
|
||||||
|
showError - True to fire a UI_ERROR_MESSAGE event (causing the default UI to display an error message) if the unit cannot be inspected; otherwise false (boolean)
|
||||||
|
Returns:
|
||||||
|
canInspect - 1 if the unit can be inspected; otherwise nil (1nil)
|
||||||
|
|
||||||
|
Actually nevermind, this seems much easier and simpler:
|
||||||
|
completed, month, day, year = GetAchievementComparisonInfo(achievementID)
|
||||||
|
completed
|
||||||
|
boolean - Returns true/false depending on whether the unit has completed the achievement or not.
|
||||||
|
month
|
||||||
|
number - Month in which the unit has completed the achievement. Returns nil if completed is false.
|
||||||
|
day
|
||||||
|
number - Day of the month in which the unit has completed the achievement. Returns nil if completed is false.
|
||||||
|
year
|
||||||
|
number - Year (two digits, 21st century is assumed) in which the unit has completed the achievement. Returns nil if completed is false.
|
||||||
|
Only accurate after the after SetAchievementComparisonUnit is called and the INSPECT_ACHIEVEMENT_READY event has fired.
|
||||||
|
|
||||||
|
success = SetAchievementComparisonUnit(unit)
|
||||||
|
success
|
||||||
|
boolean - Returns true/false depending on whether the unit is valid.
|
||||||
|
-> INSPECT_ACHIEVEMENT_READY
|
||||||
|
|
||||||
|
522 -- Somebody Likes Me
|
||||||
|
523 -- 5 Exalted Reputations
|
||||||
|
524 -- 10 Exalted Reputations
|
||||||
|
521 -- 15 Exalted Reputations
|
||||||
|
520 -- 20 Exalted Reputations
|
||||||
|
519 -- 25 Exalted Reputations
|
||||||
|
518 -- 30 Exalted Reputations
|
||||||
|
1556 -- 25 Fish
|
||||||
|
1557 -- 50 Fish
|
||||||
|
1558 -- 100 Fish
|
||||||
|
238 -- An Honorable Kill
|
||||||
|
513 -- 100 Honorable Kills
|
||||||
|
515 -- 500 Honorable Kills
|
||||||
|
516 -- 1000 Honorable Kills
|
||||||
|
512 -- 5000 Honorable Kills
|
||||||
|
509 -- 10000 Honorable Kills
|
||||||
|
239 -- 25000 Honorable Kills
|
||||||
|
503 -- 50 Quests Completed
|
||||||
|
504 -- 100 Quests Completed
|
||||||
|
505 -- 250 Quests Completed
|
||||||
|
506 -- 500 Quests Completed
|
||||||
|
507 -- 1000 Quests Completed
|
||||||
|
1017 -- Can I Keep Him?
|
||||||
|
15 -- Plenty of Pets
|
||||||
|
1248 -- Plethora of Pets
|
||||||
|
1250 -- Shop Smart, Shop Pet...Smart
|
||||||
|
2516 -- Lil' Game Hunter
|
||||||
|
5876 -- Petting Zoo
|
||||||
|
11188 -- Broken Isles Explorer
|
||||||
|
11190 -- Broken Isles Pathfinder, Part One
|
||||||
|
11157 -- Loremaster of Legion
|
||||||
|
10763 -- Azsuna Matata
|
||||||
|
10790 -- Vrykul Story, Bro
|
||||||
|
11124 -- Good Suramaritan
|
||||||
|
10059 -- Ain't No Mountain High Enough
|
||||||
|
10698 -- That's Val'sharah Folks!
|
||||||
|
10672 -- Broken Isles Diplomat
|
||||||
|
10665 -- Explore Azsuna
|
||||||
|
10666 -- Explore Val'sharah
|
||||||
|
10667 -- Explore Highmountain
|
||||||
|
10668 -- Explore Stormheim
|
||||||
|
10669 -- Explore Suramar
|
||||||
|
12069 -- Explore Argus
|
||||||
|
2141 -- Stable Keeper
|
||||||
|
2142 -- Filling Up The Barn
|
||||||
|
2143 -- Leading the Cavalry
|
||||||
|
7382 -- Dynamic Duo
|
||||||
|
7383 -- Terrific Trio
|
||||||
|
7384 -- Quintessential Quintet
|
||||||
|
245 -- That Takes Class
|
88
FreshShit/AchievementSniffer/init.lua
Normal file
88
FreshShit/AchievementSniffer/init.lua
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
---@class aura_env
|
||||||
|
---@field achievements table<number, string>
|
||||||
|
---@field Scan fun(playerName: string)
|
||||||
|
|
||||||
|
---@class WeakAurasSaved
|
||||||
|
---@field Cyka table<string, table<string, table<number, string>>>
|
||||||
|
|
||||||
|
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
|
||||||
|
if not WeakAurasSaved.Cyka.AchievementSniffer then WeakAurasSaved.Cyka.AchievementSniffer = {} end
|
||||||
|
|
||||||
|
aura_env.achievements = {
|
||||||
|
522, -- Somebody Likes Me
|
||||||
|
523, -- 5 Exalted Reputations
|
||||||
|
524, -- 10 Exalted Reputations
|
||||||
|
521, -- 15 Exalted Reputations
|
||||||
|
520, -- 20 Exalted Reputations
|
||||||
|
519, -- 25 Exalted Reputations
|
||||||
|
518, -- 30 Exalted Reputations
|
||||||
|
1556, -- 25 Fish
|
||||||
|
1557, -- 50 Fish
|
||||||
|
1558, -- 100 Fish
|
||||||
|
238, -- An Honorable Kill
|
||||||
|
513, -- 100 Honorable Kills
|
||||||
|
515, -- 500 Honorable Kills
|
||||||
|
516, -- 1000 Honorable Kills
|
||||||
|
512, -- 5000 Honorable Kills
|
||||||
|
509, -- 10000 Honorable Kills
|
||||||
|
239, -- 25000 Honorable Kills
|
||||||
|
503, -- 50 Quests Completed
|
||||||
|
504, -- 100 Quests Completed
|
||||||
|
505, -- 250 Quests Completed
|
||||||
|
506, -- 500 Quests Completed
|
||||||
|
507, -- 1000 Quests Completed
|
||||||
|
1017, -- Can I Keep Him?
|
||||||
|
15, -- Plenty of Pets
|
||||||
|
1248, -- Plethora of Pets
|
||||||
|
1250, -- Shop Smart, Shop Pet...Smart
|
||||||
|
2516, -- Lil' Game Hunter
|
||||||
|
5876, -- Petting Zoo
|
||||||
|
11188, -- Broken Isles Explorer
|
||||||
|
11190, -- Broken Isles Pathfinder, Part One
|
||||||
|
11157, -- Loremaster of Legion
|
||||||
|
10763, -- Azsuna Matata
|
||||||
|
10790, -- Vrykul Story, Bro
|
||||||
|
11124, -- Good Suramaritan
|
||||||
|
10059, -- Ain't No Mountain High Enough
|
||||||
|
10698, -- That's Val'sharah Folks!
|
||||||
|
10672, -- Broken Isles Diplomat
|
||||||
|
10665, -- Explore Azsuna
|
||||||
|
10666, -- Explore Val'sharah
|
||||||
|
10667, -- Explore Highmountain
|
||||||
|
10668, -- Explore Stormheim
|
||||||
|
10669, -- Explore Suramar
|
||||||
|
12069, -- Explore Argus
|
||||||
|
2141, -- Stable Keeper
|
||||||
|
2142, -- Filling Up The Barn
|
||||||
|
2143, -- Leading the Cavalry
|
||||||
|
7382, -- Dynamic Duo
|
||||||
|
7383, -- Terrific Trio
|
||||||
|
7384, -- Quintessential Quintet
|
||||||
|
245, -- That Takes Class
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param playerName string
|
||||||
|
aura_env.Scan = function(playerName)
|
||||||
|
WeakAurasSaved.Cyka.AchievementSniffer[playerName] = {}
|
||||||
|
for i, aid in ipairs(aura_env.achievements) do
|
||||||
|
local completed, month, day, year = GetAchievementComparisonInfo(aid)
|
||||||
|
local date = ""
|
||||||
|
|
||||||
|
if completed then
|
||||||
|
---@type string
|
||||||
|
local yearstr = "" .. year
|
||||||
|
if year < 100 then yearstr = "20" .. year end
|
||||||
|
|
||||||
|
date = string.format("%04d-%02d-%02d", yearstr, month, day)
|
||||||
|
end
|
||||||
|
|
||||||
|
local data = {
|
||||||
|
id = aid,
|
||||||
|
date = date,
|
||||||
|
completed = completed,
|
||||||
|
}
|
||||||
|
WeakAurasSaved.Cyka.AchievementSniffer[playerName][aid] = data
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--/run WeakAurasSaved.Cyka.AchievementSniffer = {}
|
9
FreshShit/AchievementSniffer/scratch.lua
Normal file
9
FreshShit/AchievementSniffer/scratch.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
local year = 20
|
||||||
|
local month = 7
|
||||||
|
local day = 12
|
||||||
|
|
||||||
|
if year < 100 then
|
||||||
|
year = "20" .. year
|
||||||
|
end
|
||||||
|
|
||||||
|
print(string.format("%4d-%02d-%02d", year, month, day))
|
Reference in New Issue
Block a user