What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Check players role without LUA

Gilderoy

New Member
Joined
May 10, 2010
Messages
761
Reaction score
16
Hi all!
So, me and sm0k3d are developing Ultimate Paladin Healer.
For now it only work on english client couse we are forced to use LUA scripting for 3 matters.
one of those matters are understanding what role a player in our party/raid is.
as of today we are using this
Code:
        private bool IsTank(WoWPlayer p)
        {
            if (p != null)
            {
                return Lua.GetReturnValues("return UnitGroupRolesAssigned('" + DeUnicodify(p.Name) + "')").First() == "TANK";
            }
            else return false;
        }
is there any way to do the same thing without using a lua.getreturnvalues call? (that is leanguage dependent)
 
Hi all!
So, me and sm0k3d are developing Ultimate Paladin Healer.
For now it only work on english client couse we are forced to use LUA scripting for 3 matters.
one of those matters are understanding what role a player in our party/raid is.
as of today we are using this
Code:
        private bool IsTank(WoWPlayer p)
        {
            if (p != null)
            {
                return Lua.GetReturnValues("return UnitGroupRolesAssigned('" + DeUnicodify(p.Name) + "')").First() == "TANK";
            }
            else return false;
        }
is there any way to do the same thing without using a lua.getreturnvalues call? (that is leanguage dependent)
no there isnt.
 
The only alternat way i could think off is too compare health of players & the highest will be a tank in 5 man; highest 2 in 10 and then maybe 2-3 in 25 man.

There shouldn't be many situations where this fails.
 
i would like to change it couse it only work with english client :P
Nuok your method worked in wotlk but now that stamina is connected with item level is risky.. a item level 346 tank has less hp than a 359 dps
 
I think this is what you're looking for. Styx.WoWInternals.WoWObjects.WoWPartyMember.Role
 
nope, because we cannot convert wowplayer to wowpartymember, and the description of Styx.WoWInternals.WoWObjects.WoWPartyMember.Role say "[only work in raid]" even if can be called only on party members.. so i'm still lost O_o
 
are u sure that the returned string is language dependant?
If this is the fact, then most of the addons won't work because of localization

But as workoround u can use a static array, enumeration or whatever to check if the returned string matches one of the known strings for a tank, healer or dps

i'll check the return value in the evening on a german client if u need to know
 
WoW stores some language specific stuff in global lua strings.
Check utils/xmlbrowser/live/FrameXML/GlobalStrings - World of Warcraft Programming: A Guide and Reference for Creating WoW Addons to see a list.
The following example should language independent.
PHP:
        enum PartyRole { None, Tank, Healer, Dps };
        PartyRole GetPartyRole(WoWPlayer p) {
            return (PartyRole)Lua.GetReturnVal(string.Format(
                "local role = UnitGroupRolesAssigned(\"{0}\") if role == TANK then return 1 elseif role == HEALER then return 2 elseif role == DAMAGER then return 3 else return 0 end",DeUnicodify(p.Name)),0);
        }
 
Last edited:
This is interesting as i'm looking for a way to see if the healer is dead in an instance.

Having an idea to use Rebirth to revive the healzor.
 
This is interesting as i'm looking for a way to see if the healer is dead in an instance.

Having an idea to use Rebirth to revive the healzor.
just look for the healer, and then save that to a WoWUnit, then just keep checking if the wowunit.Isdead
 
UnitGroupRolesAssigned returns "HEALER" on a german client too.

[12:42:55]Dump: value=UnitGroupRolesAssigned(player)
[12:42:55][1]="HEALER"
 
Last edited:
Back
Top