July 27, 20178 yr 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!
July 27, 20178 yr 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 { //... }
July 27, 20178 yr 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)
July 27, 20178 yr @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.
July 27, 20178 yr 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; } }
July 27, 20178 yr 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.
July 28, 20178 yr 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() ?? ""); }
August 8, 20178 yr 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!
August 8, 20178 yr 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