Jump to content

Recommended Posts

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!

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/
Share on other sites

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
            {
                //...
            }

 

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-29929
Share on other sites

@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)

 

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-29981
Share on other sites

@Apexx if you have no "Logging.Write" in your code that could spam the message, then i guess it's hardcoded. But you can disable to display the message under tab "Log" > "Fight Off/On".

Otherwise @Droidz can give a better answer.

 

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-29982
Share on other sites

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;
  	}
}

 

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-29983
Share on other sites

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.

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-29984
Share on other sites

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() ?? "");
    }

 

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-29986
Share on other sites

  • 2 weeks later...

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!

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-30498
Share on other sites

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.

Link to comment
https://wrobot.eu/forums/topic/6608-wowlocalplayer-getstance/#findComment-30500
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...