Matenia
-
Posts
2226 -
Joined
-
Last visited
Reputation Activity
-
Matenia got a reaction from Droidz in Others.Random is bugged
For now, I can't reproduce it anymore (5 minutes ago, It was possible - idk!).
If I can reproduce it again, I will put the values of Ticks checked and unchecked here.
-
Matenia got a reaction from TheSmokie in [Suggestion] allow custom scripts into reward item
This is great. Now I don't have to use a Lua hook anymore.
Otherwise you can use a Lua hook to create a race condition between your selection code and ANY code turning in the quest:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection; using System.Security.Cryptography; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using DatabaseManager.Enums; using robotManager.Events; using robotManager.FiniteStateMachine; using robotManager.Helpful; using robotManager.Products; using wManager; using wManager.Wow.Bot.Tasks; using wManager.Wow.Class; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; public class QuestRewardSelector { public static string TooltipName = "QuestItemCompareTooltip"; public static void Start() { TooltipName = LuaVariableSettings.CurrentSetting.QuestToolTipName; RegisterHook(); CreateTooltip(); EventsLua.AttachEventLua((LuaEventsId) Enum.Parse(typeof(LuaEventsId), "QUEST_COMPLETE"), QuestCompleteHandler); } public static void Stop() { } public static void CreateTooltip() { Lua.LuaDoString($@" if not {TooltipName} then {TooltipName} = CreateFrame('GameTooltip', '{TooltipName}', nil, 'GameTooltipTemplate'); {TooltipName}:SetOwner(UIParent, 'ANCHOR_NONE'); end "); } public static void RegisterHook() { Lua.LuaDoString($@" if (not {LuaVariableSettings.CurrentSetting.QuestHookName}) then _OriginalQuestCompleteOnClick = QuestFrameCompleteQuestButton:GetScript(""OnClick""); function hook_QuestComplete(self, button, arg2, arg3) self = this; if (button == ""FORCE"") then --DEFAULT_CHAT_FRAME:AddMessage('Forcing quest acceptance!'); _OriginalQuestCompleteOnClick(self, button); else C_Timer.After(2500, function() --DEFAULT_CHAT_FRAME:AddMessage('Delay quest turn in by 2500ms'); _OriginalQuestCompleteOnClick(self, button); end); end end QuestFrameCompleteQuestButton:SetScript(""OnClick"", hook_QuestComplete); _GetQuestReward = GetQuestReward; function GetQuestReward(index, force) if(force) then return _GetQuestReward(index); else C_Timer.After(2500, function() --DEFAULT_CHAT_FRAME:AddMessage('Delay quest turn in by 2500ms'); return _GetQuestReward(index); end); end end --DEFAULT_CHAT_FRAME:AddMessage('Quest hook initiated'); {LuaVariableSettings.CurrentSetting.QuestHookName} = true; end "); } private static void QuestCompleteHandler(object context) { Lua.LuaDoString("QuestFrameCompleteQuestButton:Disable();"); PluginLog.Log("About to complete quest - INTERCEPT!"); SelectQuestItem(); Lua.LuaDoString("QuestFrameCompleteQuestButton:Enable();"); //fallback Lua.LuaDoString($"_GetQuestReward(1);"); } private static void SelectQuestItem() { try { int questRewards = Lua.LuaDoString<int>("return GetNumQuestChoices()"); if (questRewards == 0) { return; } Dictionary<ParsedItem, int> itemRewards = new Dictionary<ParsedItem, int>(); for (int i = 1; i <= questRewards; i++) { Lua.LuaDoString($@" {TooltipName}:Hide(); {TooltipName}:SetOwner(UIParent, 'ANCHOR_NONE'); {TooltipName}:ClearLines(); {TooltipName}:SetQuestItem(""choice"", {i}); "); ParsedItem item = ItemParser.ParseCurrentTooltip(TooltipName, true); if (item.isUsable) { itemRewards.Add(item, i); } } ItemComparator comparator = new ItemComparator(StatWeights.ForClass(ObjectManager.Me.WowClass)); ParsedItem bestItem = comparator.FindBestItem(itemRewards.Keys.ToList()); int index = itemRewards[bestItem]; PluginLog.Log("Found best item " + bestItem.name + " as reward number: " + index); Lua.LuaDoString($@" --QuestFrameCompleteQuestButton:Enable(); _GetQuestReward({index}); "); Thread.Sleep(1000); } catch (Exception e) { Logging.WriteError("" + e); } } private static async void SelectQuestItemAsync() { await Task.Run(() => { SelectQuestItem(); }); } }
-
Matenia reacted to Droidz in Adding plugin code to "base" code
Hi,
problem is that WRobot don't unload loaded dll (or code), if you start/stop several times your code will don't found what dll use.
You can try to use "Var" like that (no tested):
public void Initialize() { robotManager.Helpful.Var.SetVar("TakeDeepRunTram", new Action(() => TakeDeepRunTram())); } public static void TakeDeepRunTram() { //code to enter portal, take tram and leave through other portal } in offmesh use:
c#: robotManager.Helpful.Var.Var.GetVar<Action>("TakeDeepRunTram")();
-
-
-
Matenia got a reaction from TheSmokie in Add Fight.StopFight(); to anti-drown
//This is how I handle it in my very own fight mechanism: _fightStartTs = DateTime.Now; // chase target if necessary, otherwise wait while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && _target.IsAlive && _fightTrigger && !_target.IsTapDenied) { KeepTarget(_targetGuid); //MoveAwayFromEnemies(); // needs to know if enemy is caster KiteIfNecessary(_target); SwimUpForAir(); PotionUser.UsePotions(); ChaseTarget(_target, () => ClassRotation.Range); HandleEvade(_target); EscapeIfNecessary(); Thread.Sleep(150); } private static void SwimUpForAir() { if (AntiDrown.NeedsAirInCombat) { AntiDrown.GaspForAir(); } } using System; using System.Collections.Generic; using System.Threading; using robotManager.FiniteStateMachine; using SmartRobot.Bot.Helpers; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; namespace SmartRobot.Bot.States { public class AntiDrown : State { private static DateTime _breathExpires = DateTime.MaxValue; static AntiDrown() { EventsLuaWithArgs.OnEventsLuaStringWithArgs += AntiDrownEventHandler; } public override string DisplayName => "AntiDrown"; private bool NeedsAir => DateTime.Now.AddSeconds(30) > _breathExpires; public static bool NeedsAirInCombat => DateTime.Now.AddSeconds(15) > _breathExpires; public static bool IsBreathing => _breathExpires != DateTime.MaxValue; public override bool NeedToRun => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && ObjectManager.Me.IsSwimming && NeedsAir; ~AntiDrown() { EventsLuaWithArgs.OnEventsLuaStringWithArgs -= AntiDrownEventHandler; } private static void AntiDrownEventHandler(string id, List<string> args) { if ((id == "MIRROR_TIMER_START") & (args[0] == "BREATH")) { //sets BreathExpires to be in the future by x milliseconds var expiryDate = DateTime.Now.AddMilliseconds(double.Parse(args[1])); _breathExpires = expiryDate; if (!ObjectManager.Me.HaveBuff("Water Breathing")) { ItemsManager.UseItem(5996); } } if (id == "MIRROR_TIMER_STOP") { _breathExpires = DateTime.MaxValue; } } public override void Run() { GaspForAir(); } public static void GaspForAir() { Logger.Info("Swimming up for air"); MovementManager.StopMove(); while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && IsBreathing && ObjectManager.Me.IsSwimming) { Move.JumpOrAscend(Move.MoveAction.DownKey, 1000); Thread.Sleep(500); } // wait at surface while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && IsBreathing && !Common.IsAttackedByNpc) { Thread.Sleep(500); } } } } Hope it helps for inspiration.
-
Matenia reacted to Droidz in [Spells] Strange bug
Hello,
This error is in "SpellManager.SpellInfoCreateCache(List<uint> listId)" when lua function "GetSpellInfo" don't found result.
SpellInfoCreateCache(List<uint> listId) is useb by "SpellManager.GetSpellInfo(uint id)"
SpellManager.GetSpellInfo(uint id) is used by "new Spell(uint spellId)" and "SpellManager.ExistSpellBook(string spellNameInGame)"
-
-
Matenia got a reaction from Pudge in ClearTarget
Try using Interact.ClearTarget();
If that doesn't work, it might be warmane's weird protection or addons causing an issue.
-
Matenia got a reaction from Pudge in Grinder quest type with a path instead of hotspots
It's possible fairly easily, as the quest type already uses a grinder under the hood. But creating the path recorder is more complicated.
I suggest you record the path in the grinder product and just copy over the waypoints. WRobot's code basically creates a path between all hotspots using the pathfinder.
-
Matenia got a reaction from Marsbar in ClearTarget
They use the same protection Warmane does. They're pretty tight with the Warmane devs afaik.
-
Matenia got a reaction from Droidz in ClearTarget
Try using Interact.ClearTarget();
If that doesn't work, it might be warmane's weird protection or addons causing an issue.
-
Matenia got a reaction from sith500 in Wrong Lua events
public static void Start() { EventsLuaWithArgs.OnEventsLuaWithArgs += AntiDrownEventHandler; } public static void Stop() { EventsLuaWithArgs.OnEventsLuaWithArgs -= AntiDrownEventHandler; } private static void AntiDrownEventHandler(LuaEventsId id, List<string> args) { if (id == LuaEventsId.MIRROR_TIMER_START) { Logging.WriteDebug(args[0] + " " + args[1]); } if (id == LuaEventsId.MIRROR_TIMER_START && args[0] == "BREATH") { //sets BreathExpires to be in the future by x milliseconds BreathExpires = DateTime.Now.AddMilliseconds(double.Parse(args[1])); Logging.WriteDebug("Breath has " + double.Parse(args[1]) + " milliseconds left"); } } This code is also "bugged". Ingame Lua event handler: works perfectly, it shows event id, "BREATH" and even 4 arguments.
But using this in the bot, it's never called.
@Droidz maybe you need to add this event manually?
-
Matenia reacted to kecsketragya in What can cause this error?
I don't really know the code, but FightClassWaitForRegen is run by a wow thread, afaik it is actually run by directx by a hardware break and you sleep this thread -> while (Conditions.InGameAndConnectedAndAliveAndProductStarted && !Common.IsAttackedByNpc), so assuming that the first condition is true, it will sleep the thread updating your code until Common.IsAttackedByNpc becomes true, thisway stopping the originally directx thread from doing it's original job. Guessing from the variable's name it isn't constantly true, rather occasionally. I wouldn't sleep the thread based on that.
Edit: the single step exception is actually caused by killing wrobot (the handler for the SEH exception from the hardware bp gets lost)
Edit2: Even if that code is run outside of the client, the cause of the problem might be similar.
-
Matenia got a reaction from TheSmokie in Make CustomClass Thread public
Also if you know a better way to pause fightclass thread than this, let me know:
private Thread SleepFightClassThread(List<Thread> threadsToSleep) { Thread fightClassSleepThread = new Thread(() => { try { foreach (var thread in threadsToSleep) { thread.Suspend(); } while (Conditions.InGameAndConnectedAndAliveAndProductStarted && !Common.IsAttackedByNpc) { Thread.Sleep(500); } } finally { foreach (var thread in threadsToSleep) { thread.Resume(); } } }); fightClassSleepThread.Start(); return fightClassSleepThread; }
-
Matenia reacted to Droidz in Make CustomClass Thread public
Hey, wait next update I added "CustomClassThread" in CusomClass
-
Matenia reacted to Droidz in Deeprun Tram broken pathfinding
ok thank I'll generate new meshes wait few hours
-
-
-
Matenia got a reaction from Droidz in WoW Vanilla Memory error after 06/05/2019 update
When you test droidz binaries, do NOT let wRobot update after restarting it. I can't test atm (maybe Monday at earliest).
-
Matenia got a reaction from Droidz in Bot not buying Food or Drinks
No, I don't want to publish everything on my server because it makes it too easy for people to gain unauthorized access.
I'm sorry if people can't read the readme and come to the forums with that.
-
Matenia reacted to Droidz in [Vanilla] Player corpse not showing in ObjectManager
Hello,
I check and corpse are in objectmanager, I will add in next update position and owner in WoWCorpse class but you can use descriptor manually like that:
-
Matenia reacted to Droidz in Add offmesh (forced) for Barrens Elevator
new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(-4661.469, -1852.599, 85.31993), new Vector3(-4670.487, -1850.974, 85.44978) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, 85.40948)) < 0.5) break; Thread.Sleep(10); }"}, new Vector3(-4676.191, -1854.226, -44.17822) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, -43.52628)) < 0.5) break; Thread.Sleep(10); }"}, }, (int)ContinentId.Kalimdor, PathFinder.OffMeshConnectionType.Unidirectional, true), new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(-4676.191, -1854.226, -44.17822), new Vector3(-4670.487, -1850.974, -44.1039) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, -43.52628)) < 0.5) break; Thread.Sleep(10); }"}, new Vector3(-4661.469, -1852.599, 85.31993) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, 85.40948)) < 0.5) break; Thread.Sleep(10); }"}, }, (int)ContinentId.Kalimdor, PathFinder.OffMeshConnectionType.Unidirectional, true), new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(-4661.469, -1852.599, 85.31993), new Vector3(-4670.487, -1850.974, 85.44978) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, 85.40948)) < 0.5) break; Thread.Sleep(10); }"}, new Vector3(-4676.191, -1854.226, -44.17822) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, -43.52628)) < 0.5) break; Thread.Sleep(10); }"}, new Vector3(-4698.969, -1859.781, -47.16851), new Vector3(-4700.999, -1823.182, -55.39115), new Vector3(-4780.597, -1785.426, -48.56682), new Vector3(-4850.14, -1824.823, -52.75588), new Vector3(-4954.374, -1754.894, -58.46568), new Vector3(-5032.556, -1765.546, -65.54012), new Vector3(-5057.792, -1785.469, -59.28477), new Vector3(-5009.802, -1892.393, 3.451542), new Vector3(-4908.038, -1879.857, 29.39223), new Vector3(-4892.369, -1838.979, 54.76697), new Vector3(-4805.432, -1854.13, 78.42011), new Vector3(-4791.457, -1850.512, 77.53859), new Vector3(-4769.437, -1860.235, 86.28339), new Vector3(-4788.422, -1883.129, 90.03716), new Vector3(-4889.425, -1972.254, 91.88503), new Vector3(-5027.259, -1938.423, 90.68459), }, (int)ContinentId.Kalimdor, PathFinder.OffMeshConnectionType.Unidirectional, true), new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(-5027.259, -1938.423, 90.68459), new Vector3(-4889.425, -1972.254, 91.88503), new Vector3(-4788.422, -1883.129, 90.03716), new Vector3(-4769.437, -1860.235, 86.28339), new Vector3(-4791.457, -1850.512, 77.53859), new Vector3(-4805.432, -1854.13, 78.42011), new Vector3(-4892.369, -1838.979, 54.76697), new Vector3(-4908.038, -1879.857, 29.39223), new Vector3(-5009.802, -1892.393, 3.451542), new Vector3(-5057.792, -1785.469, -59.28477), new Vector3(-5032.556, -1765.546, -65.54012), new Vector3(-4954.374, -1754.894, -58.46568), new Vector3(-4850.14, -1824.823, -52.75588), new Vector3(-4780.597, -1785.426, -48.56682), new Vector3(-4700.999, -1823.182, -55.39115), new Vector3(-4698.969, -1859.781, -47.16851), new Vector3(-4676.191, -1854.226, -44.17822), new Vector3(-4670.487, -1850.974, -44.1039) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, -43.52628)) < 0.5) break; Thread.Sleep(10); }"}, new Vector3(-4661.469, -1852.599, 85.31993) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-4670.77, -1849.61, 85.40948)) < 0.5) break; Thread.Sleep(10); }"}, }, (int)ContinentId.Kalimdor, PathFinder.OffMeshConnectionType.Unidirectional, true), new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(-5387.5, -2483.334, 88.93), new Vector3(-5383.036, -2488.412, 89.06) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-5382.5, -2489.42, 89.02528)) < 0.5) break; Thread.Sleep(10); }"}, new Vector3(-5375.26, -2489.24, -40.56239) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-5382.5, -2489.42, -40.5284)) < 0.5) break; Thread.Sleep(10); }"}, }, (int)ContinentId.Kalimdor, PathFinder.OffMeshConnectionType.Unidirectional, true), new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(-5375.26, -2489.24, -40.56239), new Vector3(-5383.036, -2488.412, -40.48) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-5382.5, -2489.42, -40.5284)) < 0.5) break; Thread.Sleep(10); }"}, new Vector3(-5387.5, -2483.334, 88.93) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Barrens Elevator > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(11899).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(-5382.5, -2489.42, 89.02528)) < 0.5) break; Thread.Sleep(10); }"}, }, (int)ContinentId.Kalimdor, PathFinder.OffMeshConnectionType.Unidirectional, true), }; //wManager.Wow.Helpers.PathFinder.OffMeshConnections.MeshConnection.Clear(); wManager.Wow.Helpers.PathFinder.OffMeshConnections.AddRange(connections); I'll add it to the server
-
Matenia reacted to Droidz in API inconsistency Vanilla/TBC
Hello, in tbc you can use lua for that:
while GetQuestLogTitle(i) do local questTitle, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily = GetQuestLogTitle(i); if ( not isHeader and GetQuestLink(i)) then if {1} == tonumber(string.match(GetQuestLink(i), 'Hquest:(%d+)')) then qId = i; break; end end i = i + 1 end replace {1} by quest id
-
Matenia reacted to Droidz in MovementManager.Face break
Hello, use code like:
var p1 = new Vector3(377.3996, -134.4637, -2, "None"); ObjectManager.Me.Rotation = robotManager.Helpful.Math.TargetFacingToRadian(ObjectManager.Me.Position, p1); Move.StrafeLeft(); Move.StrafeRight();