Jump to content

TheSmokie

Banned
  • Posts

    1215
  • Joined

Posts posted by TheSmokie

  1. the problem your having is the while loop keep going which overrides normal wrobot state and just attacks mobs. use something like this.

     

     return ItemsManager.GetItemCountById(45005) == 1; //Complete Condition
    
            //overridepulse
            wManager.Wow.Bot.Tasks.GoToTask.ToPosition(new Vector3(5178.439f, -63.72389f, 360.272f));
                foreach (WoWUnit everblaze in ObjectManager.GetWoWUnitByEntry(33289))
                {
                    if (!Fight.InFight)
                    {
                        Fight.StartFight(everblaze.Guid);
                    }
    
                }
            return true;

    also using while loops can make many problems if you do not use them the right way. 

    if youd like i can teach you how to make quester profiles a lot better, Dm me if you have any questions. i am here to help!

     

  2. Just to help others, here is to go to a trainer and learn spell or spells.

    Custom Code > Quester

     

    public static class Trainer_Learn
    {
    
        public static List<Tuple<string, uint>> SpellsList = new List<Tuple<string, uint>>
        {
                new Tuple<string, uint>("Charge", 5),
                new Tuple<string, uint>("Rend", 5),
                new Tuple<string, uint>("Thunder Clap", 5),
                new Tuple<string, uint>("Parry", 5),
                new Tuple<string, uint>("Battle Shout", 5),
    
        };
    
        public static void LearningSpells(string SpellName)
        {
            Lua.LuaDoString(string.Format(@"
            for i=1,GetNumTrainerServices() do
            local name = GetTrainerServiceInfo(i)
            if (name == '{0}') then
                BuyTrainerService(i)
             end
            end
            ", SpellName.Replace("'", "\'")));
        }
    
        public static void SpellINdex(Vector3 Vect, int npc, bool LearnAll)
        {
            if (LearnAll == true)
            {
                Trainer.TrainingSpell();
                Thread.Sleep(100);
            }
            uint lastLevelCheck = 0;
            foreach (var SpellIndex in SpellsList)
            {
                var level = ObjectManager.Me.Level;
                if (level >= SpellIndex.Item2)
                {
                    if (SpellManager.KnowSpell(SpellIndex.Item1.ToString()) == false)
                    {
                        while (GoToTask.ToPositionAndIntecractWithNpc(Vect, npc))
                        {
                            Usefuls.SelectGossipOption(GossipOptionsType.trainer);
                            Thread.Sleep(100);
                            LearningSpells(SpellIndex.Item1);
                            Thread.Sleep(100);
    
                        }
                    }
                }
                lastLevelCheck = level;
            }
        }
    }

    Useage : 

    Trainer_Learn.SpellINdex(new Vector3(-639.344f, -4230.19f, 38.13411f), 3153, false);

     

  3. Note : this is not the code used in selector, the reward selection in selector is more advanced, but i think this will help make the whole quest reward problem go away for a lot of devs. enjoy. 

    using wManager.Wow.Helpers;
    using System.ComponentModel;
    using System.Threading;
    public static class Quester_rewards
    {
        public static void Select()
        {
    
            wManager.Events.OthersEvents.OnSelectQuestRewardItem += delegate (CancelEventArgs cancelable)
            {
                cancelable.Cancel = true;
                gossip();
                Thread.Sleep(100);
                if (Lua.LuaDoString<bool>("if QuestFrameRewardPanel:IsVisible() then return true else return false end"))
                    Selecter();
            };
        }
    
        public static void Selecter()
        {
            int questRewards = Lua.LuaDoString<int>("return GetNumQuestChoices()");
            if (questRewards == 0)
            {
                Lua.LuaDoString("QuestFrameCompleteQuestButton:Click();");
                Thread.Sleep(100);
            }
            else
                RunLua();
        }
    
        public static void gossip()
        {
            Lua.LuaDoString(@"
          if ( not QuestFrameRewardPanel:IsVisible() or QuestFrameRewardPanel:IsVisible() == nil ) then
        local gossipTable = {GetGossipActiveQuests()}
        local numOptions = table.getn(gossipTable)/4
        local nameIndex, completeIndex = 1, 4
        for i=1,numOptions do
          if gossipTable[completeIndex] == 1 then
            SelectGossipActiveQuest(i)
            CompleteQuest();
          end
        nameIndex, completeIndex = nameIndex + 4, completeIndex + 4
        end 
        return");
        }
    
        public static void RunLua()
        {
    		Lua.LuaDoString(@"
    
    	local numberOfQuestRewards = GetNumQuestChoices()
    	local mostValuableQuestItemIndex, mostValuableQuestItemValue, bestQuestItemIndex, bestQuestItemArmorWeight = 1, 0, -1, -1
    	local armorWeights = { Plate = 4, Mail = 2, Leather = 1, Cloth = 0 }
    
    	local equipmentSlotLookup = {
    		INVTYPE_HEAD = {""HeadSlot"", nil},
    		INVTYPE_NECK = {""NeckSlot"", nil},
    		INVTYPE_SHOULDER = {""ShoulderSlot"", nil},
    		INVTYPE_CLOAK = {""BackSlot"", nil},
    		INVTYPE_CHEST = {""ChestSlot"", nil},
    		INVTYPE_WRIST = {""WristSlot"", nil},
    		INVTYPE_HAND = {""HandsSlot"", nil},
    		INVTYPE_WAIST = {""WaistSlot"", nil},
    		INVTYPE_LEGS = {""LegsSlot"", nil},
    		INVTYPE_FEET = {""FeetSlot"", nil},
    		INVTYPE_SHIELD = {""SecondaryHandSlot"", nil},
    		INVTYPE_ROBE = {""ChestSlot"", nil},
    		INVTYPE_2HWEAPON = {""MainHandSlot"", ""SecondaryHandSlot""},
    		INVTYPE_WEAPONMAINHAND = {""MainHandSlot"", nil},
    		INVTYPE_WEAPONOFFHAND = {""SecondaryHandSlot"", ""MainHandSlot""},
    		INVTYPE_WEAPON = {""MainHandSlot"",""SecondaryHandSlot""},
    		INVTYPE_THROWN = {""RangedSlot"", nil},
    		INVTYPE_RANGED = {""RangedSlot"", nil},
    		INVTYPE_RANGEDRIGHT = {""RangedSlot"", nil},
    		INVTYPE_FINGER = {""Finger0Slot"", ""Finger1Slot""},
    		INVTYPE_HOLDABLE = {""SecondaryHandSlot"", ""MainHandSlot""},
    		INVTYPE_TRINKET = {""Trinket0Slot"", ""Trinket1Slot""}
    	} 
                            
    	for questItemIndex = 1, numberOfQuestRewards do
    		local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(GetQuestItemLink(""choice"", questItemIndex))
    		if itemRarity >= 3 then
    			return
    		end
    		local itemId = itemLink:match(""|Hitem:(%d+)"")
    		local isItemEquippable = IsEquippableItem(itemId)
    		local _, _, _, _, isItemUsable = GetQuestItemInfo(""choice"", questItemIndex)
                    
    		if itemSellPrice > mostValuableQuestItemValue then
    			-- Keep track of which item is most valuable:
    			mostValuableQuestItemIndex = questItemIndex
    			mostValuableQuestItemValue = itemSellPrice
    		end
                                
    		if isItemEquippable == 1 and isItemUsable ~= nil then
    			-- NPC is offering us an item we can actually wear:
    			local currentEquippedItemLinksInSlots = {}
    			local currentWorstEquippedItemInSlot = nil
    			
    			-- Figure out what we already have equipped:
    			for _, itemSlot in ipairs(equipmentSlotLookup[itemEquipLoc]) do
    				if itemSlot ~= nil then
    					local currentEquippedItemLinkInSlot = GetInventoryItemLink(""player"", GetInventorySlotInfo(itemSlot))
    					
    					if currentEquippedItemLinkInSlot == nil then
    						-- Of the n item slots available, at least one of them has nothing equipped. Ergo, it is the worst:
    						currentWorstEquippedItemInSlot = nil
    						break
    					else
    						local _, _, _, currentEquippedItemLevelInSlot, _, _, currentEquippedItemSubTypeInSlot = GetItemInfo(currentEquippedItemLinkInSlot)
    						
    						if currentWorstEquippedItemInSlot == nil or currentWorstEquippedItemInSlot.itemLevel > currentEquippedItemLevelInSlot then
    							currentWorstEquippedItemInSlot = { 
    								itemLink = currentEquippedItemLinkInSlot,
    								itemLevel = currentEquippedItemLevelInSlot,
    								itemSubType = currentEquippedItemSubTypeInSlot
    							}
    						end
    					end
    				end
    			end
    
    			if currentWorstEquippedItemInSlot == nil then
    				bestQuestItemIndex = questItemIndex
    			else
    				if itemLevel > currentWorstEquippedItemInSlot.itemLevel then
    					if armorWeights[itemSubType] ~= nil then
    						if armorWeights[itemSubType] > bestQuestItemArmorWeight then
    							bestQuestItemIndex = questItemIndex
    							bestQuestItemArmorWeight = armorWeights[itemSubType]
    						end
    					elseif currentWorstEquippedItemInSlot.itemSubType == itemSubType then
    						bestQuestItemIndex = questItemIndex
    						bestQuestItemArmorWeight = -1
    					end
    				end
    			end
    		end
    	end
                            
    	if bestQuestItemIndex < 0 then
    		bestQuestItemIndex = mostValuableQuestItemIndex
    	end
    	GetQuestReward(bestQuestItemIndex)
    ");
    	}
    }

     

     

  4. This code i made for running normal instances, come out to sell items to "traveler's tundra mammoth" Quester >  Custom Script.

    using robotManager.Helpful;
    using wManager.Wow.Helpers;
    using wManager.Wow.Bot.Tasks;
    using wManager.Wow.ObjectManager;
    using System.Linq;
    using System.Threading;
    using System.Collections.Generic;
    using wManager.Wow.Enums;
    using System;
    using System.ComponentModel;
    using System.IO;
    using System.Configuration;
    
    public static class Main_Thread
    {
        public static List<string> Sellitems = new List<string>();
        public static WoWPlayer Me = ObjectManager.Me;
        public static void Start()
        {
            wManager.wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = false;
            wManager.wManagerSetting.CurrentSetting.Save();
            Lua.LuaDoString(@"SetDungeonDifficulty(1);");
        }
        public static void OnSeemStuck()
        {
            if (!wManager.wManagerSetting.IsBlackListedZone(new Vector3(Me.Position.X, Me.Position.Y, Me.Position.Z, "None")))
            {
                wManager.wManagerSetting.AddBlackListZone(new Vector3(Me.Position.X, Me.Position.Y, Me.Position.Z, "None"), 2.00f, true);
                Logging.Write("[Unstuck Blacklisting]: " + Me.Position.X.ToString() + Me.Position.Y.ToString() + Me.Position.Z.ToString());
            }
        }
    
        public static void ToPosition(Vector3 vector)
        {
            GoToTask.ToPosition(vector);
        }
    
        public static void MoveWhileDead()
        {
            var badCorpsePos = new Vector3(-3361.787f, 4665.568f, -22.70184f);
            var enterDungeonPos = new Vector3(-3361.623f, 4643.492f, -101.047f);
    
            Logging.Write("[EnterCorpse] Started.");
            wManager.Events.OthersEvents.OnPathFinderFindPathResult += (from, to, path, mpq, success) =>
            {
                if (ObjectManager.Me.IsDead && to.DistanceTo(badCorpsePos) < 10)
                {
                    path.Clear();
                    path.AddRange(PathFinder.FindPath(enterDungeonPos));
                }
            };
        }
    
        public static void Mammoth()
        {
            string Mount_Name = "Traveler's Tundra Mammoth";
            if (GoToTask.ToPosition(new Vector3(-3361.868f, 4759.114f, -101.3954f)))
            {
                if (!ObjectManager.Me.HaveBuff(Mount_Name))
                {
                    SpellManager.CastSpellByNameLUA(Mount_Name);
                    Usefuls.WaitIsCasting();
                }
            }
        }
    
        public static void Sellingitems()
        {
            List<WoWItemQuality> quality = new List<WoWItemQuality>
            {
                WoWItemQuality.Common,
                WoWItemQuality.Poor,
                WoWItemQuality.Rare,
                WoWItemQuality.Epic,
                WoWItemQuality.Uncommon
            };
            int Mount_Vendor_ID = 32641;
            var Mount_Vendor = ObjectManager.GetWoWUnitByEntry(Mount_Vendor_ID).FirstOrDefault(i => i.Entry == Mount_Vendor_ID);
            if (Mount_Vendor.IsValid && Mount_Vendor != null)
            {
                Interact.InteractGameObject(Mount_Vendor.GetBaseAddress);
                foreach (WoWItem item in Bag.GetBagItem())
                {
                    if (!Selling_Settings.CurrentSetting.DONOT.Contains(item.GetItemInfo.ItemName))
                    {
                        Sellitems.Add(item.GetItemInfo.ItemName);
                        Vendor.SellItems(Sellitems, Selling_Settings.CurrentSetting.DONOT, quality);
                        Thread.Sleep(100);
                    }
                }
                Thread.Sleep(10);
            }
        }
    
    
        public static void DoNotSellITems(string item)
        {
            Selling_Settings.Load();
            if(!Selling_Settings.CurrentSetting.DONOT.Contains(item))
            {
                Selling_Settings.CurrentSetting.DONOT.Add(item);
                Selling_Settings.CurrentSetting.Save();
            }
        }
    }
    
    [Serializable]
    public class Selling_Settings : Settings
    {
        [Setting]
        [DefaultValue(null)]
        [Category("C:_Other Functions_")]
        [DisplayName("Items to delete")]
        [Description("It will attempt to DELETE the Items in interval")]
        public List<string> DONOT { get; set; }
    
        private Selling_Settings()
        {
            DONOT = new List<string>();
        }
    
        public static Selling_Settings CurrentSetting { get; set; }
    
        public bool Save()
        {
            try
            {
                return Save(AdviserFilePathAndName("Selling_Settings",
                    ObjectManager.Me.Name + "." + Usefuls.RealmName));
            }
            catch (Exception e)
            {
                Logging.WriteError("Selling_Settings > Save(): " + e);
                return false;
            }
        }
    
        public static bool Load()
        {
            try
            {
                if (File.Exists(AdviserFilePathAndName("Selling_Settings",
                    ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                {
                    CurrentSetting = Load<Selling_Settings>(
                        AdviserFilePathAndName("Selling_Settings",
                        ObjectManager.Me.Name + "." + Usefuls.RealmName));
                    return true;
                }
                CurrentSetting = new Selling_Settings();
            }
            catch (Exception e)
            {
                Logging.WriteError("Selling_Settings > Load(): " + e);
            }
            return false;
        }
    }

     

×
×
  • Create New...