-
Posts
288 -
Joined
-
Last visited
Content Type
Forums
Articles
Bug Tracker
Downloads
Store
Everything posted by reapler
-
WoWLocalPlayer GetStance?
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
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.- 10 replies
-
- wmanager.dll
- fight class
-
(and 1 more)
Tagged with:
-
Spell::KnownSpell always returns true
reapler replied to Hzqvkr8aTLw4rv's topic in Developers assistance
It looks excellent Carl. I'm looking forward that this will be added soon to the WRobot's lib ;) -
Spell::KnownSpell always returns true
reapler replied to Hzqvkr8aTLw4rv's topic in Developers assistance
Hello @LilleCarl, i don't think that's the actual behavior of "new Spell("Regrowth", false).Id" to get the first rank and ".KnownSpell" shouldn't return always true. Maybe @Droidz can look into it. On 3.3.5a i have only experienced the second issue. But you may try this: public List<uint> GetKnownSpellIds(string name) { return new Spell(name).Ids.Where(SpellManager.KnowSpell).OrderBy(i => i).Distinct().ToList(); } public uint GetHighestKnownSpell(string name) { return new Spell(name).Ids.Where(SpellManager.KnowSpell).OrderByDescending(i => i).FirstOrDefault(); } Usage: var s = GetKnownSpellIds("Regrowth"); for (var i = 0; i < s.Count; i++) { robotManager.Helpful.Logging.Write("\nId: "+s[i] +" Rank: "+(i+1)); } robotManager.Helpful.Logging.Write("Id: "+GetHighestKnownSpell("Regrowth")); -
Getting mana requirement for spells?
reapler replied to Hzqvkr8aTLw4rv's topic in Developers assistance
I have already thought about this option at my current project (https://wrobot.eu/forums/topic/6681-extension-wowdb/) but i wanted to be more compact and converted it to SqLite. In the end no client actions are needed and i can customize struct definitions (https://github.com/barncastle/WDBXEditor), load it to database and alter it. I guess i also need to add spell retrieve methods to my manager aswell more client data to db :) But i'm thinking now it's better to use the reader, because all WRobot libraries already have it. And by the way welcome to WRobot. -
-
Change variable in plugin from quest profile
reapler replied to Asoter's topic in Developers assistance
@Asoter Everything looks fine, checked names and values. For me it works: doesn't matter in "RunCode" or in plugin. You may try this snippet: using System; using System.Linq; using robotManager.Helpful; using wManager.Plugin; public class Main : IPlugin { public bool readyIntoDungeon { get { Logging.Write(this.GetType().GetProperties().FirstOrDefault().Name); return Var.GetVar<bool>(this.GetType().GetProperties().FirstOrDefault().Name); } set { Logging.Write(this.GetType().GetProperties().FirstOrDefault().Name); Var.SetVar(this.GetType().GetProperties().FirstOrDefault().Name, value); } } public void Initialize() { Logging.Write(""+readyIntoDungeon); } public void Dispose() { } public void Settings() { readyIntoDungeon = true; } } Click on settings button then start bot. If it's not printing "true", then something else could be wrong with your plugin. But without an insight into your code, i can't really define the problem. -
Change variable in plugin from quest profile
reapler replied to Asoter's topic in Developers assistance
@Asoter In your plugin, "using System.Linq;" must be defined at the top of your code. If not ".FirstOrDefault()" will not work. -
Demoralizing Shout (Rank 2) Spam
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
So far i can see it correctly detects the debuff. You may need to look-over if you have somewhere else used ".Launch()" for your "Demoralizing Shout", because in the snippet it must log "not active" before "[Spell] Cast Demoralizing Shout (Demoralizing Shout)" can appear(it can a bit delay). I guess you may also alter the ".Launch()" method aswell the conditions for the spell, since "waitIsCast" has an impact of your rotation: var spell = new Spell("Demoralizing Shout"); if (!ObjectManager.Me.TargetObject.HaveBuff(spell.Ids) && spell.IsSpellUsable && spell.IsDistanceGood) { Logging.Write("not active\n=> cast"+spell.Name); spell.Launch(false, false); } else { Logging.Write(spell.Name+" active"); } -
Change variable in plugin from quest profile
reapler replied to Asoter's topic in Developers assistance
@Asoter Hello, in order to make a variable changeable by quester, you can transform your current variable into an property. Let's say you have an quest counter in your plugin defined as int: public int QuestCounter = 0; So you need to change this into this: public int QuestCounter { get { return robotManager.Helpful.Var.GetVar<int>(this.GetType().GetProperties().FirstOrDefault()?.Name); } set { robotManager.Helpful.Var.SetVar(this.GetType().GetProperties().FirstOrDefault()?.Name, value); } } You can still treat as an normal variable. And in Quester it looks like this: robotManager.Helpful.Var.SetVar("QuestCounter", 12); -
Demoralizing Shout (Rank 2) Spam
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
It's pretty fast. For a few ids, there's no need to care about (as i benchmarked, it took about 0,01789ms). But if you are going to iterate through thousands of entries, then another solution must be considered. You can read more about the performance of .net collections here. You might also try this: var spell = new Spell("Demoralizing Shout"); if (!ObjectManager.Me.TargetObject.HaveBuff(spell.Ids)) { Logging.Write("not active"); spell.Launch(); } else { Logging.Write("debuff active"); } -
Demoralizing Shout (Rank 2) Spam
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
Hello, i can't directly test it, but you can try: var target = ObjectManager.Me.TargetObject; var spell = new Spell("Demoralizing Shout"); if (!spell.TargetHaveBuff) { spell.Launch(); } or you can find the problem by yourself if you lookup spell / target: //copy this in your fightclass, and run this with opening settings public void ShowConfiguration() { //effects are also included var spellName = "Demoralizing Shout"; Logging.Write("Get all ids of spell: "+spellName); foreach (var id in new Spell(spellName).Ids.Distinct()) { Logging.Write("\n"+id); } Logging.Write("Done."); Logging.Write("Get all buffs from current target:"); foreach (var id in ObjectManager.Me.TargetObject.GetAllBuff()) { Logging.Write("\nid: "+id.SpellId+" name: "+id.GetSpell.Name); } Logging.Write("Done."); } You can also search for the "HaveBuff()" method with a decompiler, you'll see that some checking are different. Usage(with demonstration video) of my prefered decompiler can be found here -
So i've researched a bit, because i'm not .xml fan :) This snippet can be pasted, if you add a new condtion on your spell with "C Sharp Code" in the right pane on the textbox "Value": Lua.LuaDoString<bool>(@" for i=1,25 do local _, _, _, _, d = UnitDebuff('player',i); if d == 'Poison' then return true end end")
-
Heals Casting Twice With Timer
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
Personally i wouldn't use a timer like this. It's better to bind a timer on "SPELL_CAST_SUCCESS" with events and add delay on it(the purpose was another). To your problem: Your "spell.Launch(stopMoving);" in the method is causing now a own loop, because the parameter "waitIsCast is set to true". This means while you are casting holylight, and you have no conditions to check your current cast, then the next call of "UseSpell()" will be executed. If it's called and the character is still casting holy light, it will wait til the current cast is finished. If it's finished the loop in ".Launch();" will break and execute another "SpellManager.CastSpellByNameLUA(this.NameInGame);" Maybe also add "!ObjectManager.Me.IsCast" otherwise if the character is still casting another unnecessary spell, you may need to add the mentioned timer or reduce tickspeed of your rotation. If you would like to add the timer, feel free to ask. Edit: solution would be "spell.Launch(stopMoving, false);" instead of the other launch call -
Heals Casting Twice With Timer
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
So how your "new Spell("").Launch();" call look like in your "UseSpell"? -
Heals Casting Twice With Timer
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
I think you need to provide me the header of your "UseSpell" method before i can give a well answer. it could be look like this: public void UseSpell(bool stopMove, bool waitIsCast = true, bool ignoreIfCast = false) -
Heals Casting Twice With Timer
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
Hello, you can use the "ObjectManager" and filter it with linq. I guess it will be used often, so I've made a method for it: /// <summary> /// Get attacking units from another unit /// </summary> /// <param name="from">Take hostile units from this unit</param> /// <param name="maxRange">Take hostile units within this range</param> /// <returns></returns> public List<WoWUnit> AttackingUnits(WoWUnit from, float maxRange = 10) { return ObjectManager.GetWoWUnitHostile().Where(i => from.Guid == i.TargetObject.Guid && from.Position.DistanceTo(i.Position) <= maxRange ).ToList(); } and use it in another method: if (condition1 && ... && AttackingUnits(ObjectManager.Me, 15).Count < 3 ) { //cast spell } -
Random Time to use Ability
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
Yep -
-
Random Time to use Ability
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
@Apexx At your case i would use Thread.Sleep() since, you would need to block your rotation for a short time (but make sure that the ability is really usable). If you would use: var t = Task.Run(async delegate { await Task.Delay(1600); //cast spell }); It will be triggered more than one time if you have a reactive fightclass. So you would need then a boolean to check if any spells are going to be executed. But instead of building such a system, which has most likely the same effect like a sleep, just use a sleep instead. There are may scenarios which still need an active loop in fightclasses for example you have a status bar of all enemy players which updates with each loop(~100ms) so a sleep(long or short) would cause to delay also this update of the bar. So in my eyes Task.Run would be worth if you want explicit to run the thread without lockouts. In your case i wouldn't mind that, events like "EventsLuaWithArgs.OnEventsLuaWithArgs" are still working so you could theoretically interrupt the enemy cast even on a sleeping thread. As i mentioned it's not a big issue to use a sleep here for this short time = > droidz example At the end you can also do a check if it's still clever to cast this spell: For example you have an heal rotation and casting a heal on a 100% health target & bot doesn't interrupt that, because you aren't checking after the cast. With the events you can also check if someone is already casting a heal, on your heal target, so your rotation wouldn't try that. OR you can simply put the tickspeed lower at your fightclass: var timer = new Timer(1000);//tickspeed timer.ForceReady(); while (_isLaunched) { try { if ( Conditions.ProductIsStartedNotInPause && timer.IsReady //&& condition3 ) { //do something every 1 sec } } catch (Exception e) { Logging.WriteError(e.ToString()); } Thread.Sleep(30); } You can also use other examples with a sleep instead of the timer (i don't think that it will change anything). You may also add some other conditions this one is just a template on initialize. -
Random Time to use Ability
reapler replied to Apexx's topic in WRobot for Wow Wrath of the Lich King - Help and support
Hello @Apexx, so you would like to only delay the current cast or has it a special reason to do that? Otherwise you can still use Thread.Sleep() if the fightclass shouldn't execute anything (for a small time / simple task it's ok i guess).