private bool DoMargossRepIfNeeded(WoWPlayerMe me) { if (LEGION_REP_ZONES.TryGetValue(game.ZoneID, out LegionRepPoint value)) { var timeout = 5000; while (timeout > 0 && me.Location.Distance2D(value.StartingPlayerPoint) > 3) { game.Move2D(value.StartingPlayerPoint, 3f, 1000, true, false); timeout -= 1000; } game.Face(value.StartingFacingPoint); } foreach (var itemID in LEGION_REP_SUMMON_ITEMS) { if (me.ItemsInBags.Any(l => l.EntryID == itemID)) { this.ShowNotify($"Click this message to use your {Wowhead.GetItemInfo(itemID).Name}", false, false, 2, (obj, args) => { game.UseItemByID(itemID); }); break; } } foreach (var itemID in LEGION_REP_CURRENCY_ITEMS) { if (me.ItemsInBags.Where(l => l.EntryID == itemID).Sum(l => l.StackSize) >= 100) { this.ShowNotify($"You cannot get more {Wowhead.GetItemInfo(itemID).Name}", false, true); Thread.Sleep(Utilities.Rnd.Next(1000, 2000)); return(true); } } return(false); }
private void GetSpecialBaitBuffFromNatPagle() { this.LogPrint("Searching for Nat Pagle, id:85984"); var npcs = new List <WowNpc>(); game.GetGameObjects(null, null, npcs); var natPagle = npcs.FirstOrDefault(npc => npc.EntryID == 85984); if (natPagle != null) { this.LogPrint($"Nat Pagle is found, guid: {natPagle.GUID}, moving to him..."); game.Move2D(natPagle.Location, 4f, 2000, false, false); Thread.Sleep(500); this.LogPrint("Opening dialog window with Nat..."); natPagle.Interact(); Thread.Sleep(2000); game.SelectDialogOption("Обычная приманка для рыбы?"); // todo: is it possible to localize it? Thread.Sleep(1500); var gossipText = Wowhead.GetItemInfo(SPECIAL_BAITS.First(baitFish => Wowhead.GetItemInfo(baitFish.Key).Name == settings.SpecialBait).Value).Name; game.SelectDialogOption(gossipText); Thread.Sleep(1500); var goodFishingPoint = new WowPoint(2024.49f, 191.33f, 83.86f); this.LogPrint($"Moving to fishing point [{goodFishingPoint}]"); game.Move2D(goodFishingPoint, 2f, 2000, false, false); var water = new WowPoint((float)(Utilities.Rnd.NextDouble() * 5 + 2032.5f), (float)(Utilities.Rnd.NextDouble() * 5 + 208.5f), 82f); this.LogPrint($"Facing water [{water}]"); game.Face(water); } }
private void DoProspect() { var activePlayer = game.GetGameObjects(); var nextOre = activePlayer.ItemsInBags.FirstOrDefault(l => ores.Contains(l.EntryID) && l.StackSize >= 5); if (nextOre != null) { game.CastSpellByName(Wowhead.GetSpellInfo(31252).Name); game.UseItem(nextOre.BagID, nextOre.SlotID); } }
private void DoDisenchant() { var activePlayer = game.GetGameObjects(); var nextItemToDesenchant = activePlayer.ItemsInBags.FirstOrDefault(l => (l.Class == 2 || l.Class == 4) && l.Quality == 2 && l.Level > 1); if (nextItemToDesenchant != null) { game.CastSpellByName(Wowhead.GetSpellInfo(13262).Name); game.UseItem(nextItemToDesenchant.BagID, nextItemToDesenchant.SlotID); } }
private void AddItemByName(string name, bool useArmory, bool useWowhead) { Item newItem = null; // ignore empty strings if (name.Length <= 0) { return; } // try the armory (if requested) if (useArmory) { Int32 item_id = Armory.GetItemIdByName(name); if (item_id > 0) { newItem = Item.LoadFromId(item_id, true, true, false); } } // try wowhead (if requested) if ((newItem == null) && useWowhead) { // make sure we don't get some bad input that is going to mess with our gem info passing if (!name.Contains(".")) { // need to add + where the spaces are string wowhead_name = name.Replace(' ', '+'); // we can now pass it through the normal URI newItem = Wowhead.GetItem(wowhead_name + ".0.0.0", true); if (newItem != null) { ItemCache.AddItem(newItem, true); } } } if (newItem == null) { MessageBox.Show("Unable to load item: " + name + ".", "Item not found.", MessageBoxButtons.OK); } else { AddNewItemToListView(newItem); } }
private bool ApplySpecialLureIfNeeded(WoWPlayerMe me) { if (settings.UseSpecialBait) { uint baitID = 0; try { if (me.Auras.All(l => l.Name != settings.SpecialBait)) { var item = me.ItemsInBags.FirstOrDefault(l => l.Name == settings.SpecialBait); if (item == null) { if (settings.GetSpecialBaitFromNatPagle) { GetSpecialBaitBuffFromNatPagle(); } else if (settings.UseAnySpecialBaitIfPreferredIsNotAvailable) { var haveBuff = me.Auras.Any(aura => SPECIAL_BAITS.Keys.Select(l => Wowhead.GetItemInfo(l).Name).Contains(aura.Name)); if (!haveBuff) { baitID = SPECIAL_BAITS.Keys.FirstOrDefault(itemID => me.ItemsInBags.Select(itemInBag => itemInBag.EntryID).Contains(itemID)); } } } baitID = item?.EntryID ?? 0; } } catch (Exception ex) { this.LogPrint(ex.Message + "\r\n" + ex.StackTrace); baitID = 0; } if (baitID != 0) { this.LogPrint($"Applying special lure --> ({Wowhead.GetItemInfo(baitID).Name})"); game.UseItemByID(baitID); Thread.Sleep(Utilities.Rnd.Next(250, 750)); return(true); } } return(false); }
private void AddItemsById(int[] ids, bool useArmory, bool useWowhead) { foreach (int id in ids) { Item newItem = null; // try the armory (if requested) if (useArmory) { newItem = Item.LoadFromId(id, true, true, false); } // try wowhead (if requested) if ((newItem == null) && useWowhead) { newItem = Wowhead.GetItem(id.ToString(), true); if (newItem != null) { ItemCache.AddItem(newItem, true); } } if ((newItem == null) && useWowhead) { newItem = Wowhead.GetItem("ptr", id.ToString(), true); if (newItem != null) { ItemCache.AddItem(newItem, true); } } if (newItem == null) { if (MessageBox.Show("Unable to load item " + id.ToString() + ". Would you like to create the item blank and type in the values yourself?", "Item not found. Create Blank?", MessageBoxButtons.YesNo) == DialogResult.Yes) { newItem = new Item("New Item", ItemQuality.Epic, ItemType.None, id, "temp", ItemSlot.Head, string.Empty, false, new Stats(), new Stats(), ItemSlot.None, ItemSlot.None, ItemSlot.None, 0, 0, ItemDamageType.Physical, 0f, string.Empty); ItemCache.AddItem(newItem); } } { AddNewItemToListView(newItem); } } }
private bool ApplyBestLureIfNeeded(WoWPlayerMe me) { if (settings.UseBestBait) { uint baitID = 0; if (me.Inventory.Length > 15 && me.Inventory.Any(l => FISHING_RODS.Contains(l.EntryID)) && (DateTime.UtcNow - lastTimeLureApplied).TotalMinutes > 10) { baitID = BAITS.FirstOrDefault(l => me.ItemsInBags.Any(k => k.EntryID == l)); } if (baitID != 0) { this.LogPrint($"Applying lure --> ({Wowhead.GetItemInfo(baitID).Name})"); game.UseItemByID(baitID); lastTimeLureApplied = DateTime.UtcNow; Thread.Sleep(Utilities.Rnd.Next(250, 750)); return(true); } } return(false); }
private void OnZoneChanged(uint zone) { switch (zone) { case 3277: case 5031: // Два Пика searchingObjects = new[] { Wowhead.GetSpellInfo(23335).Name, Wowhead.GetSpellInfo(23333).Name }; // Флаг Альянса, Horde Flag break; case 3820: // regular Око Бури case 5799: searchingObjects = new[] { Wowhead.GetSpellInfo(34976).Name, "Флаг Ока Бури" }; // Флаг Пустоверти break; case 6051: searchingObjects = new[] { Wowhead.GetSpellInfo(121164).Name }; // entry ids: 212091, 212092, 212093, 212094; Сфера могущества break; case 6665: // Каньон Суровых Ветров searchingObjects = new[] { Wowhead.GetSpellInfo(140876).Name, Wowhead.GetSpellInfo(141210).Name }; // Вагонетка Альянса, Вагонетка Орды break; case 9136: // Бурлящий берег searchingObjects = new[] { Wowhead.GetSpellInfo(273459).Name }; // Азерит break; default: searchingObjects = new string[] { }; break; } if (searchingObjects.Length > 0) { var zoneText = game.ZoneText; this.LogPrint($"We're in {zoneText}, searching for {{{string.Join(", ", searchingObjects)}}}"); this.ShowNotify($"{zoneText}: {{{string.Join(", ", searchingObjects)}}}", false, true); } else { this.LogPrint("Unknown battlefield, ID: " + zone + "; zoneText: " + game.ZoneText); } }
private bool DoDalaranAchievementIfNeeded(WoWPlayerMe me) { if (settings.DalaranAchievement) { uint itemID = 0; if (me.Auras.All(l => !DALARAN_ACHIVEMENT_TRADE_ITEMS.Select(k => k.AuraID).Contains(l.SpellId) || l.TimeLeftInMs < 20000)) { var lureInBags = me.ItemsInBags.FirstOrDefault(l => DALARAN_ACHIVEMENT_TRADE_ITEMS.Select(k => k.ItemID).Contains(l.EntryID)); if (lureInBags != null) { itemID = lureInBags.EntryID; } this.LogPrint("Searching for Marcia Chase, id:95844"); var npcs = new List <WowNpc>(); game.GetGameObjects(null, null, npcs); var marciaChase = npcs.FirstOrDefault(npc => npc.EntryID == 95844); if (marciaChase != null) { this.LogPrint($"Marcia Chase is found, guid: {marciaChase.GUID}, interacting..."); marciaChase.Interact(); Thread.Sleep(Utilities.Rnd.Next(750, 1250)); this.LogPrint("I: I wish to buy something..."); game.SelectDialogOption("Мне бы хотелось купить что-нибудь у вас."); // todo: is it possible to localize it? Thread.Sleep(Utilities.Rnd.Next(750, 1250)); var newLure = DALARAN_ACHIVEMENT_TRADE_ITEMS[Utilities.Rnd.Next(0, DALARAN_ACHIVEMENT_TRADE_ITEMS.Count)]; this.LogPrint("Buying lure " + Wowhead.GetItemInfo(newLure.ItemID).Name + "..."); game.BuyMerchantItem(newLure.ItemID, 1); Thread.Sleep(Utilities.Rnd.Next(750, 1250)); this.LogPrint("Closing dialog window..."); game.SendToChat("/run CloseMerchant()"); itemID = newLure.ItemID; this.LogPrint($"Applying lure for Dalaran achievement --> ({Wowhead.GetItemInfo(itemID).Name})"); game.UseItemByID(itemID); Thread.Sleep(Utilities.Rnd.Next(250, 750)); return(true); } } } return(false); }
private bool ApplyLegionSpecialLureIfNeeded(WoWPlayerMe me) { if (settings.LegionUseSpecialLure) { uint baitID = 0; try { var zone = game.ZoneID; var allBuffNames = LEGION_SPECIAL_LURES_BY_ZONE.SelectMany(l => l.Lures).Select(l => Wowhead.GetItemInfo(l).Name).ToArray(); if (me.Auras.All(k => !allBuffNames.Contains(k.Name))) { var info = LEGION_SPECIAL_LURES_BY_ZONE.FirstOrDefault(l => l.ZoneID == zone); if (info != null) { var item = me.ItemsInBags.FirstOrDefault(l => info.Lures.Contains(l.EntryID)); if (item != null) { baitID = item.EntryID; } } } } catch (Exception ex) { this.LogPrint(ex.Message + "\r\n" + ex.StackTrace); baitID = 0; } if (baitID != 0) { this.LogPrint($"Applying Legion special lure --> ({Wowhead.GetItemInfo(baitID).Name})"); game.UseItemByID(baitID); Thread.Sleep(Utilities.Rnd.Next(250, 750)); return(true); } } return(false); }
private bool ApplyArcaneLureIfNeeded(WoWPlayerMe me) { if (settings.UseArcaneLure) { uint itemID = 0; var arcaneLureSpellName = Wowhead.GetSpellInfo(218861).Name; if (me.Auras.All(l => l.Name != arcaneLureSpellName)) { var item = me.ItemsInBags.FirstOrDefault(l => l.Name == arcaneLureSpellName); if (item != null) { itemID = item.EntryID; } } if (itemID != 0) { this.LogPrint($"Applying arcane lure --> ({Wowhead.GetItemInfo(itemID).Name})"); game.UseItemByID(itemID); Thread.Sleep(Utilities.Rnd.Next(250, 750)); return(true); } } return(false); }
public static IEnumerable <BlackMarketItem> GetAllItems(GameInterface game) { if (game.IsInGame) { var numItems = game.Memory.Read <uint>(game.Memory.ImageBase + WowBuildInfoX64.BlackMarketNumItems); if (numItems != 0) { var baseAddr = game.Memory.Read <IntPtr>(game.Memory.ImageBase + WowBuildInfoX64.BlackMarketItems); for (uint i = 0; i < numItems; ++i) { var finalAddr = (int)(baseAddr + (int)(i * sizeofBmItem)); BlackMarketItemInternal item = game.Memory.Read <BlackMarketItemInternal>(new IntPtr(finalAddr)); yield return(new BlackMarketItem { Name = Wowhead.GetItemInfo(item.Entry).Name, Image = Wowhead.GetItemInfo(item.Entry).Image, TimeLeft = TimeSpan.FromSeconds(item.TimeLeft), LastBidGold = (int)(item.currBid > 0 ? (uint)(item.currBid / 10000) : item.NextBid / 10000), NumBids = (int)item.NumBids }); } } } }
public void OnPulse() { var activePlayer = game.GetGameObjects(); if (activePlayer != null) { if (!game.IsLooting) { if (activePlayer.CastingSpellID == 0 && activePlayer.ChannelSpellID == 0) { if (game.IsSpellKnown(51005)) // mill { if (settings.UseFastDraenorMill && activePlayer.ItemsInBags.Any(l => fastMillHerbs.Contains(l.EntryID) && l.StackSize >= 20)) { game.SendToChat($"/run {someRandomString}={{}}"); game.SendToChat($"/run local s=C_TradeSkillUI.GetFilteredRecipeIDs();local t={{}};if(#s>0) then for i=1,#s do C_TradeSkillUI.GetRecipeInfo(s[i], t);{someRandomString}[t.name]={{t.recipeID,t.numAvailable}}; end end"); game.SendToChat($"/run for n,i in pairs({someRandomString}) do if(strfind(n,\"Массовое измельчение\") and i[2]>0) then C_TradeSkillUI.CraftRecipe(i[1],i[2]);return; end end"); Thread.Sleep(2000); return; } if (activePlayer.ItemsInBags.Any(l => l.EntryID == 136926)) // Кошмарный стручок { game.UseItemByID(136926); Thread.Sleep(500); return; } var nextHerb = activePlayer.ItemsInBags.FirstOrDefault(l => herbs.Contains(l.EntryID) && l.StackSize >= 5); if (nextHerb != null) { game.CastSpellByName(Wowhead.GetSpellInfo(51005).Name); game.UseItem(nextHerb.BagID, nextHerb.SlotID); Thread.Sleep(500); return; } if (settings.LaunchInkCrafter) { this.AddPluginToRunning("InkCrafter"); } } if (game.IsSpellKnown(31252)) // prospect { DoProspect(); } if (game.IsSpellKnown(13262)) // disenchant { Thread.Sleep(1000); // pause to prevent disenchanting nonexistent item DoDisenchant(); } if ((DateTime.UtcNow - lastNotifiedAboutCompletion).TotalSeconds >= 60) { this.ShowNotify("Task is completed", false, true); lastNotifiedAboutCompletion = DateTime.UtcNow; } } else { Thread.Sleep(500); // wait for cast } } } }