Exemple #1
0
    public override void Execute(ref uint workAmount)
    {
        if (!isValid)
        {
            if (grabFrom != null)
            {
                GoToTask grabTask = new GoToTask(this.TaskName, grabFrom.GetLocation());
                grabTask.TaskCompletedHandler += ReachedSourceLocation;
                taskPrqQueue.Enqueue(grabTask);

                GoToTask dropTask = new GoToTask(this.TaskName, dropOff.GetLocation());
                dropTask.TaskCompletedHandler += ReachedDestinationLocation;
                taskPrqQueue.Enqueue(dropTask);

                isValid = true;
            }
            else
            {
                OnFailure("Couldnt find resource: " + resourceType.ToString());
            }
        }
        else
        {
            base.Execute(ref workAmount);
        }
    }
Exemple #2
0
        public override void Run()
        {
            Logger.LogDebug("************ RUNNING LEARN RECIPE FROM TRAINER ************");
            Broadcaster.autoBroadcast = false;

            Step currentStep = profession.CurrentStep;
            Npc  trainer     = profession.ProfessionTrainer;

            Logger.Log($"Learning {currentStep.ItemoCraft.Name} at NPC {trainer.Entry}");

            // Check if continent ok
            if ((ContinentId)Usefuls.ContinentId != trainer.ContinentId)
            {
                Logger.Log($"The trainer is on continent {trainer.ContinentId}, launching traveler");
                Bot.SetContinent(trainer.ContinentId);
                return;
            }

            if (GoToTask.ToPositionAndIntecractWithNpc(trainer.Position, trainer.Entry, trainer.GossipOption))
            {
                ToolBox.LearnthisSpell(currentStep.ItemoCraft.Name);
                Thread.Sleep(1000);
            }

            currentStep.KnownRecipe = ToolBox.RecipeIsKnown(currentStep.ItemoCraft.Name, profession);

            Broadcaster.autoBroadcast = true;
        }
Exemple #3
0
    private void OnRightClick()
    {
        GameObject hittedObj      = GameObjectUnderMouse();
        int        hittedObjLayer = hittedObj.layer;

        if (hittedObjLayer == layerMaskToLayer(TerrainLayerMask))
        {
            ClearDeadUnits();
            SortByDistance(endDragRayHit.point);
            for (int i = 0; i < SelectedUnits.Count; i++)
            {
                if (SelectedUnits[i].IsTaskAvailable <GoToTask>())
                {
                    GoToTask goToTask = SelectedUnits[i].ChangeTask <GoToTask>();
                    goToTask.StartTask(endDragRayHit.point);
                }
            }
        }
        else if (hittedObjLayer == layerMaskToLayer(EnemyUnitsLayerMask) || hittedObjLayer == layerMaskToLayer(EnemyBuildingLayerMask))
        {
            ClearDeadUnits();
            SortByDistance(hittedObj.transform.position);
            for (int i = 0; i < SelectedUnits.Count; i++)
            {
                if (SelectedUnits[i].IsTaskAvailable <AttackTask>())
                {
                    AttackTask attackTask = SelectedUnits[i].ChangeTask <AttackTask>();
                    attackTask.StartTask(hittedObj.transform);
                }
            }
        }
    }
        public override void Run()
        {
            Logger.LogDebug("************ RUNNING BUY AND LEARN RECIPE STATE ************");

            Step currentStep  = profession.CurrentStep;
            var  RecipeVendor = currentStep.ItemoCraft.RecipeVendor;

            Logger.Log($"Buying {currentStep.ItemoCraft.Name} recipe at NPC {profession.ProfessionTrainer.Entry}");

            // Check if continent ok
            if ((ContinentId)Usefuls.ContinentId != RecipeVendor.ContinentId)
            {
                Logger.Log($"The vendor is on continent {RecipeVendor.ContinentId}, launching traveler");
                Bot.SetContinent(RecipeVendor.ContinentId);
                return;
            }

            Broadcaster.autoBroadcast = false;

            if (GoToTask.ToPositionAndIntecractWithNpc(RecipeVendor.Position, RecipeVendor.Entry, RecipeVendor.GossipOption))
            {
                Vendor.BuyItem(ItemsManager.GetNameById(currentStep.ItemoCraft.RecipeItemId), 1);
                Thread.Sleep(2000);

                ItemsManager.UseItemByNameOrId(currentStep.ItemoCraft.RecipeItemId.ToString());
                Usefuls.WaitIsCasting();
                Thread.Sleep(300);
            }

            currentStep.KnownRecipe = ToolBox.RecipeIsKnown(currentStep.ItemoCraft.Name, profession);

            Broadcaster.autoBroadcast = true;
        }
Exemple #5
0
        public override void Run()
        {
            Logger.LogDebug("************ RUNNING LEARN PROFESSION STATE ************");
            Broadcaster.autoBroadcast = false;

            Npc trainer = profession.ProfessionTrainer;

            // Learn Profession
            Logger.Log($"Learning {profession.ProfessionSpell} at NPC {trainer.Entry}");

            // Check if continent ok
            if ((ContinentId)Usefuls.ContinentId != trainer.ContinentId)
            {
                Logger.Log($"The trainer is on continent {trainer.ContinentId}, launching traveler");
                Bot.SetContinent(trainer.ContinentId);
                return;
            }

            if (GoToTask.ToPositionAndIntecractWithNpc(trainer.Position, trainer.Entry, trainer.GossipOption))
            {
                ToolBox.LearnthisSpell(profession.ProfessionSpell);
                profession.HasCheckedIfWeKnowRecipeFlag = false;
                Thread.Sleep(1000);
            }

            Broadcaster.autoBroadcast = true;
        }
Exemple #6
0
 //To Outland
 public static void HordeNorthrendToOutland()
 {
     if (Usefuls.ContinentId == (int)ContinentId.Northrend)
     {
         GoToTask.ToPositionAndIntecractWithGameObject(DalaranPortalToShattrathPosition, DalaranPortalToShattrathId);
         Thread.Sleep(5000);
     }
 }
Exemple #7
0
 // ********** FROM NORTHREND **********
 //To EK
 public static void HordeNorthrendToEK()
 {
     if (Usefuls.ContinentId == (int)ContinentId.Northrend)
     {
         GoToTask.ToPositionAndIntecractWithGameObject(DalaranPortalToUndercityPosition, DalaranPortalToUndercityId);
         Thread.Sleep(5000);
     }
 }
Exemple #8
0
 // ********** FROM KALIMDOR **********
 // To EK
 public static void HordeKalimdorToEK()
 {
     if (Usefuls.ContinentId == (int)ContinentId.Kalimdor)
     {
         GoToTask.ToPositionAndIntecractWithGameObject(OGPortalToBlastedLandsPosition, OGPortalToBlastedLandsId);
         Thread.Sleep(5000);
     }
 }
Exemple #9
0
 // ********** FROM OUTLAND **********
 // To Kalimdor
 public static void HordeOutlandToKalimdor()
 {
     if (Usefuls.ContinentId == (int)ContinentId.Expansion01)
     {
         GoToTask.ToPositionAndIntecractWithGameObject(shattrathPortalToKalimdorPosition, shattrathPortalToKalimdorId);
         Thread.Sleep(5000);
     }
 }
Exemple #10
0
 // To Kalimdor
 public static void HordeEKToKalimdor()
 {
     if (Usefuls.ContinentId == (int)ContinentId.Azeroth)
     {
         GoToTask.ToPosition(tirisfalPlatformZepOrgrimmar);
         WaitForTransport(ZeppelinTirisfalToOrgrimmarId, 15);
         GoToTask.ToPosition(insideZeppelinTirisfalToOrgrimmar, 1);
         WaitOnTransport(kalimdorlPlatformZepTirisfal, 15, ContinentId.Kalimdor);
     }
 }
Exemple #11
0
    // ******************************** HORDE ********************************

    // ********** FROM EK **********
    // To Outland
    public static void HordeEKToOutland()
    {
        if (Usefuls.ContinentId == (int)ContinentId.Azeroth)
        {
            GoToTask.ToPosition(new Vector3(-11920.39, -3206.81, -15.35475f));
            Thread.Sleep(5000);
            GoToTask.ToPosition(new Vector3(-182.5485, 1023.459, 54.23014));
            Thread.Sleep(5000);
        }
    }
Exemple #12
0
 // To Northrend
 public static void HordeKalimdorToNorthrend()
 {
     if (Usefuls.ContinentId == (int)ContinentId.Kalimdor)
     {
         // first go down the tower
         GoToTask.ToPosition(new Vector3(1168.775, -4164.387, 22.71999));
         // then almost all the way up the tower
         GoToTask.ToPosition(new Vector3(1166.608, -4157.879, 49.74893));
         GoToTask.ToPosition(kalimdorlPlatformZepNorthrend, 0, true);
         WaitForTransport(ZeppelinKalidmdorToNorthrendId, 30);
         GoToTask.ToPosition(insideZeppelinKalimdorToNorthrend, 1);
         WaitOnTransport(northrendPlatformZepKalimdor, 25, ContinentId.Northrend);
     }
 }
        public override void Run()
        {
            Logger.LogDebug("************ RUNNING BUY MATERIALS STATE ************");
            Broadcaster.autoBroadcast = false;

            Step currentStep = profession.CurrentStep;

            foreach (Item.Mat mat in currentStep.ItemoCraft.Materials)
            {
                int amountMissing = currentStep.GetAmountMissingMaterial(mat);
                if (mat.Item.CanBeBought)
                {
                    Npc vendor = mat.Item.Vendor ?? profession.SuppliesVendor;
                    Logger.Log($"Buying {amountMissing} {mat.Item.Name} from NPC {vendor.Entry}");

                    // Check if continent ok
                    if ((ContinentId)Usefuls.ContinentId != vendor.ContinentId)
                    {
                        Logger.Log($"The vendor is on continent {vendor.ContinentId}, launching traveler");
                        Bot.SetContinent(vendor.ContinentId);
                        return;
                    }

                    int estimatedPrice = mat.Item.EstimatedPrice * mat.Amount * amountMissing;
                    Logger.Log($"Estimated price : {estimatedPrice}");
                    if (ObjectManager.Me.GetMoneyCopper >= mat.Amount * amountMissing)
                    {
                        if (GoToTask.ToPositionAndIntecractWithNpc(vendor.Position, vendor.Entry, vendor.GossipOption))
                        {
                            //Vendor.SellItems(wManagerSetting.CurrentSetting.ForceSellList, wManagerSetting.CurrentSetting.DoNotSellList, ToolBox.vendorQuality);

                            int amountToHaveInBag = amountMissing + ItemsManager.GetItemCountById(mat.Item.ItemId);
                            while (ItemsManager.GetItemCountById(mat.Item.ItemId) < amountToHaveInBag && Bag.GetContainerNumFreeSlots > 1)
                            {
                                Logger.LogDebug($"Buying {mat.Item.Name}");
                                Vendor.BuyItem(ItemsManager.GetNameById(mat.Item.ItemId), amountMissing);
                                Thread.Sleep(200);
                            }
                        }
                    }
                    else
                    {
                        Logger.Log($"You don't have enough money to buy {mat.Amount * amountMissing} x {mat.Item.Name} ({estimatedPrice} Copper).");
                    }
                }
            }

            Broadcaster.autoBroadcast = true;
        }
Exemple #14
0
 // Token: 0x06000017 RID: 23
 private static void discoverTaxi(FlightMasterDB flightMasterToDiscover)
 {
     FNVFlightMasterSettings.Load();
     Main.fillDB();
     if (GoToTask.ToPosition(flightMasterToDiscover.position, 3.5f, false, (object context) => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore))
     {
         GoToTask.ToPosition(flightMasterToDiscover.position, 3.5f, false, (object context) => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore);
         if (GoToTask.ToPositionAndIntecractWithNpc(flightMasterToDiscover.position, flightMasterToDiscover.NPCId, -1, false, (object context) => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false))
         {
             wManagerSetting.ClearBlacklistOfCurrentProductSession();
             GoToTask.ToPositionAndIntecractWithNpc(flightMasterToDiscover.position, flightMasterToDiscover.NPCId, -1, false, (object context) => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false);
             if (ObjectManager.Me.IsMounted)
             {
                 MountTask.DismountMount(false, false, 100);
             }
             Usefuls.SelectGossipOption(GossipOptionsType.taxi);
             Thread.Sleep(Usefuls.Latency + 1500);
             while (Main._updateNodes)
             {
                 Logging.Write("[tbcFlightMaster]: Taxi node update in progress...");
                 Thread.Sleep(10000);
             }
             Logging.Write("[tbcFlightMaster]: Flight Master " + flightMasterToDiscover.name + " discovered");
             flightMasterToDiscover.alreadyDiscovered = true;
             FNVFlightMasterSettings.flightMasterSaveChanges(flightMasterToDiscover, true);
             Thread.Sleep(Usefuls.Latency * 5);
             Main.timer                = 0;
             Main.discoverTaxiNode     = null;
             Main._taxiToDiscover      = false;
             Main._discoverInProessing = false;
             Main._discoverTaxiTimer   = true;
             Main.Reenable();
             return;
         }
     }
     Main._discoverInProessing = false;
 }
Exemple #15
0
 // Token: 0x06000016 RID: 22
 private static void takeTaxi(FlightMasterDB from, FlightMasterDB to)
 {
     if (GoToTask.ToPosition(from.position, 3.5f, false, (object context) => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore))
     {
         if (GoToTask.ToPositionAndIntecractWithNpc(from.position, from.NPCId, -1, false, (object context) => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false))
         {
             while (!ObjectManager.Me.IsOnTaxi)
             {
                 if (ObjectManager.Me.IsMounted)
                 {
                     MountTask.DismountMount(false, false, 100);
                 }
                 Usefuls.SelectGossipOption(GossipOptionsType.taxi);
                 Thread.Sleep(Usefuls.Latency + 1500);
                 while (Main._updateNodes)
                 {
                     Logging.Write("[tbcFlightMaster]: Taxi node update in progress, waiting...");
                     Thread.Sleep(10000);
                 }
                 int num = Lua.LuaDoString <int>("for i=0,30 do if string.find(TaxiNodeName(i),\'" + to.name.Replace("'", "\\'") + "\') then return i end end", "");
                 Lua.LuaDoString("TakeTaxiNode(" + num + ")", false);
                 Logging.Write("[tbcFlightMaster]: Taking Taxi from " + from.name + " to " + to.name);
                 Thread.Sleep(Usefuls.Latency + 500);
                 Keyboard.DownKey(Memory.WowMemory.Memory.WindowHandle, Keys.Escape);
                 Thread.Sleep(Usefuls.Latency + 2500);
                 if (!ObjectManager.Me.IsOnTaxi)
                 {
                     GoToTask.ToPositionAndIntecractWithNpc(from.position, from.NPCId, -1, false, (object context) => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false);
                 }
             }
             if (ObjectManager.Me.IsOnTaxi)
             {
                 Main.waitFlying(to.name);
             }
         }
     }
 }
    public static void LoadNewProfile(string profession, string profileName)
    {
        Profile = new GrinderProfile();
        string filePath = Application.StartupPath + "\\Profiles\\Wholesome Professions\\" + profileName;

        Bot.ProfileName = profileName;

        // If grinder School Load Profile
        if (!string.IsNullOrWhiteSpace(profileName) && File.Exists(filePath))
        {
            Profile = XmlSerializer.Deserialize <GrinderProfile>(filePath);
            if (Profile.GrinderZones.Count <= 0)
            {
                Logger.Log($"Profile '{filePath}' seems incorrect. Please use a Grinder profile.");
                UnloadCurrentProfile();
                return;
            }
            else
            {
                Logger.Log("Profile loaded");
            }
        }
        else
        {
            Logger.LogLineBroadcastImportant($"Profile file '{filePath}' not found");
            UnloadCurrentProfile();
            return;
        }

        SelectZone();

        // Black List:
        var blackListDic =
            Profile.GrinderZones.SelectMany(zone => zone.BlackListRadius).ToDictionary(b => b.Position,
                                                                                       b => b.Radius);

        //wManager.wManagerSetting.AddRangeBlackListZone(blackListDic);

        // Add Npc
        foreach (var zone in Profile.GrinderZones)
        {
            NpcDB.AddNpcRange(zone.Npc);
        }

        // Go to first hotspot or travel
        if (Profile.GrinderZones.Count > 0)
        {
            string zoneName    = Profile.GrinderZones[ZoneIdProfile].Name;
            int    continentId = TravelHelper.GetContinentFromZoneName(zoneName);
            Logger.LogDebug($"Zone {zoneName} is on continent {continentId.ToString()}");
            if (continentId == -1)
            {
                Logger.LogLineBroadcastImportant($"ERROR : The zone name {zoneName} from your profile is incorrect. Please use default zone names.");
                UnloadCurrentProfile();
                return;
            }

            if (continentId != Usefuls.ContinentId)
            {
                Logger.Log($"{Profile.GrinderZones[ZoneIdProfile].Name} is on another continent ({continentId}). Launching traveler.");
                Bot.SetContinent((ContinentId)continentId);
                return;
            }

            Bot.ProfileProfession = profession;
            Logger.Log($"Heading to first spot {Profile.GrinderZones[ZoneIdProfile].Vectors3[0]} in {Profile.GrinderZones[ZoneIdProfile].Name}");
            Broadcaster.autoBroadcast = false;
            Broadcaster.BroadCastSituation();
            GoToTask.ToPosition(Profile.GrinderZones[ZoneIdProfile].Vectors3[0], 50);
            Broadcaster.autoBroadcast = true;
        }
        else
        {
            Logger.LogDebug("No grinder zone found");
            UnloadCurrentProfile();
        }
    }
 private void OnGoToTask(object o)
 {
     GoToTask?.Invoke(Current);
 }
    public static bool GoInteractwithFM(FlightMaster fm, bool openMapRequired = false)
    {
        if (GoToTask.ToPosition(fm.Position, 5f))
        {
            if (!Main.isLaunched ||
                !Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause ||
                ObjectManager.Me.Position.DistanceTo(fm.Position) > 10f)
            {
                return(false);
            }

            // We're in fight (possibly on mount)
            if (ObjectManager.Me.InCombatFlagOnly)
            {
                if (ObjectManager.Me.IsMounted)
                {
                    MountTask.DismountMount();
                }
                return(false);
            }

            // We have reached the FM
            if (ObjectManager.Me.IsMounted)
            {
                MountTask.DismountMount();
            }

            // Check if FM is here or dead
            WoWUnit nearbyFM = FindNearbyAliveFM(fm);
            if (nearbyFM == null)
            {
                fm.Disable("FlightMaster is absent or dead.");
                ResetFlags();
                return(false);
            }

            // Approach FM
            if (!GoToTask.ToPosition(nearbyFM.Position, 1f))
            {
                return(false);
            }

            Interact.InteractGameObject(ObjectManager.GetWoWUnitByEntry(fm.NPCId).First().GetBaseAddress);

            // Check if interaction successful
            if (!InteractWithFm(fm))
            {
                fm.Disable("Unable to interact with NPC");
                ResetFlags();
                return(false);
            }

            Usefuls.SelectGossipOption(GossipOptionsType.taxi);

            // Check if map open
            if (openMapRequired && !FmMapIsOpen(fm))
            {
                fm.Disable("Unable to open FM map");
                ResetFlags();
                return(false);
            }

            return(true);
        }
        // We haven't reach the FM yet
        return(false);
    }
Exemple #19
0
 void OnEnable()
 {
     goToTask = GetComponent <GoToTask>();
 }