Jump to content

scsfl

Members
  • Posts

    30
  • Joined

  • Last visited

Recent Profile Visitors

939 profile views

scsfl's Achievements

  1. hello community! I'm trying to implement following method in druid FC: when condition met bot has to use flying mount, else ground mount. There is following logic: I'm subscribing to OnPathFinderFindPath event and checking if I need to use flying path to destination point. If so then I'm setting destination flying and calling LongMove.LongMoveGo(destination). private static void checkIfNeedFlyingPath(Vector3 from, Vector3 to, string continentNameMpq, CancelEventArgs cancelable) { if (NeedToUseFlyingPath(to)) { to.SetFlying(); UseFlightForm(); Logging.WriteNavigator($"LongMove to {to}"); LongMove.LongMoveGo(to); cancelable.Cancel = true; } } Function that check if I need to fly. private static bool NeedToUseFlyingPath(Vector3 dest) { RotationLogger.Debug($"Calling NeedToUseFlyingPath({dest})"); if (!FlightForm.IsKnown() || Me.IsDead || Me.IsSwimming || Usefuls.ContinentNameMpq == "Azeroth") { RotationLogger.Debug($"NeedToUseFlyingPath() precondition failed!"); return false; } float dist = Me.Position.DistanceTo(dest); RotationLogger.Debug($"[Movement] Distance to point {dist}"); if (dist >= FCSettings.CurrentSetting.MinDistanceToFly && (Logging.Status == "To Town" || Logging.Status == "Farming" || Logging.Status == "Looting" || ToTown.GoToTownInProgress || dist >= FCSettings.CurrentSetting.DistanceToFly)) { RotationLogger.Debug($"[Movement] Need to use flying path to {dest}"); return true; } RotationLogger.Debug($"[Movement] Need to use ground path to {dest}"); return false; } The problem that this method is not stable. Sometimes it works fine, sometimes especially after farming state bot literally walks by the ground in flying form, then he might continue flying. I couldn't get where does he get this ground points when there is LongMove between 2 points 🙂 When I use built-in flying mechanics everything works decent. But I don't know how to implement similar flight mechanics.
  2. Thank you @Matenia. Very helpful template with useful class. Helped me to make a weekly quester with grinder rotation depending on a day of the week.
  3. You have to modify ur fightclass. public void Initialize() { FightEvents.OnFightLoop += TargetSwitcher; } public void Dispose() { FightEvents.OnFightLoop -= TargetSwitcher; } private void TargetSwitcher(WoWUnit woWPlayer, System.ComponentModel.CancelEventArgs cancelable) { WoWPlayer player = ObjectManager.GetNearestWoWPlayer(ObjectManager.GetObjectWoWPlayer().Where(o => o.IsAttackable).ToList()); if (player == null || !player.IsValid || !player.IsAlive || player.Faction == ObjectManager.Me.Faction || player.IsFlying || player.IsMyTarget || woWPlayer.Guid == player.Guid) return; if (player.InCombatWithMe && ObjectManager.Target.Type != WoWObjectType.Player) { cancelable.Cancel = true; Fight.StartFight(player.Guid, robotManager.Products.Products.ProductName != "WRotation", false); } }
  4. @Matenia has shared an example containing method you're looking for.
  5. Fixed. Thank you for code review.
  6. Brilliant advice man! I'm very appreciating your help. var luaString = @" function OnEvent(self, event) local args = { } eventInfo = {CombatLogGetCurrentEventInfo()} for key, value in pairs(eventInfo) do table.insert(args, tostring(value)) end _G.args = (table.concat(args, ',')) end print ('frame works') f = CreateFrame('Frame') f: SetAttribute(name, 'CLEU') f: RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED') f: SetScript('OnEvent', OnEvent)"; Now I'm able to access _G.args from OnEventsLuaStringWithArgs ?. Thanks ?
  7. Can I ask one more dumb question please. Ok I did lua string that initialize lua frame and I'm able to store the payload in table each time event fired. luaString = @" local function OnEvent(self, event) local args = { } eventInfo = {CombatLogGetCurrentEventInfo()} for key, value in pairs(eventInfo) do table.insert(args, tostring(value)) end args = (table.concat(args, ',')) print (args) --debug end local f = CreateFrame('Frame') f: SetAttribute(name, 'CLEU') f: RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED') f: SetScript('OnEvent', OnEvent)"; Also I've got a C# function that which takes CLEU args as parameter. Is there way to call this function inside luaString? In other words I need to send args to a function every time event fired. The only thing comes in mind is to create chat frame inside lua string, sent CLEU args to this frame and read this frame using EventsLuaWithArgs.OnEventsLuaStringWithArgs. But It looks awful ?
  8. Hi there! Does anybody know Is there way to make fight class listen to Lua events? Especially COMBAT_LOG_EVENT_UNFILTERED. Yeah I know there is EventsLuaWithArgs.OnEventsLuaStringWithArgs but it pretty often skips COMBAT_LOG_EVENT_UNFILTERED and even when it fires it doesn't return any args cuz I have to use CombatLogGetCurrentEventInfo() function to get a payload. How can I subscribe COMBAT_LOG_EVENT_UNFILTERED with args using c#? Thank you.
  9. This options is not about determinating which rotation spells should be casted or skipped. As Droidz said earlier with that options your next rotation spell tries to launch before it can be used and that is why in some cases this spell could be skipped. If you want your rotation to work as you intend I do not recommend to use this option.
  10. Most advanced and fundamental fight class sample I've ever seen. Awesome work. The only moment I still didn't get is wanding. Sometimes while wanding the bot is something like can't change rotation step. I mean for example i've got 10 steps in my rotation. Wanding has lowest priority. And if all conditions is fit for wanding he starts shoot. Everything is fine, but if he starts wanding, rotation step is not changing until I manually interrupt hes wanding process by pressing any movement key. Right after that rotation is working again as it should and bot continues rotate steps. Even other rotations spells with "force" enabled doesn't work. This problem happens only when bot is wanding. For other spells everything is good. My conditions for wanding: new RotationStep(new RotationSpell("Shoot"), 10f, (s, t) => MeHaveWand() && !RotationCombatUtil.IsAutoShooting() && !Me.GetMove, RotationCombatUtil.BotTarget), private static bool MeHaveWand() { return ObjectManager.Me.GetEquipedItemBySlot(InventorySlot.INVSLOT_RANGED) != 0 ? true : false; } public static bool IsAutoShooting() { return Lua.LuaDoString<bool>("return IsAutoRepeatSpell('Shoot')"); } Maybe some problems with spell verification. Wow vanilla.
  11. Hi. Try this. Returns a dictionary where key is itemname and value is lowest price. private static Dictionary<string, int> GetLowestItemPrice() { Dictionary<string, int> CheapestItems = new Dictionary<string, int>(); List<AuctionHelpers.AuctionItem> ItemsList = new List<AuctionHelpers.AuctionItem>(); List<string> ItemsToCheck = /*your list of items*/ int LowestPrice = 0; if (AuctionHelpers.AuctionHouseIsShown()) foreach (string item in ItemsToCheck) { AuctionHelpers.BrowseNameSetText(item); Thread.Sleep(2000); AuctionHelpers.IsUsableCheckButtonSetChecked(false); if (AuctionHelpers.BrowseSearchButtonIsEnabled()) { AuctionHelpers.BrowseSearchButtonClick(); Thread.Sleep(2000); while (AuctionHelpers.BrowseNextPageButtonIsEnabled()) { if (AuctionHelpers.GetBrowsePageItems().Any()) { ItemsList.AddRange(AuctionHelpers.GetBrowsePageItems()); AuctionHelpers.BrowseNextPageButtonClick(); Thread.Sleep(1000); } } if (AuctionHelpers.GetBrowsePageItems().Any()) ItemsList.AddRange(AuctionHelpers.GetBrowsePageItems()); ItemsList.RemoveAll(i => (i.Name != item) || (i.BuyoutPricePerUnit == 0)); LowestPrice = ItemsList.Min(price => price.BuyoutPricePerUnit); CheapestItems.Add(item, LowestPrice); } } foreach (KeyValuePair<string, int> kvp in CheapestItems) { Logging.Write("Itemname = " + kvp.Key + "Itemprice " + kvp.Value); } AuctionHelpers.CloseAuctionHouse(); return CheapestItems; }
  12. Thanks. But I've already checked wManager lib and I didn't see anything suits my need. Anyway looks like the only method is using lua.
  13. Hi there! Trying to make own AH product. And there is a question. How do I get list of items currently sailing by me? I've tried AuctionHelpers.GetBrowsePageItems() But looks like it only works for "Browse" tab of AH. So i cannot get list of elements when I'm on "Auction" tab. Is there built-in function? Or it could be resolved only by lua?
  14. That's problem. When I click on button "Player/Target Buff/Debuff" I've got following message in debug log "[SpellManager] Cannot found spell: public static SpellInfo SpellInfoCreateCache()". And even I've got buff on me, it doesn't show in dev tools window. It shows everything, except this buff. So I can't check spell id. And the most interesting thing, that this problem appears only with one character. On other heroes everything works fine!
  15. Ok replace your bin\wManager.dll in wrobot folder to attached file and launch bot via relogger. Just temporary solution. wManager.dll
×
×
  • Create New...