tg://proxy?server=91.124.149.234&port=443&secret=eecb78dfb35b2a281fc4ac3f42e08f5571616e746962756e6e792e66756e Полный дамп API документации в текстовом виде для легкого поиска с нбольшими комментариями: https://antibunny.fun/supersecretfolder/API-Documentation/ Официальная онлайн верси документации по API находится тут. https://wrobot.eu/byme/doc/ Текстовый дамп форума Wrobot для быстрого поиска, который содержит кучу полезной информации - готовые решения, правки кода, примеры, находится тут: https://antibunny.fun/supersecretfolder/ForumDump/ Сам форум доступен по адресу: https://wrobot.eu/forums/ WoW Lua Reference:http://wowprogramming.com/docs/api_categories Дополнительные пояснения: How can I see what Functions are available to me in the WRobot API? I recommend using some sort of decompiler in order to see what functions are available in the WRobot API. That is, use something such as dotPeek from jetbrains. See this URL: https://www.jetbrains.com/decompiler/ . Once you have this downloaded, open the WRobot Binaries located in the (C:\WRobot\Bin) folder in dotPeek. I cannot even begin to explain how many times the recompiled helped me find useful things I could re-use. As a quick tip, I would suggest taking a look at the wManager.wManager.Wow.Helpers functions that are available. Anything listed as public static will be available to use from a Plugin/Profile/Fightclass etc. What if WRobot doesn't have an available function that I will need? WRobot doesn't have everything instantly available, so you may need to resort to using some Lua Functions to get information back from the WoW Client. An example of this that I ran into at some point was getting the number of Character Macros someone has.. Of course this is very specific, but please bear with me for the sake of this example :). WoW Lua Reference: http://wowprogramming.com/docs/api_categories Using Lua in C#: This snippet will return a List of integers and set the C# variable numberOfMacros equal to the returned list of the DoString function. To be more specific, it will provide a list of the number of Global account Macros , and the number of Personal Character Macros. var numberOfMacros = Lua.LuaDoString>("return numCharacterMacros"); The below will return just the number Character Macros someone has. If you need a specific variable from a Lua Function, then do the following: var numPersonalMacros = Lua.LuaDoString("local numAccountMacros, numCharacterMacros = GetNumMacros(); return numCharacterMacros"); The above snippet will set the C# variable numPersonalMacros equal to numCharacterMacros from the lua return value. Using a Variable in the Lua.LuaDoString. The below will return the text body of the macro that has the id of 121. var _macroID = 121 string macroBody = Lua.LuaDoString("return GetMacroBody(" + _macroID + ")"); Executing Lua Code in C# This will leave the party (if the player is in one). wManager.Wow.Helpers.Lua.RunMacroText("/run LeaveParty()"); What is the difference between Lua.LuaDoString() and RunMacroText()? The difference is in can be understand in how you think about them. Lua.LuaDoString should be seen as a way to retrieve information.. More specifically, the Lua.LuaDoString's purpose is to have a value returned to it, so that you can assign it to a C# Variable. RunMacroText can be used to do something in game. More specifically, RunMacroText should be used when trying to run some sort of in-game script (such as /cast spell). Plugin Template C#: Plugin-Template.cs I have attached a basic plugin template that can be used. In it, I have provided an example of: A Basic Implementation of the wManager.Plugin.IPlugin Class (including Settings/Initialize/Dispose) Basic loop that will occur while WRobot is running Settings that can be configured from Plugin Page A Category/Short Description for the Plugin Settings An example of Watching for Game Events. An example of OnRunState / OnAfterRunState for WRobot States Watching For Game Events Sometimes you may find that you need to wait for something to occur in game before you can take a specific action. In WoW / WRobot world, these things are called events. Below are two examples of events. The first event will occur when either the Group Loot Settings change, or a Player Enters/Joins the current Party.The second Event will occur when a System Message is received. I recommend adding this watchForEvents Function in the Initialize function of a plugin, or somewhere where it will only be called once. For an example of this, please see my Plugin Template. private void watchForEvents() { EventsLuaWithArgs.OnEventsLuaWithArgs += (LuaEventsId id, List args) => { if (id == wManager.Wow.Enums.LuaEventsId.PARTY_MEMBERS_CHANGED) { Logging.Write("Joined Group or something about the current group was changed."); } if (id == wManager.Wow.Enums.LuaEventsId.CHAT_MSG_SYSTEM) { Logging.Write("We Received a System Message."); } }; } What do each of these Events mean? WoW Event Reference: http://wowwiki.wikia.com/wiki/Event_API (Reminder! Some of these may be different in different versions of the game.) Watching For WRobot State Changes In addition to in game events, there are also WRobot 'states'. Similar to Game Events, WRobot states are the particular condition that WRobot is in at a specific time. For example, there is a state called 'MillingState', and another called 'Looting' that come out with WRobot. States are managed by the WRobot FiniteStateMachineEvents Engine. When a State occurs/changes/ends/etc, an event is passed to the FiniteStateMachine (pardon my wording here if this is not 100% correct). There are three main events that we can use to manage our States. State Events that occur: OnBeforeCheckIfNeedToRunState - This can be used to CANCEL an event if specific conditions are met. OnRunState - This can be used to do something just as the State is being started. OnAfterRunState - This can be used to do something just as the State has completed. Example of OnRunState and OnAfterRunState In this example we are watching for when WRobot starts the ToTown State and when it finishes it. We create a boolean that is set to true when the state is started, and then set it to false when the State is completed. I recommend adding the initializeToTownWatcher() function in the Initialize function of a plugin, or somewhere where it will only be called once. For example of this, please see my Plugin Template. bool goToTown = false; private void initializeToTownWatcher() { robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) => { if (state != null && state.DisplayName == "To Town") { goToTown = true; Logging.Write("Going to Town State has been initiated."); } }; robotManager.Events.FiniteStateMachineEvents.OnAfterRunState += (engine, state) => { if (state != null && state.DisplayName == "To Town") { goToTown = false; Logging.Write("We have completed going To Town State."); } }; } Example of OnBeforeCheckIfNeedToRunState In this example, we catch the state with the name of To Town and cancel it by setting the passed in cancelable parameter to true. private void cancelToTownState() { robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += (engine, state, cancelable) => { if (state != null && state.DisplayName == "To Town") { Logging.Write("We have cancelled the To Town State"); cancelable.Cancel = true; } }; } ## Working with Lua **Q: What if WRobot doesn't have a function I need?** Use Lua via `LuaDoString`: ### Return Multiple Values (List) ```csharp // Returns list: [numAccountMacros, numCharacterMacros] var numberOfMacros = Lua.LuaDoString>( "local numAccountMacros, numCharacterMacros = GetNumMacros(); " + "return numAccountMacros, numCharacterMacros" ); ``` ### Return Single Value ```csharp // Returns just character macros count var numPersonalMacros = Lua.LuaDoString( "local numAccountMacros, numCharacterMacros = GetNumMacros(); " + "return numCharacterMacros" ); ``` **WoW Lua Reference:** http://wowprogramming.com/docs/api_categories --- ## Timers **Q: How do I create a timer that executes code every X seconds?** ```csharp // Create timer that ticks every 1000ms (1 second) private Timer MyTimer = new Timer(1000); public void Initialize() { MyTimer.Elapsed += MyTimer_Tick; MyTimer.Start(); } private void MyTimer_Tick(object sender, ElapsedEventArgs e) { // Code runs every 1 second Logging.Write("Timer ticked!"); } ``` **Stop/Dispose timer:** ```csharp MyTimer.Stop(); MyTimer.Dispose(); ``` --- ## Logging & Debugging ### Basic Logging ```csharp Logging.Write("Your message here"); Logging.WriteDebug("Debug message"); Logging.WriteError("Error message"); ``` ### Colored Logging ```csharp Logging.Write("[MyPlugin] Started", Color.Green); Logging.Write("[Warning] Low health!", Color.Orange); ``` ### Write to File ```csharp Logging.WriteFile("filename.txt", "Content to write"); ``` --- ## Object Management ### Get Player Info ```csharp var me = ObjectManager.Me; // Player properties me.Name // Character name me.Level // Character level me.HealthPercent // Health % me.ManaPercent // Mana % me.Position // Vector3 position me.WowClass // Class (Warrior, Mage, etc.) me.InCombat // In combat? me.IsDead // Dead? ``` ### Get Nearby Units ```csharp // Get all units around you var units = ObjectManager.GetObjectWoWUnit(); // Get enemies only var enemies = units.Where(u => u.IsAttackable && !u.IsDead); // Get specific mob by name var mob = units.FirstOrDefault(u => u.Name == "Kobold Miner"); ``` ### Distance Check ```csharp var target = ObjectManager.Target; if (target.IsValid) { float distance = me.Position.DistanceTo(target.Position); if (distance < 5f) { // Within 5 yards } } ``` --- ## Movement ### Go to Position ```csharp GoToTask.ToPosition(new Vector3(x, y, z)); ``` ### Follow Path ```csharp var path = new List { new Vector3(100, 200, 50), new Vector3(150, 250, 55), new Vector3(200, 300, 60) }; GoToTask.ToPositionList(path); ``` ### Stop Movement ```csharp MovementManager.StopMove(); ``` --- ## Combat ### Cast Spell ```csharp // By name SpellManager.CastSpellByName("Fireball"); // By ID SpellManager.CastSpellByID(133); // Fireball ID // On specific unit SpellManager.CastSpellByNameOn("Polymorph", "TargetName"); ``` ### Check Spell ```csharp // Is spell known? bool known = SpellManager.IsSpellKnown("Fireball"); // Get spell cooldown var cooldown = SpellManager.GetSpellCooldown("Fireball"); ``` ### Use Item ```csharp // By name ItemsManager.UseItem("Hearthstone"); // By ID ItemsManager.UseItemByIdAndWait(6948); // Hearthstone ``` --- ## Conditions & Checks ### Check Quest ```csharp // Has quest? if (Quest.HasQuest(12345)) { } // Quest completed? if (Quest.GetQuestCompleted(12345)) { } // Objective complete? if (Quest.IsObjectiveComplete(1, 12345)) { } ``` ### Check Buff/Debuff ```csharp // Player has buff? if (me.HaveBuff("Power Word: Fortitude")) { } // Target has debuff? if (target.HaveDebuff("Corruption")) { } ``` ### Check Inventory ```csharp // Item count int count = ItemsManager.GetItemCountById(2589); // Linen Cloth // Has item? bool hasItem = ItemsManager.HasItemById(6948); // Hearthstone // Bag slots free int freeSlots = Bag.GetFreeBagSlotsCount(); ``` --- ## Threading & Async ### Run Code in Background ```csharp Task.Run(() => { // Background code System.Threading.Thread.Sleep(5000); Logging.Write("Background task complete"); }); ``` ### Wait for Condition ```csharp // Wait until health > 50% while (ObjectManager.Me.HealthPercent < 50) { Thread.Sleep(100); } ``` --- ## Interact with NPCs/Objects ### Talk to NPC ```csharp var npc = ObjectManager.GetObjectWoWUnit() .FirstOrDefault(u => u.Entry == 1234); // NPC Entry ID if (npc != null && npc.GetDistance < 5) { Interact.InteractGameObject(npc.GetBaseAddress); Thread.Sleep(500); } ``` ### Select Gossip Option ```csharp // Open gossip Gossip.SelectGossipOption(1); // Select option 1 // Accept quest Quest.AcceptQuest(); // Turn in quest Quest.CompleteQuest(); ``` --- ## File Operations ### Read File ```csharp string content = System.IO.File.ReadAllText("path/to/file.txt"); ``` ### Write File ```csharp System.IO.File.WriteAllText("path/to/file.txt", "Content"); ``` ### Check File Exists ```csharp if (System.IO.File.Exists("path/to/file.txt")) { // File exists } ``` --- ## Settings & Configuration ### Save Settings ```csharp [Serializable] public class MySettings { public bool EnableFeature { get; set; } public int DelayMs { get; set; } public void Save() { var json = JsonConvert.SerializeObject(this); File.WriteAllText("settings.json", json); } public static MySettings Load() { if (File.Exists("settings.json")) { var json = File.ReadAllText("settings.json"); return JsonConvert.DeserializeObject(json); } return new MySettings(); } } ``` --- ## Common Patterns ### Safely Check Object ```csharp var target = ObjectManager.Target; if (target != null && target.IsValid && !target.IsDead) { // Safe to interact } ``` ### Try-Catch Error Handling ```csharp try { // Your code SpellManager.CastSpellByName("Fireball"); } catch (Exception ex) { Logging.WriteError("Error: " + ex.Message); } ``` ### LINQ Filtering ```csharp // Get all valid enemy players within 40 yards var enemies = ObjectManager.GetObjectWoWPlayer() .Where(p => p.IsValid) .Where(p => !p.IsDead) .Where(p => p.IsAlive) .Where(p => p.Reaction < Reaction.Friendly) .Where(p => p.GetDistance < 40) .OrderBy(p => p.GetDistance) .ToList(); ```