Jump to content

Recommended Posts

Unforunately, i couldnt use it. Situatoion is more complicated. I really hope for your help. Can you help me with my shitcode, please? I dont know how to implement comments. Im going to use Quester for my plan, thanks and sorry for bad English.

 

 public class Ninja
    {
        //how can I check it?
        bool isVanishReady = true;
        //how can I check it?
        bool isCombat;
        //how can I check it?
        bool amIOpening;

        int chestId = 42;

        void LookingForTheChest()
        {
            if (isCombat)
            {
                //use vanish. How can send to game some bind like "shift + V"?
                //sleep 2000
            }

           if (isCombat == false && isVanishReady && IsAnyoneNearMe() == false && amIOpening == false)
            {
                LootTheChest();
            }
        }

       void LootTheChest()
        {

            //lets check chest, maybe it looted already
            //if no chest i need to go to the next step

        }


        bool IsAnyoneNearMe()
        {
            //get mobs around
            List<WoWUnit> mobsNearMe = ObjectManager.GetWoWUnitHostile();

            //anyone near me? 
           foreach(WoWUnit u in mobsNearMe)
            {
                if (ObjectManager.Me.Position.DistanceTo2D(u.Position) < 30)
                {
                    return true;
                }
            }

            // ok, fine, there are no mobs near me, lets check where is patrol
            foreach (WoWUnit u in mobsNearMe)
            {
                //how to check by id? im using  DisplayID, dont know what is it, but i hope you will help 
                if (u.DisplayId == 2017 && ObjectManager.Me.Position.DistanceTo2D(u.Position) < 100  )
                {
                    return true;
                }
            }

            //so cool, patrol are so far and no one near me, time to loot the chest
            return false;
        }
    }

 

Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32007
Share on other sites

    public class Ninja
    {
        private Spell _vanish = new Spell("Vanish");

        int chestId = 42;

        void LookingForTheChest()
        {
            if (ObjectManager.Me.InCombat && Lua.LuaDoString<bool>("IsShiftKeyDown()"))
            {
                //use vanish. How can send to game some bind like "shift + V"?
                //sleep 2000
                Thread.Sleep(2000);

                // Cast vanish
                this._vanish.Launch();
            }

            if (ObjectManager.Me.InCombat == false && _vanish.IsSpellUsable && IsAnyoneNearMe() == false && ObjectManager.Me.IsCast == false)
            {
                LootTheChest();
            }
        }

        void LootTheChest()
        {

            //lets check chest, maybe it looted already
            //if no chest i need to go to the next step

        }


        bool IsAnyoneNearMe()
        {
            //get mobs around
            List<WoWUnit> mobsNearMe = ObjectManager.GetWoWUnitHostile();

            //anyone near me? 
            foreach (WoWUnit u in mobsNearMe)
            {
                if (ObjectManager.Me.Position.DistanceTo2D(u.Position) < 30)
                {
                    return true;
                }
            }

            // ok, fine, there are no mobs near me, lets check where is patrol
            foreach (WoWUnit u in mobsNearMe)
            {
                //how to check by id? im using  DisplayID, dont know what is it, but i hope you will help 
                if (u.DisplayId == 2017 && ObjectManager.Me.Position.DistanceTo2D(u.Position) < 100)
                {
                    return true;
                }
            }

            //so cool, patrol are so far and no one near me, time to loot the chest
            return false;
        }
    }

 

Edited by iMod
Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32033
Share on other sites

11 hours ago, sowelu said:

I have very noobish question. Where should i insert this code? Quester> action> runCode ?


private Spell _vanish = new Spell("Vanish");

error

 


int chestId = 42;

but ok

 

 

Oh you are working with quester. The vanish thing should be a part of your fight class.

Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32058
Share on other sites

Another stupid q, i have downloaded FightClass.cs sample, but wrobot>general settings > fight class have .xml format. How can I use sample. Also, I have downloaded plugin sample, and it works. I was able to write a log, lol. Which difference and advantage in these approaches?

Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32076
Share on other sites

2 hours ago, sowelu said:

Another stupid q, i have downloaded FightClass.cs sample, but wrobot>general settings > fight class have .xml format. How can I use sample. Also, I have downloaded plugin sample, and it works. I was able to write a log, lol. Which difference and advantage in these approaches?

XML is for ppl who have no clue about programming und C#(.cs) is for the advanced ppl. With XML you are forced to the functions droidz implemented and with C# you can create your own functions and stuff like that.

Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32082
Share on other sites

12 hours ago, sowelu said:

Found solution


Interact.InteractGameObject(chest.GetBaseAddress);

 

You should not using the index because if there is no chest you will get a out of range exception.

// Search for a chest
List<WoWGameObject> chest = ObjectManager.GetWoWGameObjectByyId(123456).FirstOrDefault();

// Found?
if(chest != null)
{
  // Open
  Interact.InteractGameObject(chest.GetBaseAddress);
}

 

Edited by iMod
Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32104
Share on other sites

3 hours ago, sowelu said:

Can I somehow receive some data from another instance of bot like value of variable in plugin? It would be cool to send a message to another instance.

Not as far i know. I would create a small tcp/ip server and client to communicate to each other.
Just take a look at google and search for "C# client server" or "C# chat application" this should bring you up some ideas.

Edited by iMod
Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32113
Share on other sites

Thanks for the help, I have done main part. Now it would be cool learn rogue to sneak through dungeons.

1. Can I record path and force character to move  by C#  ?

2. How to use distract on the ground?

3 How to open trade, put items, and push it :smile:

Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32140
Share on other sites

12 hours ago, sowelu said:

Can I somehow receive some data from another instance of bot like value of variable in plugin? It would be cool to send a message to another instance.

If you run the instances of WRobot on the same pc, you can checkout my CacheManager here.

1 hour ago, sowelu said:

1. Can I record path and force character to move  by C#  ?

Yes, i recommend to use the "Quester" product and add a quest with "FollowPath" in "Quests Editor" window. It also supports C#.

1 hour ago, sowelu said:

2. How to use distract on the ground?

I think, you know how to calculate the position, so you could use this:

        //replace "new Vector3()" with your desired position
        SpellManager.CastSpellByIDAndPosition(1725, new Vector3()); 

 

1 hour ago, sowelu said:

3 How to open trade, put items, and push it

To open trade with current target:

        Lua.LuaDoString("RunMacroText('/trade');");

 

Put items to the trade window(another solution, forgot the exact reason why it was in some ways better then the WRobot's method):

    /// <summary>
    /// Interact with all listed item names.
    /// </summary>
    /// <param name="items">Item list</param>
    /// <remarks>Bug at links with "-"</remarks>
    public static void InteractItems(List<string> items)
    {
        if (!items.Any())
            return;
        var execute = "for b=0,4 do " +
                      "if GetBagName(b) then " +
                      "for s=1, GetContainerNumSlots(b) do " +
                      "local itemLink = GetContainerItemLink(b, s) " +
                      "if itemLink then " +
                      "local _, stackCount = GetContainerItemInfo(b, s)\t" +
                      "if string.find(itemLink, \""+ items.FirstOrDefault() + "\")";
        if (items.Count > 1)
        {
            execute = items.Where(obj => items.FirstOrDefault() != obj).Aggregate(execute, (current, obj) => current + "or string.find(itemLink, \"" + obj + "\") ");
        }
        execute = execute + "then UseContainerItem(b, s)\tend\tend\tend end end";
        Lua.LuaDoString(execute);
    }

 

To press the trade button:

        Lua.LuaDoString("RunMacroText('/click TradeFrameTradeButton');");

Take also a look at https://wrobot.eu/forums/topic/6826-frame-stack-on-wow-tbc-243/ or type "/fstack" in Wow if you have wotlk or above, to get other related frame stuff.

 

And If you mention a new topic, just open a new thread ;)

 

Edited by reapler
Link to comment
https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32142
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...