Verubato / framesort

A simple WoW add-on that sorts party, arena, and raid frames.
10 stars 3 forks source link

[Wotlk] Party Pets #4

Closed XyzKangUI closed 1 year ago

XyzKangUI commented 1 year ago

When party pets are enabled in wrath it will not sort because the GetUnits() function apparently does not account for partypet..i or raidpet..i units. So the amount of units will be less than the frames displayed and return on the LayoutRaid() function.

So I edited the GetUnits function to include pet units and it messes up the sorting creating a gap when you sort 'player' to be on the bottom:

What I've noticed are these issues:

  1. When 'displayPets' is disabled (after editing GetUnits) it will detect 1 more unit than frames -> aborting the sorting. I didnt add a check for the raidOptionDisplayPets cvar here :/
  2. When 'displayPets' is enabled (after the edit again) it will sort, but when you sort yourself on the 'bottom' it creates a gap as seen in the picture below (1a)
  3. When 'displayPets' is enabled (idem) you cant sort yourself to the 'middle'. The funny thing is that when you do enable 'middle' it will sort you on the bottom and the pet frame will be attached to you, resulting in the correct behaviour for 'bottom' option. See picture below (1b)

1a. image

1b. image

Verubato commented 1 year ago

Ah right, I've totally missed party pets as they aren't working in retail at all (so people are using addons/weak auras).

I'll start working on fixing this.

Verubato commented 1 year ago

I've just pushed a potential fix for this, but I have limited ability to test this in Wotlk.

Could you try updating to the latest Alpha release and see if it's working? Alternatively you could git clone the repo down if you prefer rather than going through curseforge.

image

XyzKangUI commented 1 year ago

The error is caused by the pet unit, although you seem to have fixed top/middle/bottom sorting when there is a pet frame showing.

Verubato commented 1 year ago

Is the pet unit called party1pet or partypet1?

Verubato commented 1 year ago

Ok cool, so I think there is just 1 bug left I need to fix to get the pets sorted as well then.

XyzKangUI commented 1 year ago

Ok cool, so I think there is just 1 bug left I need to fix to get the pets sorted as well then.

why do you want to sort the pets, they are always attached to the bottom frame. Seems to be the correct behaviour

Verubato commented 1 year ago

I was thinking for example if the sorted party is:

party2 party3 party1 player

Then the pets should be:

partypet2 partypet3 partypet1 playerpet

XyzKangUI commented 1 year ago

I like the commitment, but I dont think that the average player cares about pets position. It are mostly the PvP'ers who like to sort their frames by unit because of their macro's.

Verubato commented 1 year ago

I like the commitment, but I dont think that the average player cares about pets position. It are mostly the PvP'ers who like to sort their frames by unit because of their macro's.

Yeah true, I think I'm so close to having it working so might as well try it anyway.

XyzKangUI commented 1 year ago

I believe that the unit names are just the default game units. From the lock PoV his pet will be "pet" and from the priest PoV the lock's pet will be "partypet1". When you convert the party to a raid it will be "raidpet1" for both the lock and priest, but macro's that use "pet" or "partypet1" still remain intact.

XyzKangUI commented 1 year ago

Although I guess that it answers your question if I tell you that its partypet..index and raidpet..index, unless you are in a party your own pet ("player") will be "pet" and for others it will be "partypetX"

Verubato commented 1 year ago

Yeah I'm guessing this last bug is because i'm doing framesByUnit[partypet1] but actually the frame unit is framesByUnit[party1pet] or something like that. Just trying to think of someway to fix this cleanly at the moment.

XyzKangUI commented 1 year ago

Here it confirms the statement made above: "player": image

from non player pov: image

Verubato commented 1 year ago

Yep as I suspected the frame name is partypet1 where my GetPets() function is returning party1pet even though both are valid unit tokens. Just thinking about how to fix this atm.

XyzKangUI commented 1 year ago

You can use the SecureButton_GetUnit API to get an unit from a raidframe, e.g. SecureButton_GetUnit(CompactRaidFrame7) will return the unit id attached to it.

Verubato commented 1 year ago

I've just pushed a potential fix if you wouldn't mind doing another check? Thanks so much for your help with this, I'm not sure how I could test this on Wotlk other than asking for randoms to join group.

XyzKangUI commented 1 year ago

I made like 4 accounts for wrath PTR servers so that I can do tests on. Pretty solid.

Verubato commented 1 year ago

Oh I see, nice I'll do the same!

XyzKangUI commented 1 year ago

The API mentioned above will gsub and change raid1pet to raidpet1 and so forth, pretty solid. Wouldn't require you to also iterate over units. Could directly convert all frames to their respective unit ids and store that. Anyway it seems to work: when player is top it will set his pet at the top and vice versa when hes bottom sorted his pet will be on the bottom as well.

Verubato commented 1 year ago

Oh ok, that sounds like a better approach, I will update to use SecureButton_GetUnit.

Verubato commented 1 year ago

Alright I think I've got it working well enough for a release. There might be some more refactoring I can do there which I'll investigate later as it seems I can't quite get away from needing the aliases for pets at the moment.

XyzKangUI commented 1 year ago

I am curious if one day you will expand this addon's features to change spacing levels between frames. I am aware you are storing the X and Y values but if it could be used to add an own value on top , e.g. +5 it would be amazing.

Verubato commented 1 year ago

I was actually thinking of adding in that feature! It would be pretty easy to add in some +-offsets. I will work on adding this over the next few days. If you have any other ideas/suggestions in the future as well feel free to let me know :)

Verubato commented 1 year ago

Issue fixed in v3.2.0.