Jump to content
This site uses cookies! Learn More

This site uses cookies!

By continuing to use this site, you agree to allow us to store cookies on your computer. :)

Stresse

WRobot user
  • Content Count

    33
  • Joined

  • Last visited

About Stresse

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. So far any effort I have made to utilize the Demon Hunters' maneuverability has looked incredibly bot-like. The following code is my attempt to find a suitably-far point to move to (to prevent the bot from using the Glide ability, only to immediately turn back because it didn't remove a waypoint passed while flying. The problem is that, without a way to determine whether or not the bot is on the ground or up in the air, there really isn't a good way to handle cases where the bot might overshoot a waypoint (or perform a simple turn while gliding). Seems like if I could figure out how to tell when the DH is in the air, it would be possible to have it skip/remove any waypoints if the bot passes withing N yards of its X, Y coordinates. How can I do this? Current Code public void DemonHunterGlide() { wManager.Events.MovementEvents.OnMovementPulse += (path, cancelable) => { var furthestPointInLoS= path.Where(p=> !TraceLine.TraceLineGo(ObjectManager.Me.Position, p, wManager.Wow.Enums.CGWorldFrameHitFlags.HitTestAll)).OrderBy(p=> ObjectManager.Me.Position.DistanceTo(p)).LastOrDefault(); var distance = ObjectManager.Me.Position.DistanceTo(furthestPointInLoS); Logging.Write("Distance = " + distance + ", Point = " + furthestPointInLoS.ToString()); Logging.Write(@"Beginning Demon Hunter ""Glide"" ability with a jump"); wManager.Wow.Helpers.Move.JumpOrAscend(); Thread.Sleep(500); Logging.Write(@"Jump"); wManager.Wow.Helpers.Move.JumpOrAscend(); Thread.Sleep(500); Logging.Write(@"Jump"); wManager.Wow.Helpers.Move.JumpOrAscend(); FelRush.Launch(); Logging.Write(@"Done"); }; } 
  2. If I give them designations in my code, don't I run into the same issue (that I can't get their LuaId to use for the CastSpellOn method?
  3. Hahaha, it was someone else's topic, I've just been cannibalizing code from all over for a couple months now. "Learning C# By Botting", I'm here to say, should be developed as a teaching technique.
  4. Howdy y'all! My C# is finally at the point where I am starting to be able to develop full products (profiles, fightclasses, etc.). I'm working on a fightclass template (which I'll post once functional) that people can adapt for any class they want (I'm developing it for my Disc Priest, so it already has to be able to do some niche stuff). @Smokie gave some great code in this post on how to cast spells on yourself and party members (maybe other players, too, I haven't tested). SpellManager.CastSpellByNameOn("Rejuvenation", p.Name); SpellManager.CastSpellByNameOn("Rejuvenation","PlayerName"); SpellManager.CastSpellByNameOn("Rejuvenation", ObjectManager.Me.Name); "Really any code with a name string will work" That code works fantastically for players! But mobs share names and so require us to use their LuaId, which, to my knowledge, isn't retrievable using Wrobot methods/properties (if I'm wrong, please set me straight). I actually can't even figure out how to get the LuaId using Lua and the only way I've seen anyone attempt to implement this functionality did so (a long time ago, most of the code is unusable, actually). public static bool CastSpell(Spell spell, WoWUnit unit, bool force) { // Handle bullshit units if (unit == null || !unit.IsValid || unit.IsDead || !spell.KnownSpell || !spell.IsSpellUsable) { return false; } // Check If Toon is Wanding if (spell.Name == "Shoot" && IsAutoRepeating("Shoot")) { return true; } // Fuck off if toon is already casting and (force == false) if (ObjectManager.Me.Casting() && !force) return false; // Stop moving if spell needs to be cast if (spell.CastTime > 0) MovementManager.StopMoveTo(false, Usefuls.Latency + 500); // Force cast spell if (force == true) if (force) Lua.LuaDoString("SpellStopCasting();"); // Cast AoE spells by location if (AreaSpells.Contains(spell.Name)) { Lua.LuaDoString("CastSpellByName(\"" + spell.Name + "\")"); ClickOnTerrain.Pulse(unit.Position); } else { // Rely on Auto Self Cast WoWUnit temp = ObjectManager.Target; bool onSelf= unit.Guid == ObjectManager.Me.Guid; // Face unit to cast if (!onSelf) { MovementManager.Face(unit); _disableTargeting= true; TargetUnit(unit); } // Default to self casting SpellManager.CastSpellByNameOn(spell, ObjectManager.Me.Name); // Handle non-self targets if (!onSelf) { if (temp.Guid == 0 || !temp.IsValid) { Lua.LuaDoString("ClearTarget();"); // This clears the current target...which defeats the purpose, yea? } else { TargetUnit(temp); } // Interact.InteractObjectis also given as a possibility, but, as I understand it, that would also change targets _disableTargeting= false; } } return true; } I don't understand the use of Locktargeting and so can't figure out how to remove code rot or whether or not this should actually work as a "Mouseover Cast"- type cast (for classes/situation where focusing on a new WoWUnit would be undesirable but applying a dot or whatever is necessary). Hoping someone can help me figure it out!
  5. Awesome! I'll give it a shot once servers are back up. Is there a way to check if a coordinate/npc is indoors (seems like there must be, since we can "Ignore indoor/outdoor nodes" while gathering)? Because then I could do something like public static void TakeOptimalRoute(Vector3 position) { List<Vector3> roughPath= wManager.Wow.Helpers.PathFinder.FindPath(Location); Vector3 transitionPoint= new Vector3(); for (int i= 0; i< roughPath.Count; i++) { Vector3 coo = roughPath[i]; if coo.IsIndoors() // Or however I would do a check to see if the destination is indoors { transitionPoint= roughPath[i-1]; } } if (transitionPoint != new Vector3()) { GoToTask.ToPosition(transitionPoint.IsFlying()); //And that might fix my orignal problem, too? Sorry, just looked into Vector3 properties GoToTask.ToPosition(location.IsGround()); } }
  6. Hi y'all! I'm trying to figure out the various methods WRobot has for finding paths. I'm working on a profile to do the Tanaan Jungle "Tiny Terrors" and can't seem to put together a decent method for the bot to get as far as it can with the flying mount, but then using a (more) precise method to navigate to the NPC. For example string name = "Chaos Pup" Vector3 location = new Vector3(3265.077, 394.3333, 116.3515, "None"); int npcID= 94638; This NPC is in a cave. If I use... List<Vector3> pos= wManager.Wow.Helpers.PathFinder.FindPath(ObjectManager.Me.Position, location); MovementManager.Go(pos); ...it generates a ground-only path to the NPC, which looks pretty bot-like, but does seemto actually navigate to the NPC. If I use... MountTask.Mount(true, MountTask.MountCapacity.Fly); MovementManager.StopMove(); LongMove.StopLongMove(); GoToTask.ToPosition(position); ...the bot flies above the location and then smashes itself into the mountain repeatedly (which, obviously, looks even more like a bot and doesn't reach the desired location). Is there a simple solution that I'm missing? My current method for navigating is (and forgive me, this is cannibalized from somewhere on the forum)... public static void GoTo(Vector3 position, float minDist= 10, float minDistFly= 100, int maxFlyTimeMins= 30) { var dist = ObjectManager.Me.Position.DistanceTo(position); bool canFly= Lua.LuaDoString<bool>("return IsFlyableArea()"); if (dist > minDistFly&& canFly) { Log("Making a long move to "+position); MovementManager.StopMove(); LongMove.StopLongMove(); MountTask.Mount(true, MountTask.MountCapacity.Fly); //LongMove.LongMoveGo(position, maxFlyTimeMins * 60 * 1000, minDistFly); LongMove.LongMoveGo(position); } else if (dist > minDist) { Log("Making a short move to "+position); MovementManager.StopMove(); LongMove.StopLongMove(); GoToTask.ToPosition(position); } } ...but I need to make this adaptable so it can handle the occasional indoor location...does anyone have any ideas (or, I mean, I have to imagine this functionality is probably already somewhere in WRobot(?)so perhaps @Droidz can point me in the right direction? Sorry, I did try to find it in the forums (maybe I'm not using the right search terms?). I've been coding for WRobt for awhile (still getting used to C#), but this is my first foray into Profiles (actually it's kinda my first attempt to make a full product that isn't a plugin).
  7. Seems to have resolved itself now. Gosh, I keep getting so close to starting to post some code and then decide it's not ready yet. (Do you ever have that problem with the bot?)
  8. Hi! So I *just* started Pet Battling and in order to make profiles for leveling carry pets, I am working on a custom profile. As most Pet Battlers probably know (as in I've "known" it for <2 days, but I'm always behind the curve), when doing trainers you often have to use a specific set of abilities. Looking through the WoW API, I can't find any way to set abilities. Looking through the unofficial WRobot API, I also can't find a function to do thiis. Does it exist? If not, how would I got about doing this?
  9. Howdy y'all! I'm working on a little plugin to help me recruit to get that 8th Guild Bank slot (because, you know, I'm a bit spoiled 😉). I pulled the following from a pure Lua project I had been working on to do this recruitment (more) manually. Problem is, there are a shit ton of queries (and not a predictable number) and I can't think of a sane way of doing it individually. Feels like there must be a way to take the table and turn it into a Dictionary<int,string> (or just get rid of the damn indexes and turn it into a list of strings)...but I can't figure out how. Can anyone help? -- Everything here is Horde-specific; the plugin will have both local ClassyRaceAchievementIDs= {5163,5165,5160,6625,5161,5162,5164} local Races = {"Blood Elf","Goblin","Orc","Pandaren","Tauren","Troll","Undead"} local Classes = {"Death Knight","Demon Hunter","Druid","Hunter","Mage","Monk", "Paladin","Priest","Rogue","Shaman","Warlock","Warrior"} local RaceAchievementIDs= {[5163]="Blood Elf", [5165]="Goblin", [5160]="Orc", [6625]="Pandaren", [5161]="Tauren", [5162]="Troll", [5164]="Undead"} local queries={} for i=1,#ClassyRaceAchievementIDs do local id = ClassyRaceAchievementIDs[i] local numCriteria= GetAchievementNumCriteria(id) local raceStr= RaceAchievementIDs[id] for c=1,numCriteria do local criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible = GetAchievementCriteriaInfo(id,c) local classStr if tContains(Classes,criteriaString) then for i=1,#Classes do if Classes[i] == criteriaString then classStr=Classes[i] end end end local query="r-\""..raceStr.."\" c-\""..classStr.."\" 120" if completed==false then tinsert(queries, query) end end end return queries
  10. Hi y'all! So I'm working on a plugin for area farming (where looting every corpses looks bot as fuck). I'm going to include the whole code (just in case there is something there causing the error. You'll note I've commented out a lot of the code so that I'm mostly just focussing on why I can't seem to get the timers to work...I've been looking at other developer's code and I can't figure out how my usage is different. using robotManager.Helpful; using System.Threading; using robotManager.Products; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; using System; using System.Collections.Generic; using System.IO; using System.ComponentModel; using robotManager; public class Main : wManager.Plugin.IPlugin { private bool _isLaunched; private bool _isLooting; private bool _lootingTimedOut; private bool _killingTimedOut; private bool _lootingCompleted; private bool _killingCompleted; private bool _lootingDone; private bool _killingDone; private static int killingMaxTime; private static int killingMaxTimeMilli; private static int lootingMaxTime; private static int lootingMaxTimeMilli; //private var lootableCorpses; private static int maxCorpses; // private List<WoWObject> lootableCorpses; private static int lootableCorpseCount; private List<WoWUnit> lootableCorpses = new List<WoWUnit>(); // = ObjectManager.ObjectList().Where(u => u != null && u.IsValid && u.IsDead && u.IsLootable); // private List<WoWUnit> //var lootableCorpses = new List<WoWUnit unit>(); public static void Log(string text) { Logging.Write("[Lootoggle] " + text); } private static List<WoWUnit> GetLootableCorpses() { List<WoWUnit> result = new List<WoWUnit>(); try { foreach (WoWObject wo in ObjectManager.ObjectList) { WoWUnit o; switch (wo.Type) { case WoWObjectType.Unit: o = new WoWUnit(wo.GetBaseAddress); break; default: continue; } if (o != null && o.IsValid && o.IsDead && o.IsLootable) { result.Add(o); } } } catch (Exception arg) { Logging.WriteError("GetLootableCorpses error " + arg, true); } return result; } public void Initialize() { _isLaunched = true; _isLooting = true; LootoggleSettings.Load(); maxCorpses = LootoggleSettings.CurrentSetting.maxCorpses; Log("Started."); pluginLoop(); } public void Dispose() { _isLaunched = false; Log("Disposed."); } public void Settings() { LootoggleSettings.Load(); LootoggleSettings.CurrentSetting.ToForm(); LootoggleSettings.CurrentSetting.Save(); // Log("[Lootoggle] Settings saved."); } static robotManager.Helpful.Timer KillingTimer = new robotManager.Helpful.Timer(killingMaxTimeMilli); static robotManager.Helpful.Timer LootingTimer = new robotManager.Helpful.Timer(lootingMaxTimeMilli); public void StartLooting() { wManager.wManagerSetting.CurrentSetting.LootMobs = _isLooting = true; Log("Resetting looting timer to " + lootingMaxTime + "."); LootingTimer.Reset(); LootingTimer.Reset(); } public void StopLooting() { wManager.wManagerSetting.CurrentSetting.LootMobs = _isLooting = false; Log("Resetting killing timer to " + killingMaxTime + "."); KillingTimer.Reset(); LootingTimer.Reset(); } public void LogLootingEvents() { Log("Corpses: " + lootableCorpseCount + "/" + maxCorpses + " Countdown: " + KillingTimer + "Downtime" + "/" + killingMaxTime); Thread.Sleep(100); } // public void watchForEvents() // { // // Adding this mostly just to keep track of loot in logs. // EventsLuaWithArgs.OnEventsLuaWithArgs += (LuaEventsId id, List<string> args) => // { // if (id == "LOOT_CLOSED") // { // Log("Looting completed."); // }  // }; // } // public void pluginLoop() { KillingTimer = new robotManager.Helpful.Timer(killingMaxTimeMilli); KillingTimer.ForceReady(); LootingTimer.Reset(lootingMaxTimeMilli); KillingTimer.Reset(killingMaxTimeMilli); while (Products.IsStarted && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause) { lootableCorpses = GetLootableCorpses(); lootableCorpseCount = lootableCorpses.Count; Log("There are " + lootableCorpseCount + " lootable corpses."); _lootingTimedOut = LootingTimer.IsReady; _lootingCompleted = (lootableCorpseCount < 1); _lootingDone = (_lootingTimedOut || _lootingCompleted); // Log(LootingTimer.IsReady); _killingTimedOut = KillingTimer.IsReady; _killingCompleted = (lootableCorpseCount >= maxCorpses); _killingDone = (_killingTimedOut || _killingCompleted); Log("Looting Time left: " + LootingTimer.TimeLeft()); Log("Countdown Time: " + LootingTimer.CountDowntime); Log("Killing Time left: " + KillingTimer.TimeLeft()); Thread.Sleep( 2000 ); /* while (_isLooting) { Log("Time left: " + LootingTimer.TimeLeft()); Log("IS LOOTING"); } while (!_isLooting) { Log("Time left: " + KillingTimer.TimeLeft()); if (KillingTimer.IsReady) { Log("Killing timer is ready"); } if (!KillingTimer.IsReady) { Log("Killing timer is NOT ready"); } Log("NO LOOTING"); } //Log("Killing done: " + _killingDone); } //List<WoWObject> lootableCorpses = new List<WoWObject>() {}; */ } } /* while (Products.IsStarted && _isLaunched) { while (_isLooting) { if (_lootingDone) { if (_lootingCompleted) { Log("Bot has finished looting available corpses."); } if (_lootingTimedOut) { Log("Bot has been looting for " + killingMaxTime + " minutes. (If you get this message often, you may want to adjust your settings.)"); } // Eventually I'd like to rework this to have the bot auto-adjust based on conditions. StopLooting(); } } while (!_isLooting) { if (_killingDone) { if (_killingCompleted) { Log("There are more than " + maxCorpses + " lootable mobs. Switching to looting."); } if (_killingTimedOut) { Log("Bot hasn't looted in over " + killingMaxTime + " minutes. Time to loot those corpses!"); } StartLooting(); } } } */ [Serializable] public class LootoggleSettings : Settings { [DefaultValue(3)] [Category("General Settings")] [DisplayName("Max Kill Time")] [Description("Maximum time bot will spend in pure killing mode between loot breaks")] public int killingMaxTime { get; set; } [DefaultValue(3)] [Category("General Settings")] [DisplayName("Max Loot Time")] [Description("Maximum time bot will spend looting before switching to looting phase")] public int lootingMaxTime { get; set; } [DefaultValue(40)] [Category("General Settings")] [DisplayName("Max Corpses")] [Description("Maximum number of lootable mobs bot will let lie before auto switching to looting (particularly helpful with group-farming).")] public int maxCorpses { get; set; } private LootoggleSettings() { killingMaxTime = 3; lootingMaxTime = 1; maxCorpses = 40; ConfigWinForm(new System.Drawing.Point(300, 400), "Lootoggle " + Translate.Get("Settings")); } public static LootoggleSettings CurrentSetting { get; set; } public bool Save() { try { return Save(AdviserFilePathAndName("Lootoggle", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("LootoggleSettings > Save(): " + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("Lootoggle", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<LootoggleSettings>(AdviserFilePathAndName("Lootoggle", ObjectManager.Me.Name+"."+Usefuls.RealmName)); return true; } CurrentSetting = new LootoggleSettings(); } catch (Exception e) { Logging.WriteError("LootoggleSettings > Load(): " + e); } return false; } } }
  11. Hey y'all! I'm actually SUPER bummed, because I've basically been working on this all day (learning c# as I go + I'm a bit slow...don't make fun of me). I finally had it all fixed down to only throwing one error...and now the bot won't even load the plugin. Can anyone see what's wrong? (All the log says is "Error to load plugin PATH\lootoggle.cs") using robotManager.Helpful; using System.Threading; using robotManager.Products; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; using System; using System.Collections.Generic; using System.IO; using System.ComponentModel; using robotManager; public class Lootoggle : wManager.Plugin.IPlugin { private bool _isLaunched; private bool _isLooting; private int KillTime; private int LootTime; private int timeToKill; private int timeToLoot; public void Initialize() { _isLaunched = true; _isLooting = true; LootoggleSettings.Load(); timeToKill = LootoggleSettings.CurrentSetting.KillMinutes * 60 * 1000; timeToLoot = LootoggleSettings.CurrentSetting.LootMinutes * 60 * 1000; Logging.Write("[Lootoggle] Started."); pluginLoop(); } public void Dispose() { _isLaunched = false; Logging.Write("[Lootoggle] Disposed."); } public void Settings() { LootoggleSettings.Load(); LootoggleSettings.CurrentSetting.ToForm(); LootoggleSettings.CurrentSetting.Save(); } public void pluginLoop() { while (Products.IsStarted && _isLaunched) { if (_isLooting) { wManager.wManagerSetting.CurrentSetting.LootMobs = _isLooting; Log("Bot will loot for " + LootTime + "."); Thread.Sleep(timeToLoot); Logging.Write("Disabling looting and continuing..."); _isLooting = !_isLooting; } if (!_isLooting) { wManager.wManagerSetting.CurrentSetting.LootMobs = _isLooting; Logging.Write("Bot will now stop looting and only kill for " + KillTime + "."); Thread.Sleep(timeToKill); _isLooting = !_isLooting; } } } [Serializable] public class LootoggleSettings : Settings { [DefaultValue(3)] [Category("General Settings")] [DisplayName("Kill Time")] [Description("How long (in minutes) should bot should kill shit?")] public int KillMinutes { get; set; } [DefaultValue(1)] [Category("General Settings")] [DisplayName("Loot Time")] [Description("How long (in minutes) should bot should loot before toggling looting back off.")] public int LootMinutes { get; set; } private LootoggleSettings() { KillMinutes = 3; LootMinutes = 1; ConfigWinForm(new System.Drawing.Point(300, 400), "Lootoggle " + Translate.Get("Settings")); } public static LootoggleSettings CurrentSetting { get; set; } /* Save/Load Functions */ public bool Save() { try { return Save(AdviserFilePathAndName("Lootoggle", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("LootoggleSettings > Save(): " + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("Lootoggle", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<LootoggleSettings>(AdviserFilePathAndName("Lootoggle", ObjectManager.Me.Name + "." + Usefuls.RealmName)); return true; } CurrentSetting = new LootoggleSettings(); } catch (Exception e) { Logging.WriteError("LootoggleSettings > Load(): " + e); } return false; } } }
  12. Howdy y'all! The title pretty much says it, but, at the moment, the second the bot is done harvesting an herb/mineral/skinning node/object, it will immediately go to stealth mode or change into ________ (at the moment it's Moonkin, since I'm going Boom) form...even if there is another mob to skin right next to it and even though the bot is then going to immediately mount (change into Flight Form). I imagine it's a c# condition to add to the fightclass? Problem is I don't know the bot states and can't figure out how this would be done.
×
×
  • Create New...