Jump to content

reapler

Elite user
  • Posts

    288
  • Joined

  • Last visited

Everything posted by reapler

  1. 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.
  2. @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.
  3. i belive i know what's wrong, but please attach a log first, since it worked on 3.3.5a. Of course, initially i wanted to add more features but i don't have time yet.
  4. 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 { //... }
  5. Forgot that you are playing on vanilla, so "CancelUnitBuff" doesn't exist in the api. I replaced it just with another cast: StealthOnNearbyPlayers+stopfishing.xml
  6. I belive "public static void CGPlayer_C__ClickToMove(float x, float y, float z, ulong guid, int action, float precision)" is used wrong, if you have ClickToMoveType.Face as action. I've made a method to set rotation based on position: public void Face(Vector3 to) { var me = wManager.Wow.ObjectManager.ObjectManager.Me; ClickToMove.CGPlayer_C__ClickToMove(0, 0, 0, me.Guid, 2, (float)System.Math.Atan2(to.Y - me.Position.Y, to.X - me.Position.X)); } So this means precision would change to rotation. This worked for me flawless on 3.3.5a. I think the behavior is almost the same for other clients.
  7. Hello, this snippet should work but Thread.Sleep will locking your rotation. I recommend to use "EventsLuaWithArgs.OnEventsLuaWithArgs" & "Task.Run" to also checking more enemies at the same time: private readonly Spell _shieldBash = new Spell("Shield Bash"); private readonly Random _r = new Random(); private void EventsLuaWithArgsOnOnEventsLuaWithArgs(LuaEventsId id, List<string> args) { if (id == LuaEventsId.COMBAT_LOG_EVENT_UNFILTERED && args[1] == "SPELL_CAST_START") { ulong guid; ulong.TryParse(args[2].Replace("x", string.Empty), System.Globalization.NumberStyles.HexNumber, null, out guid); var caster = (WoWUnit) ObjectManager.GetObjectByGuid(guid); if ( caster.Reaction < Reaction.Neutral && _shieldBash.KnownSpell ) { Interrupt(_shieldBash, caster, _r.Next(150, ((int)caster.CastingSpell.CastTime-200)*1000)); } } } private void Interrupt(Spell spell, WoWUnit caster, int interruptTime) { Task.Run(delegate { while (caster.CastingTimeLeft != 0 && Products.IsStarted) { Logging.Write("CastingTimeLeft: "+caster.CastingTimeLeft +"ms\nInterrupt at: "+interruptTime+"ms"); if (caster.CastingTimeLeft > interruptTime && caster.GetDistance < _shieldBash.MaxRange && _shieldBash.IsSpellUsable && SpellManager.GetSpellCooldownTimeLeft(_shieldBash.Id) == 0 && caster.CanInterruptCasting ) { Logging.Write("Interrupt with " + spell.Name); //cast without targeting behavior var tmp = ObjectManager.Me.FocusGuid; ObjectManager.Me.FocusGuid = caster.Guid; spell.Launch(false, false, false, "focus"); ObjectManager.Me.FocusGuid = tmp; } Thread.Sleep(300); } }); } public void Initialize() { EventsLuaWithArgs.OnEventsLuaWithArgs += EventsLuaWithArgsOnOnEventsLuaWithArgs; //... } This is not fully tested, otherwise you can also play around with other parameters & at problems it's a good idea to use "Logging.Write();".
  8. @apexx Namespace System.Linq is not referenced. So you need to copy this on the top of your code: using System.Linq; Both .Where() & .Count() are included in Linq, that's the reason why .Count() couldn't work because it doesn't had an overload available. So in the end you can use this: if (ObjectManager.GetUnitAttackPlayer().Count(u => u.GetDistance <= 6) > 2) { } Or use other Linq methods.
  9. Hello, for this purpose you need a stopwatch and events: private readonly Stopwatch _combatTimer = new Stopwatch(); public void Initialize() { EventsLua.AttachEventLua(LuaEventsId.PLAYER_REGEN_DISABLED, CombatStart); EventsLua.AttachEventLua(LuaEventsId.PLAYER_REGEN_ENABLED, CombatEnd); } private void CombatStart(object context) { _combatTimer.Restart(); } private void CombatEnd(object context) { _combatTimer.Reset(); } usage in a method for example: if (_combatTimer.ElapsedMilliseconds > 8000) { Logging.Write("In combat since 8 seconds"); }
  10. Good idea, i consider it if i'm going to develop it further.
  11. This might interest you: https://wrobot.eu/bugtracker/avoid-hight-level-and-elite-r780/#comment-4111
  12. If i'm done with other projects (it could take a while), i'll look into it :) I think settings gui is already done:
  13. @apexx wManager.Wow.ObjectManager.ObjectManager.Me.TargetObject.CreatureTypeTarget == "Humanoid"
  14. Now i added "Assist also pet" to the options. On enabled It will now also support the assisted target's pet.
  15. Hello, @KnightRyder i guess you mean with "addon" my used "plugin" so in this case you should check if you are not in group, the player to assist is in visible range & if your textbox on "Follow by player name" is correct since this error can only be thrown if: - objectmanager doesn't innerhit the player to follow => out of objectmanager's scope - the name to follow is written wrong I belive it could be possible that another problem can cause this error. But before i can define it, please send me a log.
  16. Small Update: Since i'm developing now other projects, this will go unfortunately back on my list. If someone wants to actively maintain it, a pm can be sent to me. Edit: Holy_Grail_Source.rar
  17. @pookasmight the last part would take take too much effort on fightclass. But this should be fine: StealthOnNearbyPlayers+stopfishing.xml New part looks like this: //C# Fish block on Stealth if (wManager.Statistics.RunningTimeInSec() < 2) { robotManager.Helpful.Logging.Write("Register OnFishingPulse"); wManager.Events.FishingEvents.OnFishingPulse += delegate(ulong node, CancelEventArgs cancelable) { if (ObjectManager.Me.HaveBuff("Stealth")) { cancelable.Cancel = true; } }; robotManager.Helpful.Logging.Write("Register OnFishLoop"); wManager.Events.FishingEvents.OnFishLoop += delegate(ulong node) { while (ObjectManager.Me.HaveBuff("Stealth") && !robotManager.Products.Products.InPause) { Thread.Sleep(50); } }; System.Threading.Thread.Sleep(2000);//to initialize event only once on startup }
  18. Hello @Ke1ka, i had also problems to getting a list from party, so i made a similar method to acquire a general list from objectmanager: If a hostile npc doesn't target the tank (not tested): public static List<WoWUnit> GetNoAggroUnits(float range) { WoWLocalPlayer me = ObjectManager.Me; List<WoWUnit> u = new List<WoWUnit>(); Parallel.ForEach(ObjectManager.GetWoWUnitHostile(), delegate(WoWUnit unit) { if (unit.Target != me.Guid && unit.Target != 0 && unit.InCombat && unit.IsAlive && unit.GetDistance < range && !TraceLine.TraceLineGo(unit.Position, me.Position)) //slow part { u.Add(unit); } }); return u.OrderBy(i => i.TargetObject.HealthPercent).ToList();//first object in the returned list will contain the target with the lowest health } You could also do something like this: public static List<WoWUnit> GetNoAggroUnitsExplicit(float range) { WoWLocalPlayer me = ObjectManager.Me; var u = new List<WoWUnit>(); var p = ObjectManager.GetObjectWoWPlayer().Where(woWPlayer => woWPlayer.PlayerFaction == me.PlayerFaction && woWPlayer.IsAlive).Select(i => i.Guid); Parallel.ForEach(ObjectManager.GetWoWUnitHostile(), delegate (WoWUnit unit) { if (p.Contains(unit.Target) && unit.Target != 0 && unit.InCombat && unit.IsAlive && unit.GetDistance < range && !TraceLine.TraceLineGo(unit.Position, me.Position)) //slow part { u.Add(unit); } }); return u.OrderBy(i => i.TargetObject.HealthPercent).ToList(); } But i don't think that's necessary, except you would use a party / raid list as "p" (which didn't worked for me last time).
  19. By the way did you alter the the attached xml in order to resolve the error? if yes please attach it here since i don't have a vanilla client & can't see occurring erros
  20. So far i understand you, you want to stealth while a player is nearby and doing nothing, til the player goes away to start fishing again?
  21. Yes, that's right but with my snippet you get a string from your spell with lua in this case: "Shadow Word: Pain". I made a simple method: public Spell Spell_(string name) => new Spell(name) { Icon = Lua.LuaDoString<string>( "name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(\"" + name + "\")", "rank") }; This overrides "Icon" to spell's rank. I guess it's not added in vanilla, because it was forgotten as it was backported :) Usage: public void Initialize() { wManager.Wow.Class.Spell eviscerate = Spell_("Eviscerate"); robotManager.Helpful.Logging.Write("Get information of spell: " + eviscerate.Name); robotManager.Helpful.Logging.Write("Spell rank: "+eviscerate.Icon);//now field ".Icon" returns the rank if you use "public Spell Spell_(string name) => new Spell(name)" robotManager.Helpful.Logging.Write("Spell id: "+eviscerate.Id); }
  22. Hello, @hakancamli WRobot has in in "Quester" product under "Product Settings" on the left pane a button called "Easy profiles creator". After you have opened it, click on Tools > Helper Tools. Now you may scroll down and click "Buddy to WRobot". It's not guaranteed that the profile will work correctly, since used classes, methods or bot behavior can vary.
  23. Logging.Write(Lua.LuaDoString<string>("name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(\"Shadow Word: Pain\")", "rank")); Can be used. But i guess you could also need "desc = GetSpellDescription(spellId)" but unfortunately for me it doesn't return any string to parse the damage values. Ok let's take FightEvents. I linked a fightclass which has "internal void BuffRotation()" on a loop. Once "public void Initialize()" is called from the interface(start bot), it will loop this method till you stop the bot. So that means the buffrotation aswell the other methods in your fightclass having no impact / affiliation on "FightEvents". The "FightEvents" or the other events in WRobot are triggered from the bot behavior itself (you can imagine like a guy reporting you what he's doing). So this "guy" tells you: I attack now this npc = "wManager.Events.FightEvents.OnFightStart" While fighting i also report whats going on every ~30ms = "wManager.Events.FightEvents.OnFightLoop" the fight is over = "wManager.Events.FightEvents.OnFightEnd" This is useful for plugins for example but if you are going to write a fightclass, you wouldn't really need it. If you want to write a plugin which uses an item or do other action after a fight end, you could subscribe it like this: wManager.Events.FightEvents.OnFightEnd += delegate { wManager.Wow.Helpers.SpellManager.CastSpellByIdLUA(8690); //cast hearthstone }; If you write an plugin you could use your snippet on a loop or by subscribing it to "wManager.Events.MovementEvents.OnMoveToPulse". But i guess you are writing a fightclass anyway, so you can put this snippet to buffrotation or directly to while loop: internal void BuffRotation() { if (ObjectManager.Me.IsMounted) return; //if not mounted cast sprint var spelltocast = new Spell("Sprint"); if (wManager.Wow.Bot.States.ToTown.GoToTownInProgress && spelltocast.IsSpellUsable) { spelltocast.Launch(); } } or directly in while loop: internal void Rotation() { Logging.Write("[My fightclass] Is started."); while (_isLaunched) { try { if (!Products.InPause) { if (!ObjectManager.Me.IsDeadMe) { BuffRotation(); var spelltocast = new Spell("Sprint"); if (wManager.Wow.Bot.States.ToTown.GoToTownInProgress && spelltocast.IsSpellUsable && !ObjectManager.Me.IsMounted) { spelltocast.Launch(); } if (Fight.InFight && ObjectManager.Me.Target > 0) { Pull(); CombatRotation(); } } } } catch (Exception e) { Logging.WriteError("[My fightclass] ERROR: " + e); } Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage. } Logging.Write("[My fightclass] Is now stopped."); } So you can see in the end it doesn't really matter. It's just for a better structure & readability.
  24. reapler

    SlimDx Draw

    Thank you @Droidz
×
×
  • Create New...