Jump to content

Check wow unit or wow player for debuff


Recommended Posts

How can I check if a player has a specific debuff, for example I am interating through wowplayers that are friendly and want to check if user has "Curse of Weakness" for example, how would I do that?

Link to comment
Share on other sites

I'm trying to do it in a plugin I am working on

 

I was messing with a lot of things but none of em worked to find players debuffs, I have

 

                        foreach(WoWPlayer Player in ObjectManager.ObjectList) {
                            // Friendly, InLineOfSight, HasDebuff
                            if (Player.Reaction == Reaction.Friendly) {
                                Logging.Write("[MyPlugin] Player Name: " + Player.Name);
                                //LuaEventsId.UNIT_AURA

                                
                                
                            }
                        }

 

to interate through characters, haven't fully tested it yet if WoWPlayer is all players near character or if its only localplayer and if it is I will change that to wowunit.

 

How would I run a whole lua function or use the libraries to return all of the debuffs a player has

Link to comment
Share on other sites

Hello,

 

try this:

        List<WoWPlayer> playerList = ObjectManager.GetObjectWoWPlayer();
        string debuffName = "SpellNameInEnglish";
        foreach (var player in playerList)
        {
            if (player.IsValid && ObjectManager.Me.PlayerFaction == player.PlayerFaction)
            {
                if (player.HaveBuff(debuffName))
                    Logging.Write("[MyPlugin] Player " + player.Name + " have debuff " + debuffName);
            }
        }
Link to comment
Share on other sites

For get player role for the moment you can use lua: http://wowprogramming.com/docs/api/UnitGetAvailableRoles

 

In the next version I have added "AvailableRoles" function, you can use it like:

	List<WoWPlayer> playerList = ObjectManager.GetObjectWoWPlayer();
	bool canTank, canHealer, canDps;
        string debuffName = "SpellNameInEnglish";
        foreach (var player in playerList)
        {
            if (player.IsValid && ObjectManager.Me.PlayerFaction == player.PlayerFaction)
            {
		player.AvailableRoles(out canTank, out canHealer, out canDps);
		Logging.Write("[MyPlugin] Player " + player.Name + " canTank: " + canTank + ", canHealer: " + canHealer + ", canDps: " + canDps);
                if (player.HaveBuff(debuffName))
                    Logging.Write("[MyPlugin] Player " + player.Name + " have debuff " + debuffName);
            }
        }
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...