sowelu 1 Posted September 12, 2017 Share Posted September 12, 2017 There are mobs patroling near the chest. How can i check distance and if its ok then loot the chest? Link to comment https://wrobot.eu/forums/topic/7064-check-distance/ Share on other sites More sharing options...
Droidz 2738 Posted September 12, 2017 Share Posted September 12, 2017 Hello, to avoid mobs you have option "Max unit near..." Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-31979 Share on other sites More sharing options...
sowelu 1 Posted September 12, 2017 Author Share Posted September 12, 2017 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 More sharing options...
Matenia 628 Posted September 13, 2017 Share Posted September 13, 2017 use Entry for their ID. Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32028 Share on other sites More sharing options...
sowelu 1 Posted September 13, 2017 Author Share Posted September 13, 2017 Thanks, what about the rest? There is no documentation, I dont know where can I find some info or tutorials for scripting. Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32032 Share on other sites More sharing options...
iMod 99 Posted September 13, 2017 Share Posted September 13, 2017 (edited) 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 September 13, 2017 by iMod sowelu 1 Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32033 Share on other sites More sharing options...
sowelu 1 Posted September 13, 2017 Author Share Posted September 13, 2017 Oh bro, I appreciate it, thanks. Going to check it soon and it remains to find out LootTheChest function. Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32040 Share on other sites More sharing options...
sowelu 1 Posted September 13, 2017 Author Share Posted September 13, 2017 Also, how can it be looped? I need to call LookingForTheChest function every100 ms. Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32041 Share on other sites More sharing options...
iMod 99 Posted September 13, 2017 Share Posted September 13, 2017 Just now, sowelu said: Also, how can it be looped? I need to call LookingForTheChest function every100 ms. If you want too loop through something "While(condition)" could be used. Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32042 Share on other sites More sharing options...
sowelu 1 Posted September 14, 2017 Author Share Posted September 14, 2017 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 Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32043 Share on other sites More sharing options...
iMod 99 Posted September 14, 2017 Share Posted September 14, 2017 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 More sharing options...
sowelu 1 Posted September 14, 2017 Author Share Posted September 14, 2017 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 More sharing options...
iMod 99 Posted September 14, 2017 Share Posted September 14, 2017 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 More sharing options...
sowelu 1 Posted September 14, 2017 Author Share Posted September 14, 2017 I have found the cheast, how can I loot it? List<WoWGameObject> objs = new List<WoWGameObject>(); objs = ObjectManager.GetWoWGameObjectByyId(123456); WoWGameObject chest = objs[0]; Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32088 Share on other sites More sharing options...
sowelu 1 Posted September 14, 2017 Author Share Posted September 14, 2017 Found solution Interact.InteractGameObject(chest.GetBaseAddress); Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32089 Share on other sites More sharing options...
iMod 99 Posted September 15, 2017 Share Posted September 15, 2017 (edited) 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 September 15, 2017 by iMod sowelu 1 Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32104 Share on other sites More sharing options...
sowelu 1 Posted September 15, 2017 Author Share Posted September 15, 2017 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. Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32106 Share on other sites More sharing options...
iMod 99 Posted September 15, 2017 Share Posted September 15, 2017 (edited) 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 September 15, 2017 by iMod Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32113 Share on other sites More sharing options...
sowelu 1 Posted September 15, 2017 Author Share Posted September 15, 2017 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 Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32140 Share on other sites More sharing options...
reapler 154 Posted September 15, 2017 Share Posted September 15, 2017 (edited) 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 September 15, 2017 by reapler sowelu 1 Link to comment https://wrobot.eu/forums/topic/7064-check-distance/#findComment-32142 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now