public static void LoadNewProfile(string profession, string profileName) { Profile = new GrinderProfile(); string filePath = Application.StartupPath + "\\Profiles\\Wholesome Professions\\" + profileName; Bot.ProfileName = profileName; // If grinder School Load Profile if (!string.IsNullOrWhiteSpace(profileName) && File.Exists(filePath)) { Profile = XmlSerializer.Deserialize <GrinderProfile>(filePath); if (Profile.GrinderZones.Count <= 0) { Logger.Log($"Profile '{filePath}' seems incorrect. Please use a Grinder profile."); UnloadCurrentProfile(); return; } else { Logger.Log("Profile loaded"); } } else { Logger.LogLineBroadcastImportant($"Profile file '{filePath}' not found"); UnloadCurrentProfile(); return; } SelectZone(); // Black List: var blackListDic = Profile.GrinderZones.SelectMany(zone => zone.BlackListRadius).ToDictionary(b => b.Position, b => b.Radius); //wManager.wManagerSetting.AddRangeBlackListZone(blackListDic); // Add Npc foreach (var zone in Profile.GrinderZones) { NpcDB.AddNpcRange(zone.Npc); } // Go to first hotspot or travel if (Profile.GrinderZones.Count > 0) { string zoneName = Profile.GrinderZones[ZoneIdProfile].Name; int continentId = TravelHelper.GetContinentFromZoneName(zoneName); Logger.LogDebug($"Zone {zoneName} is on continent {continentId.ToString()}"); if (continentId == -1) { Logger.LogLineBroadcastImportant($"ERROR : The zone name {zoneName} from your profile is incorrect. Please use default zone names."); UnloadCurrentProfile(); return; } if (continentId != Usefuls.ContinentId) { Logger.Log($"{Profile.GrinderZones[ZoneIdProfile].Name} is on another continent ({continentId}). Launching traveler."); Bot.SetContinent((ContinentId)continentId); return; } Bot.ProfileProfession = profession; Logger.Log($"Heading to first spot {Profile.GrinderZones[ZoneIdProfile].Vectors3[0]} in {Profile.GrinderZones[ZoneIdProfile].Name}"); Broadcaster.autoBroadcast = false; Broadcaster.BroadCastSituation(); GoToTask.ToPosition(Profile.GrinderZones[ZoneIdProfile].Vectors3[0], 50); Broadcaster.autoBroadcast = true; } else { Logger.LogDebug("No grinder zone found"); UnloadCurrentProfile(); } }
// Various mount repair, portable mailbox, repair robots, Guild Page... public static void PulseRadar() { if (!Usefuls.InGame || Usefuls.IsLoading) { return; } var npcRadar = new List <Npc>(); List <WoWGameObject> Mailboxes = ObjectManager.GetWoWGameObjectOfType(WoWGameObjectType.Mailbox); List <WoWUnit> Vendors = ObjectManager.GetWoWUnitVendor(); List <WoWUnit> Repairers = ObjectManager.GetWoWUnitRepair(); List <WoWUnit> NpcMailboxes = ObjectManager.GetWoWUnitMailbox(); var npcRadarQuesters = new List <Npc>(); List <WoWUnit> NpcQuesters = ObjectManager.GetWoWUnitQuester(); List <WoWGameObject> ObjectQuesters = ObjectManager.GetWoWGameObjectOfType(WoWGameObjectType.Questgiver); foreach (WoWGameObject o in Mailboxes) { if (o.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = o.Entry, Faction = UnitRelation.GetObjectRacialFaction(o.Faction), Name = o.Name, Position = o.Position, Type = Npc.NpcType.Mailbox }); } foreach (WoWUnit n in Vendors) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Vendor }); } foreach (WoWUnit n in Repairers) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Repair }); } foreach (WoWUnit n in NpcMailboxes) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Mailbox }); } foreach (WoWUnit n in NpcQuesters) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadarQuesters.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.QuestGiver }); } foreach (WoWGameObject o in ObjectQuesters) { if (o.CreatedBy != 0) { continue; } npcRadarQuesters.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = o.Entry, Faction = UnitRelation.GetObjectRacialFaction(o.Faction), Name = o.Name, Position = o.Position, Type = Npc.NpcType.QuestGiver }); } int d = NpcDB.AddNpcRange(npcRadar, true); if (d == 1) { Logging.Write("Found " + d + " new NPC/Mailbox in memory"); } else if (d > 1) { Logging.Write("Found " + d + " new NPCs/Mailboxes in memory"); } d = AddQuesters(npcRadarQuesters, true); if (d == 1) { Logging.Write("Found " + d + " new Quest Giver in memory"); } else if (d > 1) { Logging.Write("Found " + d + " new Quest Givers in memory"); } }
public override void Run() { if (!IgnoreSmeltingZone) { Logging.Write("Smelting in progress"); Npc smeltingZone = NpcDB.GetNpcNearby(Npc.NpcType.SmeltingForge); if (smeltingZone.Entry <= 0) { return; } if (smeltingZone.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 10) { List <Point> pointssmelting = new List <Point>(); if ((smeltingZone.Position.Type.ToLower() == "flying") && nManagerSetting.CurrentSetting.FlyingMountName != "") { pointssmelting.Add(smeltingZone.Position); } else { pointssmelting = PathFinder.FindPath(smeltingZone.Position); } MovementManager.Go(pointssmelting); Timer timer = new Timer((int)(Math.DistanceListPoint(pointssmelting) / 3 * 1000) + 5000); Thread.Sleep(700); while (MovementManager.InMovement && Products.Products.IsStarted && Usefuls.InGame && !ObjectManager.ObjectManager.Me.InInevitableCombat && !ObjectManager.ObjectManager.Me.IsDeadMe) { if (timer.IsReady) { MovementManager.StopMove(); } if (smeltingZone.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 3.7f) { MovementManager.StopMove(); } Thread.Sleep(100); } } MovementManager.StopMove(); Tasks.MountTask.DismountMount(); Thread.Sleep(500); if (smeltingZone.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 15) { return; } } // Smelting Smelting.OpenSmeltingWindow(); Timer timer2 = new Timer(15 * 60 * 1000); while (Smelting.NeedRun(false) && Products.Products.IsStarted && Usefuls.InGame && !ObjectManager.ObjectManager.Me.InCombat && !ObjectManager.ObjectManager.Me.IsDeadMe && !timer2.IsReady) { Smelting.Pulse(); Thread.Sleep(1500); while (ObjectManager.ObjectManager.Me.IsCast && Products.Products.IsStarted && Usefuls.InGame && !ObjectManager.ObjectManager.Me.InCombat && !ObjectManager.ObjectManager.Me.IsDeadMe && !timer2.IsReady) { Thread.Sleep(700); if (!ObjectManager.ObjectManager.Me.IsCast) { Thread.Sleep(700); } } Thread.Sleep(Usefuls.Latency); } Smelting.CloseSmeltingWindow(); }
public override void Run() { List <Npc> listNPCs = new List <Npc>(); Npc mailBox = null; // Stop fisher if needed if (Products.Products.ProductName == "Fisherbot" && FishingTask.IsLaunched) { FishingTask.StopLoopFish(); // Then break the cast MovementsAction.MoveBackward(true); Thread.Sleep(50); MovementsAction.MoveBackward(false); } // If we need to send items. if (nManagerSetting.CurrentSetting.ActivateAutoMaillingFeature && !_suspendMailing && nManagerSetting.CurrentSetting.MaillingFeatureRecipient != string.Empty && Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SendMailWhenLessThanXSlotLeft) { if (_useMollE) { MountTask.DismountMount(); ItemsManager.UseItem(ItemsManager.GetItemNameById(40768)); Thread.Sleep(2000); WoWGameObject portableMailbox = ObjectManager.ObjectManager.GetNearestWoWGameObject( ObjectManager.ObjectManager.GetWoWGameObjectById(191605)); if (portableMailbox.IsValid && portableMailbox.CreatedBy == ObjectManager.ObjectManager.Me.Guid) { mailBox = new Npc { Entry = portableMailbox.Entry, Position = portableMailbox.Position, Name = portableMailbox.Name, ContinentIdInt = Usefuls.ContinentId, Faction = ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? Npc.FactionType.Horde : Npc.FactionType.Alliance, SelectGossipOption = 0, Type = Npc.NpcType.Mailbox }; } } if (mailBox == null && NpcDB.GetNpcNearby(Npc.NpcType.Mailbox).Entry > 0) { mailBox = NpcDB.GetNpcNearby(Npc.NpcType.Mailbox); } listNPCs.Add(mailBox); } // If we need to repair. if (ObjectManager.ObjectManager.Me.GetDurability <= nManagerSetting.CurrentSetting.RepairWhenDurabilityIsUnderPercent && nManagerSetting.CurrentSetting.ActivateAutoRepairFeature) { if (_magicMountMammoth && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0) { if (_travelersTundraMammoth.HaveBuff || _travelersTundraMammoth.IsSpellUsable) { if (!_travelersTundraMammoth.HaveBuff) { MountTask.DismountMount(); _travelersTundraMammoth.Launch(true, true, true); Thread.Sleep(2000); } if (ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde") { WoWUnit drixBlackwrench = ObjectManager.ObjectManager.GetNearestWoWUnit( ObjectManager.ObjectManager.GetWoWUnitByEntry(32641)); if (drixBlackwrench.IsValid && drixBlackwrench.IsAlive) { Npc drixBlackwrenchNpc = new Npc { Entry = drixBlackwrench.Entry, Position = drixBlackwrench.Position, Name = drixBlackwrench.Name, ContinentIdInt = Usefuls.ContinentId, Faction = Npc.FactionType.Horde, SelectGossipOption = 0, Type = Npc.NpcType.Repair }; listNPCs.Add(drixBlackwrenchNpc); } } else { WoWUnit gnimo = ObjectManager.ObjectManager.GetNearestWoWUnit( ObjectManager.ObjectManager.GetWoWUnitByEntry(32639)); if (gnimo.IsValid && gnimo.IsAlive) { Npc gnimoNpc = new Npc { Entry = gnimo.Entry, Position = gnimo.Position, Name = gnimo.Name, ContinentIdInt = Usefuls.ContinentId, Faction = Npc.FactionType.Alliance, SelectGossipOption = 0, Type = Npc.NpcType.Repair }; listNPCs.Add(gnimoNpc); } } } } else if (_magicMountYak && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0) { if (_grandExpeditionYak.HaveBuff || _grandExpeditionYak.IsSpellUsable) { if (!_grandExpeditionYak.HaveBuff) { MountTask.DismountMount(); _grandExpeditionYak.Launch(true, true, true); Thread.Sleep(2000); } WoWUnit cousinSlowhands = ObjectManager.ObjectManager.GetNearestWoWUnit( ObjectManager.ObjectManager.GetWoWUnitByEntry(62822)); if (cousinSlowhands.IsValid && cousinSlowhands.IsAlive) { Npc cousinSlowhandsNpc = new Npc { Entry = cousinSlowhands.Entry, Position = cousinSlowhands.Position, Name = cousinSlowhands.Name, ContinentIdInt = Usefuls.ContinentId, Faction = ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? Npc.FactionType.Horde : Npc.FactionType.Alliance, SelectGossipOption = 0, Type = Npc.NpcType.Repair }; listNPCs.Add(cousinSlowhandsNpc); } } } else if (_use74A) { Npc npcA = DoSpawnRobot("74A", Npc.NpcType.Repair); if (npcA != null) { listNPCs.Add(npcA); } } else if (_use110G) { Npc npcG = DoSpawnRobot("110G", Npc.NpcType.Repair); if (npcG != null) { listNPCs.Add(npcG); } } else if (_useJeeves) { Npc npcJeeves = DoSpawnRobot("Jeeves", Npc.NpcType.Repair); if (npcJeeves != null) { listNPCs.Add(npcJeeves); } } else { if (NpcDB.GetNpcNearby(Npc.NpcType.Repair).Entry > 0) { listNPCs.Add(NpcDB.GetNpcNearby(Npc.NpcType.Repair)); } } } // If we need to sell. if (NeedFoodSupplies() || NeedDrinkSupplies() || Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SellItemsWhenLessThanXSlotLeft && nManagerSetting.CurrentSetting.ActivateAutoSellingFeature && !_suspendSelling) { if (_magicMountMammoth && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0) { if (_travelersTundraMammoth.HaveBuff || _travelersTundraMammoth.IsSpellUsable) { if (!_travelersTundraMammoth.HaveBuff) { MountTask.DismountMount(); _travelersTundraMammoth.Launch(true, true, true); Thread.Sleep(2000); } if (ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde") { WoWUnit mojodishu = ObjectManager.ObjectManager.GetNearestWoWUnit( ObjectManager.ObjectManager.GetWoWUnitByEntry(32642)); if (mojodishu.IsValid && mojodishu.IsAlive) { Npc mojodishuNpc = new Npc { Entry = mojodishu.Entry, Position = mojodishu.Position, Name = mojodishu.Name, ContinentIdInt = Usefuls.ContinentId, Faction = Npc.FactionType.Horde, SelectGossipOption = 0, Type = Npc.NpcType.Vendor }; listNPCs.Add(mojodishuNpc); } } else { WoWUnit hakmuddArgus = ObjectManager.ObjectManager.GetNearestWoWUnit( ObjectManager.ObjectManager.GetWoWUnitByEntry(32638)); if (hakmuddArgus.IsValid && hakmuddArgus.IsAlive) { Npc hakmuddArgusNpc = new Npc { Entry = hakmuddArgus.Entry, Position = hakmuddArgus.Position, Name = hakmuddArgus.Name, ContinentIdInt = Usefuls.ContinentId, Faction = Npc.FactionType.Alliance, SelectGossipOption = 0, Type = Npc.NpcType.Vendor }; listNPCs.Add(hakmuddArgusNpc); } } } } else if (_magicMountYak && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0) { if (_grandExpeditionYak.HaveBuff || _grandExpeditionYak.IsSpellUsable) { if (!_grandExpeditionYak.HaveBuff) { MountTask.DismountMount(); _grandExpeditionYak.Launch(true, true, true); Thread.Sleep(2000); } WoWUnit cousinSlowhands = ObjectManager.ObjectManager.GetNearestWoWUnit( ObjectManager.ObjectManager.GetWoWUnitByEntry(62822)); if (cousinSlowhands.IsValid && cousinSlowhands.IsAlive) { Npc cousinSlowhandsNpc = new Npc { Entry = cousinSlowhands.Entry, Position = cousinSlowhands.Position, Name = cousinSlowhands.Name, ContinentIdInt = Usefuls.ContinentId, Faction = Npc.FactionType.Neutral, SelectGossipOption = 0, Type = Npc.NpcType.Vendor }; listNPCs.Add(cousinSlowhandsNpc); } } } else if (_use74A) { Npc npcA = DoSpawnRobot("74A", Npc.NpcType.Vendor); if (npcA != null) { listNPCs.Add(npcA); } } else if (_use110G) { Npc npcG = DoSpawnRobot("110G", Npc.NpcType.Vendor); if (npcG != null) { listNPCs.Add(npcG); } } else if (_useJeeves) { Npc npcJeeves = DoSpawnRobot("Jeeves", Npc.NpcType.Vendor); if (npcJeeves != null) { listNPCs.Add(npcJeeves); } } else { if (NpcDB.GetNpcNearby(Npc.NpcType.Vendor).Entry > 0) { listNPCs.Add(NpcDB.GetNpcNearby(Npc.NpcType.Vendor)); } } } #region Repairer, Seller/Buyer, MailBox if (listNPCs.Count > 0) { listNPCs.Sort(OnComparison); foreach (Npc npc in listNPCs) { Npc target = npc; bool doTravel = target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 400 || target.ContinentIdInt != Usefuls.ContinentId; if (!doTravel && target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) <= 400) { // Close NPC but no path ? bool success; PathFinder.FindPath(ObjectManager.ObjectManager.Me.Position, target.Position, Usefuls.ContinentNameMpq, out success); if (!success) { doTravel = true; } } //Start travel if (_travelLocation != null && _travelLocation.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 0.1f) { if (Products.Products.TravelRegenerated && Products.Products.TravelFrom.IsValid) { _travelLocation = Products.Products.TravelFrom; Products.Products.TravelRegenerated = false; } } if (doTravel && (_travelLocation == null || _travelLocation.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 0.1f) && !_travelDisabled && !Usefuls.IsFlying) { MovementManager.StopMove(); switch (npc.Type) { case Npc.NpcType.Repair: Logging.Write("Calling travel system to NpcRepair " + npc.Name + " (" + npc.Entry + ")..."); break; case Npc.NpcType.Vendor: Logging.Write("Calling travel system to NpcVendor " + npc.Name + " (" + npc.Entry + ")..."); break; case Npc.NpcType.Mailbox: Logging.Write("Calling travel system to Mailbox " + npc.Name + " (" + npc.Entry + ")..."); break; default: Logging.Write("Calling travel system for ToTown to " + npc.Name + " (" + npc.Entry + ")..."); break; } Products.Products.TravelToContinentId = target.ContinentIdInt; Products.Products.TravelTo = target.Position; Products.Products.TravelFromContinentId = Usefuls.ContinentId; Products.Products.TravelFrom = ObjectManager.ObjectManager.Me.Position; // Pass the check for valid destination as a lambda Products.Products.TargetValidationFct = Quest.IsNearQuestGiver; // compare me.Pos to dest.Pos _travelLocation = Products.Products.TravelFrom; return; } if (_travelLocation != null && _travelLocation.DistanceTo(ObjectManager.ObjectManager.Me.Position) <= 0.1f) { _travelDisabled = true; // don't forget to release travel once arrived. } //Start target finding based on Seller. uint baseAddress = MovementManager.FindTarget(ref target, 0, !ObjectManager.ObjectManager.Me.IsMounted); if (!target.ValidPath) { Logging.WriteDebug("No valid path/travel to Npc " + target.Name + ", removing him from NpcDB."); NpcDB.DelNpc(target); } if (MovementManager.InMovement) { return; } if (target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) >= 5f) { return; } _travelDisabled = false; if (baseAddress == 0 && target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 5f) { NpcDB.DelNpc(target); } else if (baseAddress > 0) { if (!_travelersTundraMammoth.HaveBuff) { DoProspectingInTown(target); DoMillingInTown(target); } Interact.InteractWith(baseAddress); Thread.Sleep(500); MovementManager.StopMove(); if (target.SelectGossipOption != 0) { Lua.LuaDoString("SelectGossipOption(" + target.SelectGossipOption + ")"); Thread.Sleep(500); } else if (target.Type == Npc.NpcType.Repair || target.Type == Npc.NpcType.Vendor) { if (!Gossip.SelectGossip(Gossip.GossipOption.Vendor)) { Logging.WriteError("Problem with NPC " + npc.Name + " Removing it for NpcDB"); NpcDB.DelNpc(npc); return; } } // NPC Repairer if (target.Type == Npc.NpcType.Repair) { Logging.Write("Repair items from " + target.Name + " (" + target.Entry + ")."); Vendor.RepairAllItems(); Thread.Sleep(1000); } // End NPC Repairer if (target.Type == Npc.NpcType.Vendor) { // NPC Buyer Logging.Write("Selling items to " + target.Name + " (" + target.Entry + ")."); List <WoWItemQuality> vQuality = new List <WoWItemQuality>(); if (nManagerSetting.CurrentSetting.SellGray) { vQuality.Add(WoWItemQuality.Poor); } if (nManagerSetting.CurrentSetting.SellWhite) { vQuality.Add(WoWItemQuality.Common); } if (nManagerSetting.CurrentSetting.SellGreen) { vQuality.Add(WoWItemQuality.Uncommon); } if (nManagerSetting.CurrentSetting.SellBlue) { vQuality.Add(WoWItemQuality.Rare); } if (nManagerSetting.CurrentSetting.SellPurple) { vQuality.Add(WoWItemQuality.Epic); } Vendor.SellItems(nManagerSetting.CurrentSetting.ForceToSellTheseItems, nManagerSetting.CurrentSetting.DontSellTheseItems, vQuality); Thread.Sleep(3000); if (Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SellItemsWhenLessThanXSlotLeft) { _suspendSelling = true; } // End NPC Buyer // NPC Seller if (NeedFoodSupplies() || NeedDrinkSupplies()) { Logging.Write("Buying beverages and food from " + target.Name + " (" + target.Entry + ")."); } for (int i = 0; i < 10 && NeedFoodSupplies(); i++) { Vendor.BuyItem(nManagerSetting.CurrentSetting.FoodName, 1); } for (int i = 0; i < 10 && NeedDrinkSupplies(); i++) { Vendor.BuyItem(nManagerSetting.CurrentSetting.BeverageName, 1); } // End NPC Seller } if (target.Type == Npc.NpcType.Repair || target.Type == Npc.NpcType.Vendor) { Gossip.CloseGossip(); } // MailBox if (target.Type == Npc.NpcType.Mailbox) { List <WoWItemQuality> mQuality = new List <WoWItemQuality>(); if (nManagerSetting.CurrentSetting.MailGray) { mQuality.Add(WoWItemQuality.Poor); } if (nManagerSetting.CurrentSetting.MailWhite) { mQuality.Add(WoWItemQuality.Common); } if (nManagerSetting.CurrentSetting.MailGreen) { mQuality.Add(WoWItemQuality.Uncommon); } if (nManagerSetting.CurrentSetting.MailBlue) { mQuality.Add(WoWItemQuality.Rare); } if (nManagerSetting.CurrentSetting.MailPurple) { mQuality.Add(WoWItemQuality.Epic); } bool mailSendingCompleted = false; for (int i = 7; i > 0 && !mailSendingCompleted; i--) { Interact.InteractWith(baseAddress); Thread.Sleep(1000); Mail.SendMessage(nManagerSetting.CurrentSetting.MaillingFeatureRecipient, nManagerSetting.CurrentSetting.MaillingFeatureSubject, "", nManagerSetting.CurrentSetting.ForceToMailTheseItems, nManagerSetting.CurrentSetting.DontMailTheseItems, mQuality, out mailSendingCompleted); Thread.Sleep(500); } if (mailSendingCompleted) { Logging.Write("Sending items to the player " + nManagerSetting.CurrentSetting.MaillingFeatureRecipient + " using " + target.Name + " (" + target.Entry + ")."); } if (Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SendMailWhenLessThanXSlotLeft) { _suspendMailing = true; } Lua.LuaDoString("CloseMail()"); } // End MailBox } // still on the road, but not in movement for some reasons } } #endregion Repairer, Seller/Buyer, MailBox }
public static void LaunchRadar() { int d; var myConn = new MySqlConnection("server=127.0.0.1; user id=tnb; password=tnb006; database=offydump;"); try { myConn.Open(); } catch (Exception e) { Logging.WriteError(e.ToString()); return; } // Various mount repair, portable mailbox, repair robots, Guild Page... var BlackListed = new List <int>(new[] { 77789, 32638, 32639, 32641, 32642, 35642, 191605, 24780, 29561, 49586, 49588, 62822, 211006 }); //Spell WildCharge = new Spell("Wild Charge"); while (true) { /*WoWUnit target = ObjectManager.Target; * if (target.IsValid) * { * Logging.Write("Distance to target (" + target.Name + ") : " + target.GetDistance); * Logging.Write("Target CombatReach : " + target.GetCombatReach); * Logging.Write("Target BoundingRadius : " + target.GetBoundingRadius); * Logging.Write("In Range ? " + CombatClass.InSpellRange(target, WildCharge.MinRangeHostile, WildCharge.MaxRangeHostile)); * }*/ Thread.Sleep(650 * 2); // Every 2 ObjectManager refresh // Prevent corruptions while the game loads after a zone change if (!Usefuls.InGame || Usefuls.IsLoading) { continue; } var npcRadar = new List <Npc>(); List <WoWGameObject> Mailboxes = ObjectManager.GetWoWGameObjectOfType(WoWGameObjectType.Mailbox); List <WoWUnit> Vendors = ObjectManager.GetWoWUnitVendor(); List <WoWUnit> Repairers = ObjectManager.GetWoWUnitRepair(); List <WoWUnit> Inkeepers = ObjectManager.GetWoWUnitInkeeper(); List <WoWUnit> Trainers = ObjectManager.GetWoWUnitTrainer(); List <WoWUnit> FlightMasters = ObjectManager.GetWoWUnitFlightMaster(); List <WoWUnit> Auctioneers = ObjectManager.GetWoWUnitAuctioneer(); List <WoWUnit> SpiritHealers = ObjectManager.GetWoWUnitSpiritHealer(); List <WoWUnit> SpiritGuides = ObjectManager.GetWoWUnitSpiritGuide(); List <WoWUnit> NpcMailboxes = ObjectManager.GetWoWUnitMailbox(); var npcRadarQuesters = new List <Npc>(); List <WoWUnit> NpcQuesters = ObjectManager.GetWoWUnitQuester(); List <WoWGameObject> ObjectQuesters = ObjectManager.GetWoWGameObjectOfType(WoWGameObjectType.Questgiver); List <WoWGameObject> Forges = ObjectManager.GetWoWGameObjectOfType(WoWGameObjectType.SpellFocus); List <WoWGameObject> AllGos = ObjectManager.GetObjectWoWGameObject(); foreach (WoWGameObject go in AllGos) { string query = ""; try { if (go.Entry != 0 && go.Name != "" && go.CreatedBy == 0) { query = "SELECT entry FROM gameobject WHERE entry = " + go.Entry + " AND " + "map = " + Usefuls.RealContinentId + " AND " + "SQRT((x-" + go.Position.X + ")*(x-" + go.Position.X + ") + " + "(y-" + go.Position.Y + ")*(y-" + go.Position.Y + ") + " + "(z-" + go.Position.Z + ")*(z-" + go.Position.Z + ")) < 0.5;"; var cmd = new MySqlCommand(query, myConn); MySqlDataReader result = cmd.ExecuteReader(); if (!result.HasRows && go.GOType != WoWGameObjectType.MoTransport && go.GOType != WoWGameObjectType.Transport) { result.Close(); Quaternion rotations = go.Rotations; Matrix4 matrice = go.WorldMatrix; query = "INSERT INTO gameobject (entry,map,x,y,z,o,r0,r1,r2,r3,m11,m12,m13,m14,m21,m22,m23,m24,m31,m32,m33,m34,m41,m42,m43,m44) VALUES (" + go.Entry + "," + Usefuls.RealContinentId + "," + go.Position.X + "," + go.Position.Y + "," + go.Position.Z + "," + go.Orientation + "," + rotations.X + "," + rotations.Y + "," + rotations.Z + "," + rotations.W + "," + matrice.xx + "," + matrice.xy + "," + matrice.xz + "," + matrice.xw + "," + matrice.yx + "," + matrice.yy + "," + matrice.yz + "," + matrice.yw + "," + matrice.zx + "," + matrice.zy + "," + matrice.zz + "," + matrice.zw + "," + matrice.wx + "," + matrice.wy + "," + matrice.wz + "," + matrice.ww + ");"; cmd = new MySqlCommand(query, myConn); cmd.ExecuteNonQuery(); } else { result.Close(); } //bool newAdded = false; query = "SELECT entry,questitem1 FROM gameobject_template WHERE entry = " + go.Entry + ";"; cmd = new MySqlCommand(query, myConn); result = cmd.ExecuteReader(); if (!result.HasRows) { result.Close(); query = "INSERT IGNORE INTO gameobject_template (entry,type,name,iconname,castbarcaption,model,faction,flags,size"; for (uint i = 0; i < 32; i++) { query += ",data" + i; } query += ",questitem1,questitem2,questitem3,questitem4) VALUES (" + go.Entry + "," + (uint)go.GOType + ",'" + go.Name.Replace("'", "\\'") + "','" + go.IconName.Replace("'", "\\'") + "','" + go.CastBarCaption.Replace("'", "\\'") + "'," + go.DisplayId + "," + go.Faction + "," + (uint)go.GOFlags + "," + go.Size; for (uint i = 0; i < 32; i++) { query += "," + go.Data(i); } query += "," + go.QuestItem1 + "," + go.QuestItem2 + "," + go.QuestItem3 + "," + go.QuestItem4; query += ");"; cmd = new MySqlCommand(query, myConn); cmd.ExecuteNonQuery(); //newAdded = true; } else { result.Read(); int questitem = result.GetInt32(1); result.Close(); if (questitem > 1000000 || questitem < 0) // 1065353216 { query = "UPDATE gameobject_template set size = " + go.Size + ", questitem1 = " + go.QuestItem1 + ", questitem2 = " + go.QuestItem2 + ", questitem3 = " + go.QuestItem3 + ", questitem4 = " + go.QuestItem4 + " WHERE entry =" + go.Entry + ";"; cmd = new MySqlCommand(query, myConn); cmd.ExecuteNonQuery(); } } /*if (!newAdded && go.IconName != "") * { * query = "UPDATE gameobject_template set iconname='" + go.IconName + "' WHERE entry =" + go.Entry + ";"; * cmd = new MySqlCommand(query, myConn); * cmd.ExecuteNonQuery(); * } * if (!newAdded && go.CastBarCaption != "") * { * query = "UPDATE gameobject_template set castbarcaption='" + go.CastBarCaption + "' WHERE entry =" + go.Entry + ";"; * cmd = new MySqlCommand(query, myConn); * cmd.ExecuteNonQuery(); * }*/ } } catch (Exception) { Logging.Write("This query has a problem ? " + query); } } foreach (WoWGameObject o in Mailboxes) { if (o.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = o.Entry, Faction = UnitRelation.GetObjectRacialFaction(o.Faction), Name = o.Name, Position = o.Position, Type = Npc.NpcType.Mailbox }); } foreach (WoWUnit n in Vendors) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Vendor }); } foreach (WoWUnit n in Repairers) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Repair }); } foreach (WoWUnit n in Inkeepers) { npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Innkeeper }); } foreach (WoWUnit n in Trainers) { Npc.NpcType newtype; if (n.SubName.Contains("Alchemy") || n.SubName.Contains("alchimistes")) { newtype = Npc.NpcType.AlchemyTrainer; } else if (n.SubName.Contains("Blacksmithing") || n.SubName.Contains("forgerons")) { newtype = Npc.NpcType.BlacksmithingTrainer; } else if (n.SubName.Contains("Enchanting") || n.SubName.Contains("enchanteurs")) { newtype = Npc.NpcType.EnchantingTrainer; } else if (n.SubName.Contains("Engineering") || n.SubName.Contains("ingénieurs")) { newtype = Npc.NpcType.EngineeringTrainer; } else if (n.SubName.Contains("Herbalism") || n.SubName.Contains("herboristes")) { newtype = Npc.NpcType.HerbalismTrainer; } else if (n.SubName.Contains("Inscription") || n.SubName.Contains("calligraphes")) { newtype = Npc.NpcType.InscriptionTrainer; } else if (n.SubName.Contains("Jewelcrafting") || n.SubName.Contains("joailliers")) { newtype = Npc.NpcType.JewelcraftingTrainer; } else if (n.SubName.Contains("Leatherworking") || n.SubName.Contains("travailleurs du cuir")) { newtype = Npc.NpcType.LeatherworkingTrainer; } else if (n.SubName.Contains("Mining") || n.SubName.Contains("mineurs")) { newtype = Npc.NpcType.MiningTrainer; } else if (n.SubName.Contains("Skinning") || n.SubName.Contains("dépeceurs")) { newtype = Npc.NpcType.SkinningTrainer; } else if (n.SubName.Contains("Tailoring") || n.SubName.Contains("tailleurs")) { newtype = Npc.NpcType.TailoringTrainer; } else if (n.SubName.Contains("Archaeology") || n.SubName.Contains("archéologues")) { newtype = Npc.NpcType.ArchaeologyTrainer; } else if (n.SubName.Contains("Cooking") || n.SubName.Contains("cuisiniers")) { newtype = Npc.NpcType.CookingTrainer; } else if (n.SubName.Contains("First Aid") || n.SubName.Contains("secouristes")) { newtype = Npc.NpcType.FirstAidTrainer; } else if (n.SubName.Contains("Fishing") || n.SubName.Contains("pêche")) { newtype = Npc.NpcType.FishingTrainer; } else if (n.SubName.Contains("Riding") || n.SubName.Contains(" de vol") || n.SubName.Contains(" de monte")) { newtype = Npc.NpcType.RidingTrainer; } else { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = newtype }); } foreach (WoWUnit n in SpiritHealers) { npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.SpiritHealer }); } foreach (WoWUnit n in SpiritGuides) { npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.SpiritGuide }); } foreach (WoWUnit n in NpcMailboxes) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Mailbox }); } foreach (WoWUnit n in Auctioneers) { npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.Auctioneer }); } foreach (WoWUnit n in NpcQuesters) { if (BlackListed.Contains(n.Entry) || n.CreatedBy != 0) { continue; } npcRadarQuesters.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = n.Entry, Faction = UnitRelation.GetObjectRacialFaction(n.Faction), Name = n.Name, Position = n.Position, Type = Npc.NpcType.QuestGiver }); } foreach (WoWGameObject o in ObjectQuesters) { if (o.CreatedBy != 0) { continue; } npcRadarQuesters.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = o.Entry, Faction = UnitRelation.GetObjectRacialFaction(o.Faction), Name = o.Name, Position = o.Position, Type = Npc.NpcType.QuestGiver }); } foreach (WoWGameObject o in Forges) { if (o.CreatedBy != 0) { continue; } Npc.NpcType newtype; switch (o.Data0) { case 3: newtype = Npc.NpcType.SmeltingForge; break; case 1552: newtype = Npc.NpcType.RuneForge; break; default: continue; } npcRadar.Add(new Npc { ContinentIdInt = Usefuls.ContinentId, Entry = o.Entry, Faction = UnitRelation.GetObjectRacialFaction(o.Faction), Name = o.Name, Position = o.Position, Type = newtype }); } d = NpcDB.AddNpcRange(npcRadar, true); if (d > 0) { Logging.Write("Found " + d + " new NPCs/Mailboxes in memory"); } d = AddQuesters(npcRadarQuesters, true); if (d == 1) { Logging.Write("Found " + d + " new Quest Giver in memory"); } else if (d > 1) { Logging.Write("Found " + d + " new Quest Givers in memory"); } } }
public override void Run() { Logging.Write("Pause started"); if (!_onBreak) { // That's the normal pausing system. Helpers.MovementManager.StopMove(); while (Products.Products.IsStarted && Products.Products.InAutoPause) { Thread.Sleep(300); } } else { // We are on break, will we just pause their in the middle of nowhere ? No we wont ! Point position = ObjectManager.ObjectManager.Me.Position; switch (Others.Random(1, 4)) { case 1: position.X += Others.Random(100, 300); break; case 2: position.X += Others.Random(-300, -100); break; case 3: position.Y += Others.Random(100, 300); break; case 4: position.Y += Others.Random(-300, -100); break; } if (MountTask.GetMountCapacity() == MountCapacity.Fly) { if (!ObjectManager.ObjectManager.Me.IsMounted) { MountTask.Mount(false, true); } // should be mounted here.. if (ObjectManager.ObjectManager.Me.IsMounted) { if (Usefuls.IsFlying) { position.Z += Others.Random(20, 50); } else { MountTask.Takeoff(); position.Z += Others.Random(50, 100); } MovementManager.MoveTo(position); } } else { // we are a f*****g non flyer dude, so let's suppose we are under level 60 (ofc), so, that mean our NPC DB actually cover our zone, so let's just stuck our ass to the closest NPC ever Npc target = new Npc(); target = NpcDB.GetNpcNearby(Npc.NpcType.Mailbox); if (target.Entry <= 0) { target = NpcDB.GetNpcNearby(Npc.NpcType.Repair); if (target.Entry <= 0) { target = NpcDB.GetNpcNearby(Npc.NpcType.Vendor); if (target.Entry <= 0) { target = NpcDB.GetNpcNearby(Npc.NpcType.FlightMaster); } } } if (target.Entry > 0) { //Start target finding based on Seller. uint baseAddress = MovementManager.FindTarget(ref target); if (MovementManager.InMovement) { return; } // I need to handle this f*****g possibility... if (baseAddress == 0 && target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 10) { NpcDB.DelNpc(target); // The NPC is not found, let's remove it from the DB, but still we must be in a safe place right now. } else if (baseAddress > 0) { // We arrived at our target (either mailbox or repair/vendor or flight master), let's wait here, we're safe. } } // We have no place to go... so just wait there. } while (!_breakTime.IsReady) { Thread.Sleep(300); } _forceResetTimer = true; // force recalculate the "time between pause" timer when our break is done } Logging.Write("Pause stoped"); }
internal static bool Pulse(bool autoLoaded = false) { try { if (!autoLoaded) { // Load Profile: LoadProfile f = new LoadProfile(); f.ShowDialog(); } if (!File.Exists(Application.StartupPath + "\\Profiles\\Gatherer\\" + GathererSetting.CurrentSetting.ProfileName)) { return(false); } Profile = XmlSerializer.Deserialize <GathererProfile>(Application.StartupPath + "\\Profiles\\Gatherer\\" + GathererSetting.CurrentSetting.ProfileName); if (Profile.Points.Count <= 0) { return(false); } // Reverse profil if (GathererSetting.CurrentSetting.PathingReverseDirection) { Profile.Points.Reverse(); } NpcDB.AddNpcRange(Profile.Npc); nManagerSetting.AddRangeBlackListZone(new List <nManagerSetting.BlackListZone>(Profile.BlackListRadius)); // Load CC: CombatClass.LoadCombatClass(); // FSM Fsm.States.Clear(); Fsm.AddState(new Pause { Priority = 200 }); Fsm.AddState(new Resurrect { Priority = 130 }); Fsm.AddState(new IsAttacked { Priority = 120 }); Fsm.AddState(new Regeneration { Priority = 110 }); Fsm.AddState(new ToTown { Priority = 100 }); Fsm.AddState(new Looting { Priority = 90 }); Fsm.AddState(new Travel { Priority = 80 }); Fsm.AddState(new SpecializationCheck { Priority = 70 }); Fsm.AddState(new LevelupCheck { Priority = 60 }); Fsm.AddState(new Trainers { Priority = 59 }); Fsm.AddState(new AutoItemCombiner { Priority = 52 }); Fsm.AddState(new MillingState { Priority = 51 }); Fsm.AddState(new ProspectingState { Priority = 50 }); Fsm.AddState(new Farming { Priority = 20 }); Fsm.AddState(new MovementLoop { Priority = 10, PathLoop = Profile.Points }); Fsm.AddState(new Idle { Priority = 0 }); foreach (var statePlugin in Plugins.ListLoadedStatePlugins) { Fsm.AddState(statePlugin); } Fsm.States.Sort(); Fsm.StartEngine(7, "FSM Gatherer"); return(true); } catch (Exception e) { try { Dispose(); } catch { } Logging.WriteError("Gatherer > Bot > Bot > Pulse(): " + e); return(false); } }
internal static bool Pulse() { try { Profile = new GrinderProfile(); LoadProfile f = new LoadProfile(); f.ShowDialog(); // If grinder School Load Profile if (!string.IsNullOrWhiteSpace(GrinderSetting.CurrentSetting.ProfileName) && File.Exists(Application.StartupPath + "\\Profiles\\Grinder\\" + GrinderSetting.CurrentSetting.ProfileName)) { Profile = XmlSerializer.Deserialize <GrinderProfile>(Application.StartupPath + "\\Profiles\\Grinder\\" + GrinderSetting.CurrentSetting.ProfileName); if (Profile.GrinderZones.Count <= 0) { return(false); } } else { MessageBox.Show(Translate.Get(Translate.Id.Please_select_an_profile)); return(false); } SelectZone(); // Black List: foreach (GrinderZone zone in Profile.GrinderZones) { nManagerSetting.AddRangeBlackListZone(new List <nManagerSetting.BlackListZone>(zone.BlackListRadius)); } // Add Npc foreach (GrinderZone zone in Profile.GrinderZones) { NpcDB.AddNpcRange(zone.Npc); } // Load CC: CombatClass.LoadCombatClass(); // FSM Fsm.States.Clear(); Fsm.AddState(new Pause { Priority = 200 }); Fsm.AddState(new SelectProfileState { Priority = 150 }); Fsm.AddState(new Resurrect { Priority = 140 }); Fsm.AddState(new IsAttacked { Priority = 130 }); Fsm.AddState(new Regeneration { Priority = 120 }); Fsm.AddState(new ToTown { Priority = 110 }); Fsm.AddState(new Looting { Priority = 100 }); Fsm.AddState(new Travel { Priority = 90 }); Fsm.AddState(new SpecializationCheck { Priority = 80 }); Fsm.AddState(new LevelupCheck { Priority = 70 }); Fsm.AddState(new Trainers { Priority = 60 }); Fsm.AddState(new AutoItemCombiner { Priority = 52 }); Fsm.AddState(new MillingState { Priority = 51 }); Fsm.AddState(new ProspectingState { Priority = 50 }); Fsm.AddState(Grinding); Fsm.AddState(new Farming { Priority = 20 }); Fsm.AddState(MovementLoop); Fsm.AddState(new Idle { Priority = 0 }); foreach (var statePlugin in Plugins.ListLoadedStatePlugins) { Fsm.AddState(statePlugin); } Fsm.States.Sort(); Fsm.StartEngine(7, "FSM Grinder"); return(true); } catch (Exception e) { try { Dispose(); } catch { } Logging.WriteError("Grinder > Bot > Bot > Pulse(): " + e); return(false); } }
public override void Run() { if (_listOfTeachers.Count <= 0) { return; } Npc bestTeacher = new Npc(); for (int i = 0; i < _listOfTeachers.Count; i++) { Npc teacher = _listOfTeachers[i]; if (bestTeacher.Entry > 0) { // priority checks first switch (Products.Products.ProductName) { case "Gatherer": if (bestTeacher.Type == Npc.NpcType.MiningTrainer && teacher.Type != Npc.NpcType.RidingTrainer) { continue; } if (bestTeacher.Type == Npc.NpcType.HerbalismTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.MiningTrainer) { continue; } if (bestTeacher.Type == Npc.NpcType.SkinningTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.MiningTrainer && teacher.Type != Npc.NpcType.HerbalismTrainer) { continue; } if (teacher.Type == Npc.NpcType.RidingTrainer) { bestTeacher = teacher; } else if (teacher.Type == Npc.NpcType.MiningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer) { bestTeacher = teacher; } else if (teacher.Type == Npc.NpcType.HerbalismTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.MiningTrainer) { bestTeacher = teacher; } else if (teacher.Type == Npc.NpcType.SkinningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.MiningTrainer && bestTeacher.Type != Npc.NpcType.HerbalismTrainer) { bestTeacher = teacher; } break; case "Quester": case "Grinder": if (bestTeacher.Type == Npc.NpcType.SkinningTrainer && teacher.Type != Npc.NpcType.RidingTrainer) { continue; } if (bestTeacher.Type == Npc.NpcType.MiningTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.SkinningTrainer) { continue; } if (bestTeacher.Type == Npc.NpcType.HerbalismTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.SkinningTrainer && teacher.Type != Npc.NpcType.MiningTrainer) { continue; } if (teacher.Type == Npc.NpcType.RidingTrainer) { bestTeacher = teacher; } else if (teacher.Type == Npc.NpcType.SkinningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer) { bestTeacher = teacher; } else if (teacher.Type == Npc.NpcType.MiningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.SkinningTrainer) { bestTeacher = teacher; } else if (teacher.Type == Npc.NpcType.HerbalismTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.SkinningTrainer && bestTeacher.Type != Npc.NpcType.MiningTrainer) { bestTeacher = teacher; } break; } if (bestTeacher == teacher) { continue; // We just set a best from priority checks, so distance check is not important anymore } if (ObjectManager.ObjectManager.Me.Position.DistanceTo(teacher.Position) < ObjectManager.ObjectManager.Me.Position.DistanceTo(bestTeacher.Position)) { bestTeacher = teacher; // We do not have priority between teacher and the actual bestTeacher, so we use distance instead } } else { bestTeacher = teacher; } } if (bestTeacher.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 800) { if (Quest.TravelToQuestZone(bestTeacher.Position, ref _doTravel, bestTeacher.ContinentIdInt, false, bestTeacher.Type.ToString())) { return; } } uint baseAddress = MovementManager.FindTarget(ref bestTeacher); if (MovementManager.InMovement) { return; } if (baseAddress == 0 && bestTeacher.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 10) { NpcDB.DelNpc(bestTeacher); } else if (baseAddress > 0) { if (bestTeacher.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 5f) { return; } string[] skillInfo = bestTeacher.InternalData.Split(','); if (skillInfo.Length == 2) { SkillLine skillLine = (SkillLine)Others.ToInt32(skillInfo[0]); SkillRank skillRank = (SkillRank)Others.ToInt32(skillInfo[1]); SkillRank nextRank; if (skillRank == SkillRank.ZenMaster) { nextRank = skillRank + 100; } else { nextRank = skillRank + 75; } string oldRank = ""; if (skillRank != SkillRank.None) { oldRank = " We were only " + skillRank.ToString() + " of " + skillLine.ToString() + "."; } Logging.Write("We have just reached the Teacher of " + skillLine.ToString() + ", " + bestTeacher.Name + ". We are now going to learn " + nextRank.ToString() + " of " + skillLine.ToString() + "." + oldRank); } Interact.InteractWith(baseAddress); Thread.Sleep(500 + Usefuls.Latency); Quest.CompleteQuest(); Gossip.TrainAllAvailableSpells(); TeacherFoundNoSpam.Remove(bestTeacher); SpellManager.UpdateSpellBook(); _doTravel = true; } // still on the road, but not in movement for some reasons }