Jump to content

bael666

Members
  • Posts

    41
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

bael666's Achievements

  1. Noted, thanks for tip - guessing just doing this covers it? Lua.LuaDoString("if not ScanTooltip then ScanTooltip = CreateFrame('GameTooltip', 'ScanTooltip', nil, 'GameTooltipTemplate'); end"); Lua.LuaDoString("ScanTooltip:SetOwner(UIParent, 'ANCHOR_NONE');"); Lua.LuaDoString("ScanTooltip:ClearLines();"); Lua.LuaDoString("ScanTooltip:SetHyperlink(\"" +itemLink+"\");"); I don't set it to nil and only create the frame if it doesn't already exist.
  2. I figured it out... I'm an idiot... Lua.LuaDoString("ScanTooltip:SetHyperlink('" +itemLink+"');"); Changed to this; Lua.LuaDoString("ScanTooltip:SetHyperlink(\"" +itemLink+"\");"); The items that were failing all contained an apostrophe...
  3. I've already read that and tried both solutions posted by @Matenia and @Nax but I'm still having the same issue.
  4. Thanks for that- it all goes a bit beyond my understanding at the moment as I'm probably where you were back in 2016 experimenting with stuff through trial and error! Maybe you could help with another problem I'm having. I'm trying to make a plugin that automatically equips better gear, it works fine for the most part, except for some reason I can't understand it just can't pull the stats for certain items and it's driving me crazy. Basically, I create a tooltip from an itemlink then iterate over the lines, the problem I'm having is that sometimes the tooltip just seems to fail to get created. Lua.LuaDoString("if not ScanTooltip then ScanTooltip = CreateFrame('GameTooltip', 'ScanTooltip', nil, 'GameTooltipTemplate'); end"); Lua.LuaDoString("ScanTooltip:SetOwner(UIParent, 'ANCHOR_NONE');"); Lua.LuaDoString("ScanTooltip:ClearLines();"); Lua.LuaDoString("ScanTooltip:SetHyperlink('" +itemLink+"');"); string[] tooltipLines = Lua.LuaDoString<string[]>("local StatsTable = {} for i = 1, ScanTooltip:NumLines() do local text=_G[\"ScanTooltipTextLeft\"..i]:GetText() table.insert(StatsTable, text) end return unpack(StatsTable);"); // DEBUG STUFF Logging.Write("Item Link: " + itemLink); Logging.Write("Number of Lines:" + Lua.LuaDoString<int>("return ScanTooltip:NumLines()")); Lua.RunMacroText("/script print(\"Item: " + itemLink + "\")"); The top part of the code segment is how I create and then scan the tooltips, below is the result of the 3 debug lines in the WRobot log and WoW chat window; 19:32:21 - [InventoryManager] Started. 19:32:23 - Item Link: |cff1eff00|Hitem:15512:0:0:0:0:0:1097:0|h[Grunt's Shield of the Boar]|h|r 19:32:23 - Number of Lines:0 19:32:23 - [InventoryManager] item "Grunt's Shield" id 15512 reports no stats - blacklisted 19:32:23 - Item Link: |cff1eff00|Hitem:14569:0:0:0:0:0:0:0|h[Bristlebark Bindings]|h|r 19:32:23 - Number of Lines:7 19:32:25 - [InventoryManager] equipping "Bristlebark Bindings" id 14569 value 480 19:32:26 - Item Link: |cff1eff00|Hitem:4697:0:0:0:0:0:0:0|h[Burnished Girdle]|h|r 19:32:26 - Number of Lines:7 19:32:28 - [InventoryManager] [InventoryManager] cannot equip item "Burnished Girdle" id 4697 - blacklisted In example above the tooltip seems to fail to create for Grunt's shield, but in game the itemlink appears to be fine; Any ideas what I could be doing wrong? EDIT: I should point out that the above example makes it look like an issue specifically with items that have a suffix, however, it does work for some items with suffixes and it doesn't work for some items without them. I can't help but feel like I'm missing something really simple.
  5. That's exactly what I'm doing! I got sick of the bot trying to mission to NPCs way out of its level range and getting stuck on a never ending death loop. So I don't let it know about any NPCs, I clear the NPC DB on every to town state and explicitly tell it which NPCs to use based on level and zone. Sample below; private void MulgoreRedCloud() { if (IsZoneLevel("Mulgore", 0, 6)) { SetFoodDrink("Tough Hunk of Bread", "Refreshing Spring Water", 16, 36); AddVendor("Kawnie Softbreeze", 3072, -2893.72, -279.332, 53.91661); AddDruidTrainer("Gart Mistrunner", 3060, -2873.57, -268.591, -53.91648); } } private void MulgoreBloodhoof() { if (IsZoneLevel("Mulgore", 7, 12)) { SellFoodDrink("Tough Hunk of Bread", "Refreshing Spring Water"); SetFoodDrink("Freshly Baked Bread", "Ice Cold Milk"); AddRepair("Kennah Hawkseye", 3078, -2275.53, -289.265, -9.42487); AddVendor("Jhawna Oatwind", 3884, -2378.96, -399.268, -3.889035); AddMailbox("Mailbox", 143984, -2338.21, -367.143, -8.52861); AddDruidTrainer("Gennia Runetotem", 3064, -2315.75, -442.634, -5.438329); } } private void BarrensCrossroads() { if (IsZoneLevel("The Barrens", 10, 19)) { SellFoodDrink("Freshly Baked Bread"); SetFoodDrink("Tel'Abim Banana", "Ice Cold Milk"); AddRepair("Nargal Deatheye", 3479, -356.996, -2568.86, 95.78785); AddVendor("Innkeeper Boorand Plainswind", 3934, -407.123, -2645.22, 96.22299); AddMailbox("Mailbox", 143982, -443.692, -2649.08, 95.7738); TrainInMoonglade(); } } It takes a little longer to setup, but I've built the definitions around a questing profile I setup that takes me all the way to 60, combined with this I've had a bot get to 60 with only one death and minimal intervention - working on improving /played time and fixing some pathing issues now (there's areas the bot always gets stuck, but I've seen a code snippet where I can override path selection within a range of a vector).
  6. Readability is my preference, my plugin currently manages over 150 NPCs, adding them/quickly seeing what the code is doing is far easier in my version; AddRepair("Kennah Hawkseye", 3078, -2275.53, -289.265, -9.42487); AddVendor("Jhawna Oatwind", 3884, -2378.96, -399.268, -3.889035); AddMailbox("Mailbox", 143984, -2338.21, -367.143, -8.52861); AddDruidTrainer("Gennia Runetotem", 3064, -2315.75, -442.634, -5.438329); vs Npc npc = new Npc { Type = NpcType.Vendor, Name = "Kennah Hawkseye", Entry = 3078, Position = new Vector3(-2275.53, -289.265, -9.42487), ContinentId = wManager.Wow.Enums.ContinentId.Kalimdor, Faction = Npc.FactionType.Neutral, CanFlyTo = true }; NpcDB.AddNpc(npc, false, true); npc = new Npc { Type = NpcType.Repair, Name = "Jhawna Oatwind", Entry = 3884, Position = new Vector3(-2378.96, -399.268, -3.889035), ContinentId = wManager.Wow.Enums.ContinentId.Kalimdor, Faction = Npc.FactionType.Neutral, CanFlyTo = true }; NpcDB.AddNpc(npc, false, true); npc = new Npc { Type = NpcType.Mailbox, Name = "Mailbox", Entry = 143984, Position = new Vector3(-2338.21, -367.143, -8.52861), ContinentId = wManager.Wow.Enums.ContinentId.Kalimdor, Faction = Npc.FactionType.Neutral, CanFlyTo = true }; NpcDB.AddNpc(npc, false, true); npc = new Npc { Type = NpcType.DruidTrainer, Name = "Gennia Runetotem", Entry = 3064, Position = new Vector3(-2315.75, -442.634, -5.438329), ContinentId = wManager.Wow.Enums.ContinentId.Kalimdor, Faction = Npc.FactionType.Neutral, CanFlyTo = true }; NpcDB.AddNpc(npc, false, true); I also noticed you changed the "save" bool to store in the NpcDb to true, it's intentionally set to false.
  7. I'll look at implementing some of the cleaner methods, but some of them would lead to a lot of duplicated code in the full plugin. Primarily the removal of AddNpc() as a lot more than just the moonglade trainer are managed by it. Thanks.
  8. In case anyone comes across this, I managed to achieve what I was looking to do using the below code; private void TrainingEvents() { robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += (engine, state, cancelable) => { var currentLevel = wManager.Wow.ObjectManager.ObjectManager.Me.Level; if (state.GetType() == typeof(Trainers)) { if (!wManager.wManagerSetting.CurrentSetting.TrainNewSkills || currentLevel%2 != 0 || (trainInMoonglade && !CanTravelToMoonglade())) { cancelable.Cancel = true; } } }; robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) => { if (state.GetType() == typeof(Trainers) && wManager.Wow.Helpers.Usefuls.MapZoneName != "Moonglade" && trainInMoonglade && CanTravelToMoonglade()) { Lua.RunMacroText("/cast Teleport: Moonglade"); wManager.Wow.Helpers.Usefuls.WaitIsCasting(); Thread.Sleep(5000); if(wManager.Wow.Helpers.Usefuls.MapZoneName != "Moonglade") { cancelable.Cancel = true; } } }; robotManager.Events.FiniteStateMachineEvents.OnAfterRunState += (engine, state) => { if (state.GetType() == typeof(Trainers)) { if (wManager.Wow.Helpers.Usefuls.MapZoneName == "Moonglade" && CanTravelToMoonglade()) { wManager.Wow.Helpers.ItemsManager.UseItem(6948); wManager.Wow.Helpers.Usefuls.WaitIsCasting(); Thread.Sleep(5000); wManager.Wow.Bot.States.ToTown.ForceToTown = true; } } }; } private void AddDruidTrainer(string Name, int Id, double x, double y, double z) { AddNpc(Name, Id, x, y, z, wManager.Wow.Class.Npc.NpcType.DruidTrainer); wManager.wManagerSetting.CurrentSetting.TrainNewSkills = true; } private void TrainInMoonglade() { AddDruidTrainer("Loganaar", 12042, 7867.13, -2593.73, 486.8367); trainInMoonglade = true; } private bool CanTravelToMoonglade() { return wManager.Wow.Helpers.SpellManager.KnowSpell(18960) && Lua.LuaDoString<bool>("return GetItemCooldown(6948)==0"); } private void AddNpc(string Name, int Id, double x, double y, double z, wManager.Wow.Class.Npc.NpcType Type) { robotManager.Helpful.Vector3 pos = new robotManager.Helpful.Vector3(x, y, z); wManager.Wow.Class.Npc npc = new wManager.Wow.Class.Npc { Type = Type, Name = Name, Entry = Id, Position = pos, ContinentId = wManager.Wow.Enums.ContinentId.Kalimdor, Faction = wManager.Wow.Class.Npc.FactionType.Neutral, CanFlyTo = true }; wManager.Wow.Helpers.NpcDB.AddNpc(npc, false, true); } The plugin I'm working on does a lot more stuff so there may be methods in the snippet above that seem redundant but they're used for wider purposes in the overall plugin. I reworked what I originally planned to do slightly as there isn't a mailbox in Moonglade, so the bot will teleport to Moonglade to train, then HS, then run ToTown on return. I'd imagine this could be expanded to mages to TP to Org etc too - I'll probably also look at adding some checks to HS if in Moonglade on non-Trainer events too (in case the bot crashes/closes there and then the bot doesn't know how to get back other than running...) Next up is to figure out how to make it only learn skills I want instead of all of them if anyone knows where I should start there?
  9. I'd like to force my Druid bot to use Teleport: Moonglade, restock/repair and train skills there and then use HS when all of those activities have been done. If possible, I'd also like to disable the ToTown state if HS is on cooldown. Is this possible?
  10. Any chance we could get the source code? I'd like to implement some additional features using the work you've done as a base rather than starting from scratch. Cheers.
    Why does this use stealth and why don't we have an option to turn it off? It's so unnecessarily slow...
×
×
  • Create New...