Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional sorting based on raid type #5

Open
spamwax opened this issue Aug 9, 2024 · 9 comments
Open

Conditional sorting based on raid type #5

spamwax opened this issue Aug 9, 2024 · 9 comments

Comments

@spamwax
Copy link

spamwax commented Aug 9, 2024

can you add an option to on run the RaidSortOptions snippet if the raid is not outdoors (in Layout Auto Switch)?

@Krealle
Copy link
Owner

Krealle commented Aug 9, 2024

I've added ONLY_SORT_IN_RAID option for that, but I won't be injecting options into Cell UI.

@Krealle Krealle closed this as completed Aug 9, 2024
@spamwax
Copy link
Author

spamwax commented Aug 9, 2024

Thanks for the update.
What I meant was to have an option to not run the snippet when I am in an outside raid, like the world bosses where players can get added to the raid during combat lock-down.
My understanding is that if the snippet is active, new players added during combat will not show up, which is not ideal because I won't see them to heal.
I am guessing that the new option (ONLY_SORT_IN_RAID) and select(2, IsInInstance()) == "raid" will take care of outside raids.

I also see that you have some WIP options to set a fixed index for the player similar to PartySortOptions.lua.
When this gets implemented, it would ideal for me so I can always place myself in a specific spot (like top-right corner) when doing mythic raids.

@Krealle
Copy link
Owner

Krealle commented Aug 9, 2024

What I meant was to have an option to not run the snippet when I am in an outside raid, like the world bosses where players can get added to the raid during combat lock-down.
I am guessing that the new option (ONLY_SORT_IN_RAID) and select(2, IsInInstance()) == "raid" will take care of outside raids.

With ONLY_SORT_IN_RAID set to true it will no longer sort when you are outside of a raid instance, yea.

My understanding is that if the snippet is active, new players added during combat will not show up, which is not ideal because I won't see them to heal.

This is only if you have USE_NAME_FILTER set to true. This option just uses a method to prevent blizzards default sorts to happen during combat. Downside being that new players won't show up until after combat.

If you don't have it enabled the frames will still be sorted in combat(with blizzards method, not ours) and show new players.

I also see that you have some WIP options to set a fixed index for the player similar to PartySortOptions.lua.
When this gets implemented, it would ideal for me so I can always place myself in a specific spot (like top-right corner) when doing mythic raids.

I'll look into it at some point before TWW raids is all I'm gonna promise for now x)

In the meantime, this is potentially something you could achieve with FrameSort addon.

@spamwax
Copy link
Author

spamwax commented Aug 21, 2024

Krealle, I know you mentioned you will add the fixed index option for TWW raids, but I was messing around with the snippet and added the following to updateRaidFrames function (at the top of function after InCombatLockdown check) to temporarily get it working. I am trying to put myself at spot 16 (with Combine Raid Group options selected):

        local playerIndex
	for _, players in pairs(SORTED_RAID_GROUPS) do
		for i = 1, #players do
			if playerName == players[i].name then
				playerIndex = i
				break
			end
		end
	end
	if playerIndex and SORTED_RAID_GROUPS[0] and #SORTED_RAID_GROUPS[0] >= 16 then
		SORTED_RAID_GROUPS[0][playerIndex], SORTED_RAID_GROUPS[0][16] =
			SORTED_RAID_GROUPS[0][16], SORTED_RAID_GROUPS[0][playerIndex]
	end

do you think it will work?

@Krealle
Copy link
Owner

Krealle commented Aug 21, 2024

Could just pop the player and insert it at the appropriate position.

local playerEntry = table.remove(SORTED_RAID_GROUPS[0], playerIndex)

-- Either floor it to end of array or playerIndex, w/e makes most sense, this is just end of array
local pos = math.min(FIXED_INDEX, (#SORTED_RAID_GROUPS[0] + 1)) 

table.insert(SORTED_RAID_GROUPS[0], pos, playerEntry)

And you can prolly just use ipairs for this

local playerIndex
for idx, player in ipairs(SORTED_RAID_GROUPS[0]) do
  if playerName == player.name then
    playerIndex = idx
    break
  end
end

@Krealle Krealle reopened this Aug 21, 2024
@spamwax
Copy link
Author

spamwax commented Sep 22, 2024

did you get a chance to raid to update the snippets for fixed index? the hack here is working at the beginning of the raid and then it stops until I reload

@Krealle
Copy link
Owner

Krealle commented Sep 23, 2024

it has completely slipped my mind, can take a look at it today

@Krealle
Copy link
Owner

Krealle commented Sep 23, 2024

I've pushed a new version that implements it, let me know if it misbehaves

@spamwax
Copy link
Author

spamwax commented Oct 9, 2024

I tested this today after the latest release of cell which included GROUP_ROSTER_UPDATE changes. It works but it is not reliable and requires reload. Once I think it even changed mid-fight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants