Exemple #1
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;
        }
        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 #3
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;
        }
        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 #5
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 #6
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);
             }
         }
     }
 }