Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

WoWLocalPlayer GetStance?

Featured Replies

Would it be possible to add GetStance() or something similar into the WoWLocalPlayer class? Some combat rotations require different stances,
and it would be nice to be able to access the current stance from within the built in class itself.

Thanks!

Hello, i've made a few methods for this purpose( @Droidz contributed some parts ):

    public List<string> GetStanceNames()
    {
        return Lua.LuaDoString<List<string>>(@"local r = {}
                                            for i=1,10 do 
	                                            local _, n = GetShapeshiftFormInfo(i);
	                                            if n then table.insert(r, tostring(n)); end
                                            end
                                            return unpack(r);") ?? new List<string>();
    }
    
    public List<Spell> GetStanceSpells()
    {
        List<Spell> sp = new List<Spell>();
        foreach (var s in Lua.LuaDoString<List<string>>(@"local r = {}
                                            for i=1,10 do 
	                                            local _, n = GetShapeshiftFormInfo(i);
	                                            if n then table.insert(r, tostring(n)); end
                                            end
                                            return unpack(r);") ?? new List<string>())
        {
            sp.Add(new Spell(s));
        }
        return sp;
    }

    public Spell GetActiveStance()
    {
        return new Spell(Lua.LuaDoString<List<string>>(@"local r = {}
                                            for i=1,10 do 
	                                            local _, n, a = GetShapeshiftFormInfo(i);
	                                            if a then table.insert(r, tostring(n)); end
                                            end
                                            return unpack(r);").FirstOrDefault() ?? "");
    }

Usage:

            Logging.Write(GetActiveStance().Id.ToString());
            if (GetActiveStance().Id == 2458)//berserker stance
            {
                //...
            }

 

  • Author

@reapler I was wondering if there was a way to disable the Log spam from this?
 

Quote

12:29:40 - [Fight] Player Attack Rotting Dead (lvl 5)
[D] 12:29:40 - [Spell] Defensive Stance (Id found: 71, Name found: Defensive Stance, NameInGame found: Defensive Stance, Know = True, IsSpellUsable = True)
[D] 12:29:40 - [Spell] Defensive Stance (Id found: 71, Name found: Defensive Stance, NameInGame found: Defensive Stance, Know = True, IsSpellUsable = True)
[D] 12:29:40 - [Spell] Defensive Stance (Id found: 71, Name found: Defensive Stance, NameInGame found: Defensive Stance, Know = True, IsSpellUsable = True)
[D] 12:29:41 - [Spell] Defensive Stance (Id found: 71, Name found: Defensive Stance, NameInGame found: Defensive Stance, Know = True, IsSpellUsable = True)
[D] 12:29:41 - [Spell] Defensive Stance (Id found: 71, Name found: Defensive Stance, NameInGame found: Defensive Stance, Know = True, IsSpellUsable = True)
[D] 12:29:41 - [Spell] Defensive Stance (Id found: 71, Name found: Defensive Stance, NameInGame found: Defensive Stance, Know = True, IsSpellUsable = True)
[F] 12:29:41 - [Spell] Cast Taunt (Taunt)
[F] 12:29:45 - [Spell] Cast Rend (Rend)
[F] 12:29:45 - [Spell] Cast Bloodrage (Bloodrage)
[F] 12:29:46 - [Spell] Cast Heroic Strike (Heroic Strike)
[F] 12:29:49 - [Spell] Cast Heroic Strike (Heroic Strike)

 

  • Author

I don't mind having it there, just not spamming every time is runs the check inside my class.

internal void BuffRotation()
    {
        if (ObjectManager.Me.IsMounted)
            return;

	// Check Stance 
    }
if (GetActiveStance().Id != 71 && player.IsInGroup) 
{
	if (DefensiveStance.KnownSpell && DefensiveStance.IsSpellUsable && player.IsInGroup)
  	{
      		DefensiveStance.Launch();
      		return;
  	}
}

 

1 hour ago, Apexx said:

I don't mind having it there, just not spamming every time is runs the check inside my class.


internal void BuffRotation()
    {
        if (ObjectManager.Me.IsMounted)
            return;

	// Check Stance 
    }

if (GetActiveStance().Id != 71 && player.IsInGroup) 
{
	if (DefensiveStance.KnownSpell && DefensiveStance.IsSpellUsable && player.IsInGroup)
  	{
      		DefensiveStance.Launch();
      		return;
  	}
}

 

This snippet should not throw any logs except of "DefensiveStance.Launch();" (tried on plugin). So i guess it's some internal behavior from WRobot itself.

I've also experienced similar situations with .xml fightclass' spamming log (was well configured), but so far i know you can't change this yourself.

  • Author

Alright thanks! I see a return new Spell here:

public Spell GetActiveStance()
    {
        return new Spell(Lua.LuaDoString<List<string>>(@"local r = {}
                                            for i=1,10 do 
	                                            local _, n, a = GetShapeshiftFormInfo(i);
	                                            if a then table.insert(r, tostring(n)); end
                                            end
                                            return unpack(r);").FirstOrDefault() ?? "");
    }

 

  • 2 weeks later...
  • Author

Gentle Bump @Droidz. Is there any way to prevent the Logging.WriteDebug for the Return new spell for GetActiveStance? It's hard to debug my scripts with the endless spam while checking the player's current stance.

 

Thanks!

I've looked over the spell class again and found this constructor:

public Spell(string spellNameEnglish, bool showLog)

So you need to add "false" on every instance of "Spell":

    public Spell GetActiveStance()
    {
        return new Spell(Lua.LuaDoString<List<string>>(@"local r = {}
                                            for i=1,10 do 
	                                            local _, n, a = GetShapeshiftFormInfo(i);
	                                            if a then table.insert(r, tostring(n)); end
                                            end
                                            return unpack(r);").FirstOrDefault() ?? "", false);
    }

	
    public Spell BattleShout = new Spell("Battle Shout", false);

    //...

 

This should hopefully stop the spam.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.