Jump to content

Matenia

Elite user
  • Posts

    2231
  • Joined

  • Last visited

Everything posted by Matenia

  1. using robotManager.Helpful; using robotManager.Products; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; using wManager.Plugin; using wManager.Events; using wManager.Wow.Bot.Tasks; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; using System.ComponentModel; using System.Threading.Tasks; using System.Configuration; using wManager.Wow.Class; public class Main : IPlugin { private string version = "1.6.1"; public static int timer = 0; public static bool _isLaunched; private static float saveDistance; public static Vector3 destinationVector = new Vector3(0, 0, 0); public static bool inProcessing = false; public static bool _takenTaxi = false; static FlightMasterDB from = (FlightMasterDB)null; static FlightMasterDB to = (FlightMasterDB)null; static FlightMasterDB discoverTaxiNode = (FlightMasterDB)null; public static bool _timer = false; public static bool _discoverTaxiTimer = false; public static bool changer = true; public static bool _updateNodes; public static bool checkPath = true; public static bool checkPathActive = false; public static FlightMasterDB checkPathActiveFM = (FlightMasterDB)null; public static bool cancelCheckPathThread = false; public static bool pauseCheckPathThread = false; public static string status = ""; public static string statusDiscover = ""; public static bool _copySettings { get; set; } public static bool _runScan = false; public static FlightMasterDB taxiToDiscover = (FlightMasterDB)null; public static bool _taxiToDiscover = false; public static bool _discoverInProessing = false; public static int stuckCounter = 0; //public static bool followingPath = false; //public static bool firstStart; //public static bool _logPause = false; //public static bool abortFlight = false; //public static bool _disposeInstance = false; //public static bool cancleOldMovement = false; //public static bool paused = false; //public static Vector3 myPositionAtStart = new Vector3(0, 0, 0); //public bool _deleteOldPath = false; public void Initialize() { Logging.Write("[VanillaFlightMaster]: Flight Master initialized - " + version); _isLaunched = true; inProcessing = false; _copySettings = true; _runScan = true; _updateNodes = false; cancelCheckPathThread = false; ingameSettings(); watchForEvents(); FNVFlightMasterSettings.Load(); applyDefaultNodes(); MovementEvents.OnMovementPulse += MovementEventsOnOnMovementPulse; MovementEvents.OnSeemStuck += MovementEventsOnOnSeemStuck; scanNearbyTaxi.Start(); flightMasterLoop(); } public void Dispose() { _runScan = false; cancelCheckPathThread = true; _isLaunched = false; _updateNodes = false; MovementEvents.OnMovementPulse -= MovementEventsOnOnMovementPulse; MovementEvents.OnSeemStuck -= MovementEventsOnOnSeemStuck; FNVFlightMasterSettings.CurrentSettings.Save(); Logging.Write("[VanillaFlightMaster]: Flight Master disposed"); } public void Settings() { FNVFlightMasterSettings.Load(); FNVFlightMasterSettings.CurrentSettings.ToForm(); FNVFlightMasterSettings.CurrentSettings.Save(); } public static void ingameSettings() { if(wManager.wManagerSetting.CurrentSetting.FlightMasterTaxiUse) { Logging.Write("[VanillaFlightMaster]: WRobots Taxi is enabled, going to disable it..."); wManager.wManagerSetting.CurrentSetting.FlightMasterTaxiUse = false; } } public static void applyDefaultNodes() { if(ObjectManager.Me.PlayerRace == PlayerFactions.NightElf) { FNVFlightMasterSettings.CurrentSettings.Darkshore = true; FNVFlightMasterSettings.CurrentSettings.Teldrassil = true; } if(ObjectManager.Me.PlayerRace == PlayerFactions.Human) FNVFlightMasterSettings.CurrentSettings.Stormwind = true; if(ObjectManager.Me.PlayerRace == PlayerFactions.Dwarf || ObjectManager.Me.PlayerRace == PlayerFactions.Gnome) FNVFlightMasterSettings.CurrentSettings.Ironforge = true; } private void flightMasterLoop() { while(Products.IsStarted && _isLaunched) { if(!Products.InPause && _takenTaxi || _timer) { while(ObjectManager.Me.IsOnTaxi) { Thread.Sleep(1000); } for(int timer = FNVFlightMasterSettings.CurrentSettings.pauseTaxiTime; timer > 0 && _timer; timer -= 1000) { Thread.Sleep(1000); } if(!scanNearbyTaxi.IsAlive) { Logging.Write("Taxi scan not running, restarting..."); scanNearbyTaxi.Start(); } if(!checkPathDuringRun.IsAlive && FNVFlightMasterSettings.CurrentSettings.useCheckPathThread) { Logging.Write("Check path is not running, restarting..."); checkPathDuringRun.Start(); } resetTaxi(); } Thread.Sleep(5000); } Dispose(); } private static void resetTaxi() { while(ObjectManager.Me.IsOnTaxi) { Thread.Sleep(5000); } Thread.Sleep(Usefuls.Latency * 3 + 1500); Logging.Write("[VanillaFlightMaster]: Reset taxi"); _takenTaxi = false; from = (FlightMasterDB)null; to = (FlightMasterDB)null; _timer = false; checkPath = true; checkPathActive = false; checkPathActiveFM = (FlightMasterDB)null; } private void watchForEvents() { EventsLuaWithArgs.OnEventsLuaWithArgs += (LuaEventsId id, List<string> args) => { //_updateNodes = true; if(id == wManager.Wow.Enums.LuaEventsId.TAXIMAP_OPENED && FNVFlightMasterSettings.CurrentSettings.updateTaxi) { if(!_updateNodes) { _updateNodes = true; //Logging.Write("[VanillaFlightMaster]: Taxi map opened"); List<FlightMasterDB> dbUpdate = fillDB(); int node = -1; foreach(var temp in dbUpdate) { if(temp.continent.Equals(checkContinent())) { node = -1; node = wManager.Wow.Helpers.Lua.LuaDoString<int>("for i=0,30 do if string.find(TaxiNodeName(i),'" + temp.name + "') then return i end end return -1"); //Logging.Write("Node is: " + node); if(node == -1 && temp.alreadyDiscovered) { Logging.Write("[VanillaFlightMaster]: Taxi node " + temp.name + " has not been discovered so far"); temp.alreadyDiscovered = false; FNVFlightMasterSettings.flightMasterSaveChanges(temp, false); } else if(node != -1 && !temp.alreadyDiscovered) { Logging.Write("[VanillaFlightMaster]: Taxi node " + temp.name + " has already been discovered"); temp.alreadyDiscovered = true; FNVFlightMasterSettings.flightMasterSaveChanges(temp, true); } } } _updateNodes = false; Thread.Sleep(Usefuls.Latency * 5 + 5000); } } }; } private static void MovementEventsOnOnSeemStuck() { Vector3 searingGorgeGate = new Vector3(-6033.529f, -2490.157f, 310.9456f); if((Usefuls.MapZoneName.Contains("Loch Modan") || Usefuls.MapZoneName.Contains("Searing Gorge")) && ObjectManager.Me.Position.DistanceTo2D(searingGorgeGate) < 50 && FNVFlightMasterSettings.CurrentSettings.pauseSearingGorge) { stuckCounter++; if(stuckCounter >= 5) { Logging.Write("[VanillaFlightMaster]: Repeated stucks detected at the locked gate between Loch Modan and Searing Gorge. Going to stop bot, to prevent getting caught"); stuckCounter = 0; Products.ProductStop(); } } else { stuckCounter = 0; } if(_timer || _takenTaxi) { Logging.Write("[VanillaFlightMaster]: SeemStuck detected, reset taxi to help solving it"); resetTaxi(); } } private static void MovementEventsOnOnMovementPulse(List<Vector3> points, CancelEventArgs cancelable) { // Logging.Write("Enter Movement event path count: " + points.Count); statusDiscover = Logging.Status; if(_taxiToDiscover && !discoverTaxiNode.Equals((FlightMasterDB)null) && !_discoverInProessing && !_updateNodes && !statusDiscover.Contains("Boat") && !statusDiscover.Contains("Ship")) { // Logging.Write("Enter _taxiToDiscover"); _discoverInProessing = true; Thread.Sleep(Usefuls.Latency + 500); cancelable.Cancel = true; checkPathActive = true; checkPathActiveFM = discoverTaxiNode; discoverTaxi(discoverTaxiNode); Thread.Sleep(Usefuls.Latency * 3); cancelable.Cancel = false; checkPathActive = false; } if(changer && !_updateNodes && !inProcessing && ObjectManager.Me.IsAlive) //&& points.Count > 1 { //Logging.Write("Enter take taxi actual step"); changer = false; if(!_taxiToDiscover && !_timer && !_takenTaxi && ObjectManager.Me.Position.DistanceTo(points.Last<Vector3>()) > FNVFlightMasterSettings.CurrentSettings.taxiTriggerDistance) { status = Logging.Status; if(FNVFlightMasterSettings.CurrentSettings.skipIfFollowPath && status.Contains("Follow Path") && !status.Contains("Resurrect") && calculateRealDistance(ObjectManager.Me.Position, points.Last<Vector3>()) < FNVFlightMasterSettings.CurrentSettings.skipIfFollowPathDistance) { Logging.Write("[VanillaFlightMaster]: Currently following path or distance to start (" + calculateRealDistance(ObjectManager.Me.Position, points.Last<Vector3>()) + " yards) is smaller than setting value (" + FNVFlightMasterSettings.CurrentSettings.skipIfFollowPathDistance + " yards)"); Thread.Sleep(1000); cancelable.Cancel = false; inProcessing = false; checkPathActive = true; changer = true; _timer = true; return; } destinationVector = points.Last<Vector3>(); saveDistance = calculateRealDistance(ObjectManager.Me.Position, points.Last<Vector3>()); Thread.Sleep(Usefuls.Latency + 500); cancelable.Cancel = true; if(!inProcessing) { from = getClosestFlightMasterFrom(); to = getClosestFlightMasterTo(); } Thread.Sleep(1000); if(!from.name.Contains(to.name) && !to.name.Contains("null") && !to.name.Contains("FlightMaster") && !from.name.Contains("null") && !from.Equals(to) && calculateRealDistance(ObjectManager.Me.Position, from.position) + calculateRealDistance(to.position, destinationVector) + FNVFlightMasterSettings.CurrentSettings.shorterMinDistance <= saveDistance) { Logging.Write("[VanillaFlightMaster]: Shorter path detected, taking Taxi from " + from.name + " to " + to.name); inProcessing = true; checkPathActive = true; checkPathActiveFM = from; //cancelable.Cancel = true; takeTaxi(from, to); //Logging.Write("After take taxi"); Thread.Sleep(1000); cancelable.Cancel = false; inProcessing = false; checkPathActive = true; } else { Logging.Write("[VanillaFlightMaster]: No shorter path available, skip flying"); cancelable.Cancel = false; _timer = true; inProcessing = false; } } changer = true; } //Logging.Write("Finished MovementPulseEvent"); } public static bool inCombat() { return Lua.LuaDoString<bool>("return UnitAffectingCombat('player');"); } public static bool inCombatPet() { return Lua.LuaDoString<bool>("return UnitAffectingCombat('pet');"); } Thread scanNearbyTaxi = new Thread(() => { int scanTimer = 10000; List<FlightMasterDB> npcScan = fillDB(); Logging.Write("[VanillaFlightMaster]: Taxi scan started"); while(robotManager.Products.Products.IsStarted) { //Logging.Write("In Taxi scan thread loop"); /* if(!_runScan) { Logging.Write("[VanillaFlightMaster]: Taxi scan disposed"); break; } */ if(_discoverTaxiTimer || _discoverInProessing) { Logging.Write("[VanillaFlightMaster]: Discover in processing or scan for nearby nodes paused"); for(int i = FNVFlightMasterSettings.CurrentSettings.pauseTaxiTime; i > 0; i -= 1000) { Thread.Sleep(1000); } _discoverTaxiTimer = false; } while(inCombat() || inCombatPet()) { Thread.Sleep(5000); } //Pause while training First Aid in Darnassus, to avoid conflicts with HumanMasterPlugin string status = Logging.Status; while(status.Contains("First Aid") && Usefuls.MapZoneName.Contains("Teldrassil")) { Logging.Write("[VanillaFlightMaster]: HumanMasterPlugin trying to train First Aid. Pausing undiscovered node scan for five minutes to avoid conflicts"); Thread.Sleep(300000); } if(Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !_taxiToDiscover && !ObjectManager.Me.IsOnTaxi) { foreach(var temp in npcScan) { if(checkContinent() == temp.continent && !temp.alreadyDiscovered && ObjectManager.Me.Position.DistanceTo(temp.position) < FNVFlightMasterSettings.CurrentSettings.detectTaxiDistance) { taxiToDiscover = temp; discoverTaxiNode = temp; _taxiToDiscover = true; Logging.Write("[VanillaFlightMaster]: Near undiscovered Taxi node found: " + temp.name); Thread.Sleep(1000 + Usefuls.Latency); while(!MovementManager.InMovement) { Thread.Sleep(100); } Reenable(); } } } Thread.Sleep(Usefuls.Latency * 10); npcScan = fillDB(); Thread.Sleep(scanTimer); } }); Thread checkPathDuringRun = new Thread(() => { Logging.Write("[VanillaFlightMaster]: Path checker started"); while(robotManager.Products.Products.IsStarted) { if(pauseCheckPathThread) { Thread.Sleep(5000); continue; } if(_timer) { Thread.Sleep(5000); continue; } if(cancelCheckPathThread) { Logging.Write("[VanillaFlightMaster]: Check path thread disposed"); break; } if(checkPathActive) { Thread.Sleep(5000); status = Logging.Status; if(MovementManager.CurrentPath.Last<Vector3>().DistanceTo(checkPathActiveFM.position) > 10 && !checkPathActiveFM.Equals((FlightMasterDB)null) && !status.Contains("Resurrect") && !status.Contains("To Town")) { Logging.Write("[VanillaFlightMaster: Current path does not lead to Flight Master of " + checkPathActiveFM.name + ". Reset path..."); checkPathActive = false; Reenable(); } Thread.Sleep(5000); } Thread.Sleep(5000); } }); //By Matenia private static async void Reenable() { //Logging.Write("Enter reenable"); await Task.Run(() => { Products.InPause = true; if(ObjectManager.Me.WowClass == WoWClass.Hunter) Lua.LuaDoString("RotaOn = false"); MovementManager.StopMove(); MovementManager.CurrentPath.Clear(); MovementManager.CurrentPathOrigine.Clear(); Thread.Sleep(5000); Products.InPause = false; if(ObjectManager.Me.WowClass == WoWClass.Hunter) Lua.LuaDoString("RotaOn = true"); Logging.Write("[VanillaFlightMaster]: Resetting pathing"); }); } private static float calculateRealDistance(Vector3 startVector, Vector3 destinationVector) { float distance = 0; List<Vector3> realDistance = new List<Vector3>(); realDistance = PathFinder.FindPath(startVector, destinationVector); for(int i = 0; i < realDistance.Count - 1; i++) { distance = distance + realDistance[i].DistanceTo2D(realDistance[i + 1]); } //Logging.Write("Real distance is: " + distance); return distance; } public static FlightMasterDB getClosestFlightMasterFrom() { List<FlightMasterDB> FMLnfmd = fillDB(); float tempDistance = 99999; FlightMasterDB returnObject = new FlightMasterDB("null", 0, new Vector3(0, 0, 0), false, false); foreach(var a in FMLnfmd) { if(a.alreadyDiscovered && a.position.DistanceTo(ObjectManager.Me.Position) < tempDistance && (a.continent == checkContinent())) { tempDistance = a.position.DistanceTo(ObjectManager.Me.Position); returnObject = a; } } return returnObject; } public static FlightMasterDB getClosestFlightMasterTo() { List<FlightMasterDB> FMLgcfmt = fillDB(); float tempDistance = 99999; FlightMasterDB returnObject = new FlightMasterDB("null", 0, new Vector3(0, 0, 0), false, false); foreach(var a in FMLgcfmt) { if(a.alreadyDiscovered && a.position.DistanceTo(destinationVector) < tempDistance && (a.continent == checkContinent())) { tempDistance = a.position.DistanceTo(destinationVector); returnObject = a; } } return returnObject; } public static bool checkContinent() { if(Usefuls.ContinentId == (int)ContinentId.Kalimdor) { //Logging.Write("[VanillaFlightMaster]: Currently located in Kalimdor"); return true; } else { //Logging.Write("[VanillaFlightMaster]: Currently located in Eastern Kingdoms"); return false; } } public static void waitFlying(string destinationFlightMaster) { while(ObjectManager.Me.IsOnTaxi) { Logging.Write("[VanillaFlightMaster]: On taxi, waiting"); Thread.Sleep(30000); } _takenTaxi = true; inProcessing = false; Thread.Sleep(5000); Reenable(); Logging.Write("[VanillaFlightMaster]: Arrived at destination " + destinationFlightMaster + " , finished waiting"); } public static List<FlightMasterDB> fillDB() { //FNVFlightMasterSettings.Load(); //True = Kalimdor ; False = Eastern Kingdoms List<FlightMasterDB> FMListe = new List<FlightMasterDB>(); FlightMasterDB Stormwind = new FlightMasterDB("Stormwind", 352, new Vector3(-8835.76f, 490.084f, 109.6157f), false, FNVFlightMasterSettings.CurrentSettings.Stormwind); FMListe.Add(Stormwind); FlightMasterDB ArathiHighlands = new FlightMasterDB("Arathi", 2835, new Vector3(-1240.03f, -2513.96f, 21.92969f), false, FNVFlightMasterSettings.CurrentSettings.ArathiHighlands); FMListe.Add(ArathiHighlands); FlightMasterDB Ashenvale = new FlightMasterDB("Ashenvale", 4267, new Vector3(2828.4f, -284.3f, 106.7f), true, FNVFlightMasterSettings.CurrentSettings.Ashenvale); FMListe.Add(Ashenvale); FlightMasterDB Darkshore = new FlightMasterDB("Darkshore", 3841, new Vector3(6343.2f, 561.651f, 15.79876f), true, FNVFlightMasterSettings.CurrentSettings.Darkshore); FMListe.Add(Darkshore); FlightMasterDB Stranglethorn = new FlightMasterDB("Stranglethorn", 2859, new Vector3(-14477.9f, 464.101f, 36.38163f), false, FNVFlightMasterSettings.CurrentSettings.StranglethornValley); FMListe.Add(Stranglethorn); FlightMasterDB Duskwood = new FlightMasterDB("Duskwood", 2409, new Vector3(-10513.8f, -1258.79f, 41.43174f), false, FNVFlightMasterSettings.CurrentSettings.Duskwood); FMListe.Add(Duskwood); FlightMasterDB FeralasFeathermoon = new FlightMasterDB("Feathermoon", 8019, new Vector3(-4370.5f, 3340f, 12f), true, FNVFlightMasterSettings.CurrentSettings.FeralasFeathermoon); FMListe.Add(FeralasFeathermoon); FlightMasterDB FeralasThalanaar = new FlightMasterDB("Thalanaar", 4319, new Vector3(-4491f, -781f, -40f), true, FNVFlightMasterSettings.CurrentSettings.FeralasThalanaar); FMListe.Add(FeralasThalanaar); FlightMasterDB Tanaris = new FlightMasterDB("Tanaris", 7823, new Vector3(-7224.9f, -3738.2f, 8.4f), true, FNVFlightMasterSettings.CurrentSettings.Tanaris); FMListe.Add(Tanaris); FlightMasterDB Hinterlands = new FlightMasterDB("The Hinterlands", 8018, new Vector3(282.1f, -2001.3f, 194.1f), false, FNVFlightMasterSettings.CurrentSettings.TheHinterlands); FMListe.Add(Hinterlands); FlightMasterDB Ironforge = new FlightMasterDB("Ironforge", 1573, new Vector3(-4821.13f, -1152.4f, 502.2116f), false, FNVFlightMasterSettings.CurrentSettings.Ironforge); FMListe.Add(Ironforge); FlightMasterDB Menethil = new FlightMasterDB("Wetlands", 1571, new Vector3(-3793.2f, -782.052f, 9.014864f), false, FNVFlightMasterSettings.CurrentSettings.Wetlands); FMListe.Add(Menethil); FlightMasterDB TheBarrens = new FlightMasterDB("The Barrens", 16227, new Vector3(-898.246f, -3769.65f, 11.71021f), true, FNVFlightMasterSettings.CurrentSettings.TheBarrens); FMListe.Add(TheBarrens); FlightMasterDB Redridge = new FlightMasterDB("Redridge", 931, new Vector3(-9435.8f, -2234.79f, 69.43174f), false, FNVFlightMasterSettings.CurrentSettings.RedridgeMountains); FMListe.Add(Redridge); FlightMasterDB Teldrassil = new FlightMasterDB("Teldrassil", 3838, new Vector3(8640.58f, 841.118f, 23.26363f), true, FNVFlightMasterSettings.CurrentSettings.Teldrassil); FMListe.Add(Teldrassil); FlightMasterDB Southshore = new FlightMasterDB("Hillsbrad", 2432, new Vector3(-715.146f, -512.134f, 26.54455f), false, FNVFlightMasterSettings.CurrentSettings.HillsbradFoothills); FMListe.Add(Southshore); FlightMasterDB Stonetalon = new FlightMasterDB("Stonetalon Mountains", 4407, new Vector3(2682.83f, 1466.45f, 233.6483f), true, FNVFlightMasterSettings.CurrentSettings.StonetalonMountains); FMListe.Add(Stonetalon); FlightMasterDB Thelsamar = new FlightMasterDB("Loch Modan", 1572, new Vector3(-5424.85f, -2929.87f, 347.5623f), false, FNVFlightMasterSettings.CurrentSettings.LochModan); FMListe.Add(Thelsamar); FlightMasterDB Theramore = new FlightMasterDB("Dustwallow Marsh", 4321, new Vector3(-3828.88f, -4517.51f, 10.66067f), true, FNVFlightMasterSettings.CurrentSettings.DustwallowMarsh); FMListe.Add(Theramore); FlightMasterDB WesternP = new FlightMasterDB("Western Pleaguelands", 12596, new Vector3(928.3f, -1429.1f, 64.8f), false, FNVFlightMasterSettings.CurrentSettings.WesternPlaguelands); FMListe.Add(WesternP); FlightMasterDB Westfall = new FlightMasterDB("Westfall", 523, new Vector3(-10628.8f, 1037.79f, 34.43174f), false, FNVFlightMasterSettings.CurrentSettings.Westfall); FMListe.Add(Westfall); FlightMasterDB EasternP = new FlightMasterDB("Eastern Pleaguelands", 12617, new Vector3(2269.9f, -5345.4f, 86.9f), false, FNVFlightMasterSettings.CurrentSettings.EasternPlaguelands); FMListe.Add(EasternP); FlightMasterDB SearingGorge = new FlightMasterDB("Searing Gorge", 2941, new Vector3(-6559.1f, -1169.4f, 309.8f), false, FNVFlightMasterSettings.CurrentSettings.SearingGorge); FMListe.Add(SearingGorge); FlightMasterDB BurningSteppes = new FlightMasterDB("Burning Steppes", 2299, new Vector3(-8365.1f, -2758.5f, 185.6f), false, FNVFlightMasterSettings.CurrentSettings.BurningSteppes); FMListe.Add(BurningSteppes); FlightMasterDB BlastedLands = new FlightMasterDB("Blasted Lands", 8609, new Vector3(-11110.2f, -3437.1f, 79.2f), false, FNVFlightMasterSettings.CurrentSettings.BlastedLands); FMListe.Add(BlastedLands); FlightMasterDB Azshara = new FlightMasterDB("Azshara", 12577, new Vector3(2718.2f, -3880.8f, 101.4f), true, FNVFlightMasterSettings.CurrentSettings.Azshara); FMListe.Add(Azshara); FlightMasterDB Felwood = new FlightMasterDB("Felwood", 12578, new Vector3(6204.2f, -1951.4f, 571.3f), true, FNVFlightMasterSettings.CurrentSettings.Felwood); FMListe.Add(Felwood); FlightMasterDB Winterspring = new FlightMasterDB("Winterspring", 11138, new Vector3(6800.5f, -4742.4f, 701.5f), true, FNVFlightMasterSettings.CurrentSettings.Winterspring); FMListe.Add(Winterspring); FlightMasterDB UngoroCreater = new FlightMasterDB("goro Crater", 10583, new Vector3(-6110.5f, -1140.4f, -186.9f), true, FNVFlightMasterSettings.CurrentSettings.UngoroCrater); FMListe.Add(UngoroCreater); FlightMasterDB Silithus = new FlightMasterDB("Silithus", 15177, new Vector3(-6758.6f, 775.6f, 89f), true, FNVFlightMasterSettings.CurrentSettings.Silithus); FMListe.Add(Silithus); FlightMasterDB Desolace = new FlightMasterDB("Desolace", 6706, new Vector3(136f, 1326f, 193f), true, FNVFlightMasterSettings.CurrentSettings.Desolace); FMListe.Add(Desolace); return FMListe; } /* public static bool validFlight(String from, String to) { bool von = false; bool zu = false; List<FlightMasterDB> FMLvf = fillDB(); for(int i = 0; i < FMLvf.Count; i++) { if(FMLvf[i].name.Contains(from)) { von = FMLvf[i].continent; } if(FMLvf[i].name.Contains(to)) { zu = FMLvf[i].continent; } } return von != zu; } public static bool discoveredTaxiNodes(String from, String to) { List<FlightMasterDB> FMLDTN = fillDB(); foreach(var ele in FMLDTN) { if(ele.name.Contains(from)) { //Logging.Write("Test 1"); if(!ele.alreadyDiscovered) { Logging.Write("[VanillaFlightMaster]: Taxi node from " + ele.name + " has not been discovered so far. Abort taking taxi."); return false; } } } foreach(var ele in FMLDTN) { //Logging.Write("Test 2"); if(ele.name.Contains(to)) { if(!ele.alreadyDiscovered) { Logging.Write("[VanillaFlightMaster]: Taxi node to " + ele.name + " has not been discovered so far. Abort taking taxi."); return false; } } } //Logging.Write("Test 3"); return true; } */ private static void takeTaxi(FlightMasterDB from, FlightMasterDB to) { //Logging.Write("Taking taxi from " + from.name + " to " + to.name); // Logging.Write("Distance: " + ObjectManager.Me.Position.DistanceTo(from.position)); if(wManager.Wow.Bot.Tasks.GoToTask.ToPosition(from.position, 3.5f, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore)) { if(wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(from.position, from.NPCId, -1, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false)) { //Logging.Write("Enter select taxi"); //Logging.Write("FROM OBJECT: " + from.name); while(!ObjectManager.Me.IsOnTaxi) { if(ObjectManager.Me.IsMounted) wManager.Wow.Bot.Tasks.MountTask.DismountMount(false, false, 100); Usefuls.SelectGossipOption(GossipOptionsType.taxi); Thread.Sleep(Usefuls.Latency + 1500); while(_updateNodes) { Logging.Write("[VanillaFlightMaster]: Taxi node update in progress, waiting..."); Thread.Sleep(10000); } int node = Lua.LuaDoString<int>("for i=0,30 do if string.find(TaxiNodeName(i),'" + to.name + "') then return i end end"); Lua.LuaDoString("TakeTaxiNode(" + node + ")"); Logging.Write("[VanillaFlightMaster]: Taking Taxi from " + from.name + " to " + to.name); Thread.Sleep(Usefuls.Latency + 500); robotManager.Helpful.Keyboard.DownKey(wManager.Wow.Memory.WowMemory.Memory.WindowHandle, System.Windows.Forms.Keys.Escape); Thread.Sleep(Usefuls.Latency + 2500); if(!ObjectManager.Me.IsOnTaxi) wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(from.position, from.NPCId, -1, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false); } if(ObjectManager.Me.IsOnTaxi) { //Logging.Write("[VanillaFlightMaster]: Taking taxi successful!"); waitFlying(to.name); } } } } private static void discoverTaxi(FlightMasterDB flightMasterToDiscover) { FNVFlightMasterSettings.Load(); List<FlightMasterDB> FMLdt = fillDB(); if(wManager.Wow.Bot.Tasks.GoToTask.ToPosition(flightMasterToDiscover.position, 3.5f, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore)) { wManager.Wow.Bot.Tasks.GoToTask.ToPosition(flightMasterToDiscover.position, 3.5f, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore); if(wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(flightMasterToDiscover.position, flightMasterToDiscover.NPCId, -1, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false)) { wManager.wManagerSetting.ClearBlacklistOfCurrentProductSession(); wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(flightMasterToDiscover.position, flightMasterToDiscover.NPCId, -1, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false); if(ObjectManager.Me.IsMounted) wManager.Wow.Bot.Tasks.MountTask.DismountMount(false, false, 100); Usefuls.SelectGossipOption(GossipOptionsType.taxi); Thread.Sleep(Usefuls.Latency + 1500); while(_updateNodes) { Logging.Write("[VanillaFLightMaster]: Taxi node update in progress..."); Thread.Sleep(10000); } Logging.Write("[VanillaFlightMaster]: Flight Master " + flightMasterToDiscover.name + " discovered"); flightMasterToDiscover.alreadyDiscovered = true; FNVFlightMasterSettings.flightMasterSaveChanges(flightMasterToDiscover, true); Thread.Sleep(Usefuls.Latency * 5); timer = 0; //_timer = true; discoverTaxiNode = (FlightMasterDB)null; _taxiToDiscover = false; _discoverInProessing = false; _discoverTaxiTimer = true; Reenable(); return; } } _discoverInProessing = false; return; } } public class FlightMasterDB { public FlightMasterDB(String name, int NPCId, Vector3 position, bool continent, bool alreadyDiscovered) { this.name = name; this.NPCId = NPCId; this.position = position; this.continent = continent; this.alreadyDiscovered = alreadyDiscovered; } public int NPCId { get; set; } public Vector3 position { get; set; } public String name { get; set; } public bool continent { get; set; } public bool alreadyDiscovered { get; set; } } [Serializable] public class FNVFlightMasterSettings : Settings { public FNVFlightMasterSettings() { //Settings this.taxiTriggerDistance = 1000; this.pauseTaxiTime = 50000; this.detectTaxiDistance = 50; this.shorterMinDistance = 1000; this.skipIfFollowPath = true; this.updateTaxi = true; this.skipIfFollowPathDistance = 5000; this.useCheckPathThread = false; this.pauseSearingGorge = true; //FlightMaster discovered //Eastern Kingdoms this.ArathiHighlands = false; this.Wetlands = false; this.WesternPlaguelands = false; this.EasternPlaguelands = false; this.HillsbradFoothills = false; this.TheHinterlands = false; this.LochModan = false; this.Ironforge = false; this.SearingGorge = false; this.BurningSteppes = false; this.RedridgeMountains = false; this.Stormwind = false; this.Westfall = false; this.Duskwood = false; this.StranglethornValley = false; this.BlastedLands = false; //Kalimdor this.Teldrassil = false; this.Darkshore = false; this.Winterspring = false; this.Azshara = false; this.Ashenvale = false; this.StonetalonMountains = false; this.Desolace = false; this.TheBarrens = false; this.Tanaris = false; this.FeralasFeathermoon = false; this.FeralasThalanaar = false; this.UngoroCrater = false; this.DustwallowMarsh = false; this.Silithus = false; this.Moonglade = false; this.Felwood = false; } public static void flightMasterSaveChanges(FlightMasterDB needToChange, bool value) { if(needToChange.name.Contains("Arathi")) CurrentSettings.ArathiHighlands = value; if(needToChange.name.Contains("Wetlands")) CurrentSettings.Wetlands = value; if(needToChange.name.Contains("Western")) CurrentSettings.WesternPlaguelands = value; if(needToChange.name.Contains("Eastern")) CurrentSettings.EasternPlaguelands = value; if(needToChange.name.Contains("Hillsbrad")) CurrentSettings.HillsbradFoothills = value; if(needToChange.name.Contains("Hinterlands")) CurrentSettings.TheHinterlands = value; if(needToChange.name.Contains("Modan")) CurrentSettings.LochModan = value; if(needToChange.name.Contains("Ironforge")) CurrentSettings.Ironforge = value; if(needToChange.name.Contains("Searing")) CurrentSettings.SearingGorge = value; if(needToChange.name.Contains("Burning")) CurrentSettings.BurningSteppes = value; if(needToChange.name.Contains("Redridge")) CurrentSettings.RedridgeMountains = value; if(needToChange.name.Contains("Stormwind")) CurrentSettings.Stormwind = value; if(needToChange.name.Contains("Westfall")) CurrentSettings.Westfall = value; if(needToChange.name.Contains("Duskwood")) CurrentSettings.Duskwood = value; if(needToChange.name.Contains("Stranglethorn")) CurrentSettings.StranglethornValley = value; if(needToChange.name.Contains("Blasted")) CurrentSettings.BlastedLands = value; if(needToChange.name.Contains("Teldrassil")) CurrentSettings.Teldrassil = value; if(needToChange.name.Contains("Darkshore")) CurrentSettings.Darkshore = value; if(needToChange.name.Contains("Winterspring")) CurrentSettings.Winterspring = value; if(needToChange.name.Contains("Azshara")) CurrentSettings.Azshara = value; if(needToChange.name.Contains("Ashenvale")) CurrentSettings.Ashenvale = value; if(needToChange.name.Contains("Stonetalon")) CurrentSettings.StonetalonMountains = value; if(needToChange.name.Contains("Desolace")) CurrentSettings.Desolace = value; if(needToChange.name.Contains("Tanaris")) CurrentSettings.Tanaris = value; if(needToChange.name.Contains("Barrens")) CurrentSettings.TheBarrens = value; if(needToChange.name.Contains("Feathermoon")) CurrentSettings.FeralasFeathermoon = value; if(needToChange.name.Contains("Thalanaar")) CurrentSettings.FeralasThalanaar = value; if(needToChange.name.Contains("ro Crater")) CurrentSettings.UngoroCrater = value; if(needToChange.name.Contains("Dustwallow")) CurrentSettings.DustwallowMarsh = value; if(needToChange.name.Contains("Silithus")) CurrentSettings.Silithus = value; if(needToChange.name.Contains("Felwood")) CurrentSettings.Felwood = value; FNVFlightMasterSettings.CurrentSettings.Save(); Thread.Sleep(2500); try { FNVFlightMasterSettings.CurrentSettings = Load<FNVFlightMasterSettings>(AdviserFilePathAndName("VanillaFlightMaster_DB", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch(Exception e) { Logging.Write("[VanillaFlightMaster]: Error when trying to reload DB file -> " + e); } Logging.Write("[VanillaFlightMaster]: Settings saved of Flight Master " + needToChange.name); return; } public static FNVFlightMasterSettings CurrentSettings { get; set; } public bool Save() { try { return Save(AdviserFilePathAndName("VanillaFlightMaster_DB", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch(Exception e) { Logging.WriteDebug("VanillaFlightMaster_DB => Save(): " + e); return false; } } public static bool Load() { try { if(File.Exists(AdviserFilePathAndName("VanillaFlightMaster_DB", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { FNVFlightMasterSettings.CurrentSettings = Load<FNVFlightMasterSettings>(AdviserFilePathAndName("VanillaFlightMaster_DB", ObjectManager.Me.Name + "." + Usefuls.RealmName)); return true; } FNVFlightMasterSettings.CurrentSettings = new FNVFlightMasterSettings(); } catch(Exception e) { Logging.WriteDebug("VanillaFlightMaster_DB => Load(): " + e); } return false; } [Setting] [DefaultValue(1000)] [Category("1 - Main")] [DisplayName("Trigger Distance")] [Description("Sets how long your distance to your destination has to be, to trigger use of taxi")] public int taxiTriggerDistance { get; set; } [Setting] [DefaultValue(50000)] [Category("1 - Main")] [DisplayName("Pause Taxi Time")] [Description("Sets how long taxi is paused after use, to avoid loops. Only change it, if you experience issues")] public int pauseTaxiTime { get; set; } [Setting] [DefaultValue(50)] [Category("1 - Main")] [DisplayName("Discover Distance")] [Description("Min distance to discover an undiscovered taxi node")] public int detectTaxiDistance { get; set; } [Setting] [DefaultValue(1000)] [Category("1 - Main")] [DisplayName("Shorter Path Min")] [Description("Sets how much shorter a path has to be, to trigger taxi")] public int shorterMinDistance { get; set; } [Setting] [DefaultValue(false)] [Category("1 - Main")] [DisplayName("Use check path thread")] [Description("Checks if current path leads to Flight Master, while take taxi is running. Resets path, if otherwise")] public bool useCheckPathThread { get; set; } [Setting] [DefaultValue(true)] [Category("2 - Useful")] [DisplayName("1. Skip if Follow Path / Boat step")] [Description("Skips take taxi, if currently executing a Follow Path or Boat Quester step. When running a profile with dedicated paths")] public bool skipIfFollowPath { get; set; } [Setting] [DefaultValue(true)] [Category("2 - Useful")] [DisplayName("2. Update taxi nodes")] [Description("Scans and updates all entries on the taxi map of the current continent, if they have already been discovered. Triggers, when the taxi map is opened")] public bool updateTaxi { get; set; } [Setting] [DefaultValue(5000)] [Category("2 - Useful")] [DisplayName("1.1 Skip if ... min distance")] [Description("Won't skip taxi min distance to destination")] public float skipIfFollowPathDistance { get; set; } [Setting] [DefaultValue(true)] [Category("2 - Useful")] [DisplayName("3. Stop bot at Searing Gorge gate")] [Description("Stops the bot, to prevent it from running into the Searing Gorge gate from Loch Modan and getting stuck over and over again")] public bool pauseSearingGorge { get; set; } //FlightMaster //Eastern Kingdoms public bool Stormwind { get; set; } public bool Westfall { get; set; } public bool RedridgeMountains { get; set; } public bool Duskwood { get; set; } public bool StranglethornValley { get; set; } public bool Ironforge { get; set; } public bool BurningSteppes { get; set; } public bool BlastedLands { get; set; } public bool SearingGorge { get; set; } public bool LochModan { get; set; } public bool Wetlands { get; set; } public bool ArathiHighlands { get; set; } public bool HillsbradFoothills { get; set; } public bool WesternPlaguelands { get; set; } public bool EasternPlaguelands { get; set; } public bool TheHinterlands { get; set; } //Kalimdor public bool Ashenvale { get; set; } public bool Azshara { get; set; } public bool Darkshore { get; set; } public bool Teldrassil { get; set; } public bool Desolace { get; set; } public bool DustwallowMarsh { get; set; } public bool Felwood { get; set; } public bool FeralasFeathermoon { get; set; } public bool FeralasThalanaar { get; set; } public bool Moonglade { get; set; } public bool Silithus { get; set; } public bool StonetalonMountains { get; set; } public bool Tanaris { get; set; } public bool TheBarrens { get; set; } public bool UngoroCrater { get; set; } public bool Winterspring { get; set; } } Source code I still had access to - now that FNV disappeared I wanted to publish it in case someone wanted to take over
  2. Version 1.3

    669 downloads

    SmoothMove by @reapler updated to be a bit less spazzy (should be turned off in water) and working well with Framelock during combat with any of my fightclasses. Should also work in Deeprun Tram with HMP (not tested fully). All credit to reapler for being a fucking genius:
  3. Great, you probably failed to install it correctly or update it when wRobot was updated. As always - and in BIG LETTERS in the original post, you get support on Discord. It's also not very helpful when you talk about big red letters but then don't post the actual error message.
  4. @Marsbar you can do this completely automatically: Lua.LuaDoString(@" if GetItemInfoFromItemLink ~= nil then return end function GetItemInfoFromItemLink(link) local itemId = nil; if ( type(link) == 'string' ) then _,_, itemId = string.find(link, 'item:(%d+):'); if (itemId) then local version, build, date = GetBuildInfo(); if (tonumber(build) > 5875) then local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture = GetItemInfo(itemId); return itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemTexture; else return GetItemInfo(itemId); end end end end "); uint quiverSlotCount = Lua.LuaDoString<uint>(@" for slot = 20,23 do local link = GetInventoryItemLink('player', slot); if link then then local itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemTexture = GetItemInfoFromItemLink(link); if itemType == 'Quiver' then return GetContainerNumSlots(slot - 19); -- gets back slot end end end "); Works at least vanilla => WotLK. So you can turn that into a free plugina nd post it here :)
  5. You can do the focus part in vanilla by using mouseover as the unit and writing the mouseover guid into memory. Use my vanilla fightclass framework as an example
  6. Updated my code example
  7. Don't use addons while botting, especially not texture packs
  8. List.Any(unit => unit.CreatureTypeTarget == "Humanoid" ) Basically like that (pseudo code)
  9. You disable food and drink in hmp, then let your fightclass take care of food and water.
  10. You should try it in the wRobot dev tools and to test it you can use: for i=1,40 do local name, rank, iconTexture, count, debuffType, duration, timeLeft = UnitDebuff('player', i); if debuffType == 'Disease' then hasDebuff = true break; end end DEFAULT_CHAT_FRAME:AddMessage(hasDebuff and 'true' or 'false')
  11. buffed("Moonfire", "target") does not exist. You're trying to use some functions that are either PQR and not proper Lua or from within an addon that wRobot might not have access to UseAction should use the macro regardless of its contents (but then throw an error, potentially). Also what you're doing, starting with /script or /run are technically "macros" in that they execute Lua only after the "/run" portion. Edit: After re-reading it seems that this might be due to wRobot's Lua protection (so it doesn't get caught for unlocking). Unsure why this would cause issues.
  12. If that works, then UseAction(1) should work and press the button in that action slot. If you are using custom action slots through addons, DON'T.
  13. Shouldn't be a problem. Try DEFAULT_CHAT_FRAME:AddMessage('test message ingame') and see if it prints anything in your chat frame
  14. Does it throw a Lua error ingame? Otherwise you could put the macro on an action slot, then use UseAction(1) http://wowwiki.wikia.com/wiki/API_UseAction?oldid=181130
  15. RunMacro takes an id, not a name. And yes, you need to activate "not spell, is lua script" for that particular one.
  16. Update your fightclass. It uses Life Tap to 25% HP unless you're out of combat (in which case it life taps until Regeneration by wRobot is triggered). Immolate for pulling remains to be the best spell. What would you have it rather do?
  17. https://wow.gamepedia.com/API_RunMacro it's a simple Lua call
  18. Version 1.2

    149 downloads

    Plugin that automatically makes you walk to the warlock pet trainer, buy the books and learn them - but only if you are within 800 yards (so right after regular training). You can adjust the code for this yourself. The "Entry" (Id for your pet) might change depending on the server, but in my tests Imp has always been 416. Voidwalker can vary - so you might need to adjust this yourself. You can get the current entry by summoning Voidwalker and using development tools in wRobot to get ObjectManager.Pet.Entry. This will be included in the next HMP release.
  19. I forgot string.match is not in vanilla, this works across vanilla-wotlk: public static int GetItemCount(string itemName) { string countLua = $@" local fullCount = 0; for bag=0,4 do for slot=1,36 do local itemLink = GetContainerItemLink(bag, slot); if (itemLink) then local _,_, itemId = string.find(itemLink, 'item:(%d+):'); if (GetItemInfo(itemId) == ""{itemName}"") then local texture, count = GetContainerItemInfo(bag, slot); fullCount = fullCount + count; end end end end return fullCount;"; return Lua.LuaDoString<int>(countLua); }
  20. As far as I know, the IsSitting boolean has never existed. So basically your fightclass is throwing errors because it's not for tbc
  21. It's a bug with the free auto choose food and drink plugin it seems. Make sure it's up to date. If it is, I'll have to fix this on Monday when I get back home.
  22. You should put in at least 100ms sleeps, otherwise this will fry your cpu
×
×
  • Create New...