Thread Tools Display Modes
09-10-12, 06:42 AM   #1
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Find raid member roles, effectively

Ok so, I've been requested by a friend to create an addon for him to simply automark his arena partners once they've gotten into arena.

It seems currently even with forming a raid and marking individuals before joining the arena clears those raid marks once they join.

Marking them by name is fairly easy however he wanted to know if it were possible to set marks by their talents and their talent role, without having them to set their own roles.

After looking through some of the blizzard inspect coding and some other addons like tiptac talents, the only usable solution would be to build a table of inspected group members and somehow queue up each raid member for inspection that doesn't have their role set already. Due to the inspection restrictions placed after the whole GearScore fad this becomes a bit of an issue.

So here is what I have so far in terms of setting roles for the raid automatically:
Lua Code:
  1. local function SetMarksByTalents()
  2.     if IsInRaid() then --and inArena then
  3.         local index = 0
  4.         while index =< 40 do
  5.            
  6.             local unitID    = "raid"..index
  7.             local name      = UnitName(unitID)
  8.             local _,class   = UnitClass(unitID)
  9.             local level     = UnitLevel(unitID)
  10.             local spec      = nil
  11.             local currentRole = UnitGroupRolesAssigned(unitID)
  12.            
  13.             if name and class and level and not AAM_TALENTS[name] then
  14.                 if level < 10 or class == "ROGUE" or class == "HUNTER" or class == "MAGE" or class == "WARLOCK" then
  15.                     spec = "DAMAGER"
  16.                 elseif currentRole and currentRole ~= "NONE" then
  17.                     spec = currentRole
  18.                 else
  19.                     -- Use method for finding raid member role through inspection
  20.                     -- Possibly add to a table that's being cleared through OnUpdate parsing players that appear in that list.
  21.                     -- Register for INSPECT_READY and set the next indexed name for inspection.
  22.                     --if CanInspect(unitID) and (not IsInspectFrameOpen()) then
  23.                         --NotifyInspect(unitID)
  24.                     --end
  25.                 end
  26.                 if spec then
  27.                     AAM_TALENTS[name] = spec
  28.                     UnitSetRole(unitID, spec)
  29.                 end
  30.             end
  31.            
  32.             local index     = index +1
  33.             local unitID    = "raid"..index
  34.         end
  35.     end
  36. end

Last edited by suicidalkatt : 09-10-12 at 07:12 AM.
  Reply With Quote
09-10-12, 07:25 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Take a look at how I do it in Symbiotic:
https://github.com/p3lim/Symbiotic/b...ic.lua#L95-113

I initate the request at line 70.
  Reply With Quote
09-10-12, 07:28 AM   #3
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Use LibGroupInSpecT I'd say so there's one point of failure for this type of task.
  Reply With Quote
09-10-12, 07:49 AM   #4
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by p3lim
Take a look at how I do it in Symbiotic:
https://github.com/p3lim/Symbiotic/b...ic.lua#L95-113

I initate the request at line 70.
About the same method as TipTac uses.

Originally Posted by Dridzt View Post
Use LibGroupInSpecT I'd say so there's one point of failure for this type of task.
I like this. They did their homework on it. I was even considering a lot of what they already did with stale unit id information. Creating a mirror of this with more compact code would probably not be as accurate.

I'd still like to see if I could reproduce a lot of their stuff with perhaps just 'raid1-5' although including the library wouldn't be very heavy on the addon.
  Reply With Quote
09-10-12, 11:06 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by suicidalkatt View Post
I'd still like to see if I could reproduce a lot of their stuff with perhaps just 'raid1-5' although including the library wouldn't be very heavy on the addon.
If there are only 5 players in your raid, then what could it possibly do with raid6+?
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-11-12, 01:08 AM   #6
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Phanx View Post
If there are only 5 players in your raid, then what could it possibly do with raid6+?
Not sure what you mean here.

The addon will primarily be for Arena, that being said, you'll always get placed into raid1-5 once you join arena.

This was more just for faster talent scanning without requiring much throttling if any.
  Reply With Quote
09-11-12, 08:27 AM   #7
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
What you probably need is to call GetInspectSpecialization(name) which returns you a global spec id. You could then use GetSpecializationRoleByID(specID) to get a non-localized role string for that spec. Beware of the return behavior of UnitName(unitid). I use

Code:
local name, realm = UnitName(unitid)
if (realm == "") then realm = nil end
name = realm and name.."-"..realm or name
If you are interested, this is how I do the inspect thing currently. The code is more or less just proof of concept right now and there is probably room for optimization but the inspect works and hopefully does not collide with libs and other inspect addons (haven't tested yet).

I looked at LibGroupInSpecT, but if I didn't miss something, it re-queues the whole group for inspect every 10 sec or so to catch re-specs, which I don't need with my case. The docs say that if you don't call ClearInspectPlayer(name), the server sends further INSPECT_READY events for the unit, so maybe this is the way to get re-specs (haven't tested this yet).
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Find raid member roles, effectively


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