valkyrnstudios / RankSentinel

MIT License
4 stars 2 forks source link

Support pet low rank notifications #30

Closed SabreValkyrn closed 2 years ago

SabreValkyrn commented 2 years ago

https://www.wow-petopia.com/classic_bc/abilities.php

Some abilities are tied to hunters themselves so already a part of #7's work.

Also need to map current pet to owner.

SabreValkyrn commented 2 years ago

Potentially helpful notes

https://github.com/tomrus88/BlizzardInterfaceCode/blob/e625f1290f7fde3a00ac72a79d55d165f348dec9/Interface/FrameXML/TargetFrame.lua#L873-L887

The GSheet seems to already have pet abilities so data curation is done https://docs.google.com/spreadsheets/d/1jtx1WyfChzACzh0WBWANtrqkRtS3D-zPWqs3eOnyVvY/edit#gid=0

https://wowpedia.fandom.com/wiki/UnitId "raidpetN" "partypetN"

SabreValkyrn commented 2 years ago

Taking a look at pet support more and it's... complicated.

I was making some progress on figuring out if a pet was in group, and almost got pet->hunter figured out for whispers.

However, the spells seems to differ.

Dash (pet learned) GSheet has

Hunter | Dash | 30 | 1 | 23100
Hunter | Dash | 40 | 2 | 23111
Hunter | Dash | 50 | 3 | 23112

but when I cast Dash Rank 3, SpellID 23110 hits the combat log.

Petopia doesn't seem to reference spellIDs https://www.wow-petopia.com/classic_bc/abilities.php#dash3

Similarly with Growl (hunter trainer)

Hunter | Growl | 1 | 1 | 1853
Hunter | Growl | 10 | 2 | 14922
Hunter | Growl | 20 | 3 | 14923
Hunter | Growl | 30 | 4 | 14924
Hunter | Growl | 40 | 5 | 14925
Hunter | Growl | 50 | 6 | 14926
Hunter | Growl | 60 | 7 | 14927
Hunter | Growl | 70 | 8 | 27344

My lvl 57 pet cast Growl Rank 6, which hit combat log as SpellID 14920

So I think all the pet data needs revisited, but not yet sure how to curate the data accurately without trying to train and use every rank along the way.

SabreValkyrn commented 2 years ago

From MSBTParser.lua

                    -- Loop through all of the group members and add their pets and pet's class to the maps.
                local unitPrefix = IsInRaid() and "raidpet" or "partypet"
                local numGroupMembers = GetNumGroupMembers()
                for i = 1, numGroupMembers do
                    local unitID = unitPrefix .. i
                    if (UnitExists(unitID)) then
                        -- XXX: This call is returning nil for party members in certain circumstances - need to debug further.
                        local guid = UnitGUID(unitID)
                        if (guid ~= nil) then
                            petMap[guid] = unitID
                            if (not classMap[guid]) then _, classMap[guid] = UnitClass(unitID) end
                            classTimes[guid] = nil
                        end
                    end
                end -- Loop through group members
                -- Add the player's pet and its class if there is one. Treat vehicles as the player instead of a pet.
                if (petName) then
                    local unitID = "pet"
                    local guid = UnitGUID(unitID)
                    if (guid == UnitGUID("vehicle")) then unitID = "player" end
                    petMap[guid] = unitID
                    if (not classMap[guid]) then _, classMap[guid] = UnitClass(unitID) end
                    classTimes[guid] = nil
                end             
SabreValkyrn commented 2 years ago

Looks like https://tbc.wowhead.com/spells/pet-abilities has the properly referenced abilities for pets, so should be a matter of scraping that akin to the class abilities.

Gogo processed list

ID Level Name Rank
33698 50 Anguish 1
33699 60 Anguish 2
33700 69 Anguish 3
17253 1 Bite 1
17255 8 Bite 2
17256 16 Bite 3
17257 24 Bite 4
17258 32 Bite 5
17259 40 Bite 6
17260 48 Bite 7
17261 56 Bite 8
27050 64 Bite 9
6307 4 Blood Pact 1
7804 14 Blood Pact 2
7805 26 Blood Pact 3
11766 38 Blood Pact 4
11767 50 Blood Pact 5
27268 62 Blood Pact 6
7371 1 Charge 1
26177 12 Charge 2
26178 24 Charge 3
26179 36 Charge 4
26201 48 Charge 5
27685 60 Charge 6
16827 1 Claw 1
16828 8 Claw 2
16829 16 Claw 3
16830 24 Claw 4
16831 32 Claw 5
16832 40 Claw 6
3010 48 Claw 7
3009 56 Claw 8
27049 64 Claw 9
30213 50 Cleave 1
30219 60 Cleave 2
30223 68 Cleave 3
17767 18 Consume Shadows 1
17850 26 Consume Shadows 2
17851 34 Consume Shadows 3
17852 42 Consume Shadows 4
17853 50 Consume Shadows 5
17854 58 Consume Shadows 6
27272 66 Consume Shadows 7
1742 5 Cower 1
1753 15 Cower 2
1754 25 Cower 3
1755 35 Cower 4
1756 45 Cower 5
16697 55 Cower 6
27048 65 Cower 7
23099 30 Dash 1
23109 40 Dash 2
23110 50 Dash 3
19505 30 Devour Magic 1
19731 38 Devour Magic 2
19734 46 Devour Magic 3
19736 54 Devour Magic 4
27276 62 Devour Magic 5
27277 70 Devour Magic 6
23145 30 Dive 1
23147 40 Dive 2
23148 50 Dive 3
34889 1 Fire Breath 1
35323 60 Fire Breath 2
2947 14 Fire Shield 1
8316 24 Fire Shield 2
8317 34 Fire Shield 3
11770 44 Fire Shield 4
11771 54 Fire Shield 5
27269 64 Fire Shield 6
3110 1 Firebolt 1
7799 8 Firebolt 2
7800 18 Firebolt 3
7801 28 Firebolt 4
7802 38 Firebolt 5
11762 48 Firebolt 6
11763 58 Firebolt 7
27267 68 Firebolt 8
25027 0 Flamethrower 1
24604 10 Furious Howl 1
24605 24 Furious Howl 2
24603 40 Furious Howl 3
24597 56 Furious Howl 4
35290 1 Gore 1
35291 8 Gore 2
35292 16 Gore 3
35293 24 Gore 4
35294 32 Gore 5
35295 40 Gore 6
35296 48 Gore 7
35297 56 Gore 8
35298 63 Gore 9
2649 1 Growl 1
14916 10 Growl 2
14917 20 Growl 3
14918 30 Growl 4
14919 40 Growl 5
14920 50 Growl 6
14921 60 Growl 7
27047 70 Growl 8
30151 52 Intercept 1
30194 61 Intercept 2
30198 69 Intercept 3
7814 20 Lash of Pain 1
7815 28 Lash of Pain 2
7816 36 Lash of Pain 3
11778 44 Lash of Pain 4
11779 52 Lash of Pain 5
11780 60 Lash of Pain 6
27274 68 Lash of Pain 7
7870 32 Lesser Invisibility 1
24844 1 Lightning Breath 1
25008 12 Lightning Breath 2
25009 24 Lightning Breath 3
25010 36 Lightning Breath 4
25011 48 Lightning Breath 5
25012 60 Lightning Breath 6
19480 42 Paranoia 1
4511 12 Phase Shift 1
35387 15 Poison Spit 1
35389 45 Poison Spit 2
35392 60 Poison Spit 3
24450 30 Prowl 1
24452 40 Prowl 2
24453 50 Prowl 3
7812 16 Sacrifice 1
19438 24 Sacrifice 2
19440 32 Sacrifice 3
19441 40 Sacrifice 4
19442 48 Sacrifice 5
19443 56 Sacrifice 6
27273 64 Sacrifice 7
24640 8 Scorpid Poison 1
24583 24 Scorpid Poison 2
24586 40 Scorpid Poison 3
24587 56 Scorpid Poison 4
27060 64 Scorpid Poison 5
24423 8 Screech 1
24577 24 Screech 2
24578 48 Screech 3
24579 56 Screech 4
27051 64 Screech 5
6358 26 Seduction 1
26064 20 Shell Shield 1
6360 22 Soothing Kiss 1
7813 34 Soothing Kiss 2
11784 46 Soothing Kiss 3
11785 58 Soothing Kiss 4
27275 70 Soothing Kiss 5
19244 36 Spell Lock 1
19647 52 Spell Lock 2
17735 24 Suffering 1
17750 36 Suffering 2
17751 48 Suffering 3
17752 60 Suffering 4
27271 63 Suffering 5
33701 69 Suffering 6
19478 32 Tainted Blood 1
19655 40 Tainted Blood 2
19656 48 Tainted Blood 3
19660 56 Tainted Blood 4
27280 64 Tainted Blood 5
26090 30 Thunderstomp 1
26187 40 Thunderstomp 2
26188 50 Thunderstomp 3
27063 60 Thunderstomp 4
3716 10 Torment 1
7809 20 Torment 2
7810 30 Torment 3
7811 40 Torment 4
11774 50 Torment 5
11775 60 Torment 6
27270 70 Torment 7
35346 60 Warp 1
SabreValkyrn commented 2 years ago

Current code works but is a bit brutish, these might be useful.

https://wowpedia.fandom.com/wiki/API_UnitInParty https://wowpedia.fandom.com/wiki/API_UnitInRaid https://wowpedia.fandom.com/wiki/API_UnitPlayerOrPetInParty

SabreValkyrn commented 2 years ago

Looks like cache will also needs tweaked, the owner lookup and maxRank cache will be invalid everytime the pet is summoned.

https://wowpedia.fandom.com/wiki/GUID

For Pet GUIDs the spawnUID component encodes a unique identifier in the low 32 bits, similar to Player GUIDs, and a wrapping counter in the upper 8 bits representing the number of times the pet has been summoned.

local guid = UnitGUID("target")
local unitType, _, _, _, _, _, spawnUID = strsplit("-", guid)

if unitType == "Pet" then
    local petUID = string.sub(spawnUID, 3)
    local spawnIndex = tonumber(string.sub(spawnUID, 1, 2), 16)

    print(guid)
    print("Unique Pet ID:", petUID)
    print("Spawn index:", spawnIndex)
end

> "Pet-0-4234-0-6610-165189-0202F859E9"
> "Unique Pet ID:", "02F859E9"
> "Spawn index:", 2
SabreValkyrn commented 2 years ago

Tested pets with Gogo this morning, looks good.

Released as v1.4.0