private async Task <bool> CreateGrindArea() { if (NeoProfileManager.CurrentGrindArea == null) { if (Delay > 0) { // start time irregularity, sleep for a second for the fatedata to populate await Coroutine.Sleep(1000); await WaitDelay(); } Log($"Creating GrindArea for {ThisFate.Name}."); GetBoss(); hotSpots.Add(new HotSpot(ThisFate.Location, ThisFate.Radius)); FateGrindArea = new GrindArea() { Hotspots = hotSpots.ToList(), TargetMobs = GameObjectManager.GetObjectsOfType <BattleCharacter>(true, false).Where(obj => obj.FateId == ThisFate.Id).Select(r => (int)r.NpcId).Distinct().Select(x => new TargetMob() { Id = x }).ToList(), Name = ThisFate.Name.ToString() }; if (ThisFate.Icon == FateIconType.Boss && HiddenBossFates.Contains(ThisFate.Id)) { Log("Fate contains a hidden Boss. Adding NpcId {1} as a TargetMob.", ThisFate.Name, BossId); FateGrindArea.TargetMobs.Add(new TargetMob() { Id = BossId, Weight = 1 }); } NeoProfileManager.CurrentGrindArea = FateGrindArea; // Debug foreach (var mob in FateGrindArea.TargetMobs) { Log("Added NpcId {0} with Weight {1} to the GrindArea.", mob.Id, mob.Weight); } NeoProfileManager.CurrentProfile.KillRadius = 80f; NeoProfileManager.UpdateGrindArea(); } return(false); }
public void Init(System.EventArgs args) { if (StyxSettings.Instance.EnabledPlugins.Contains(Name)) { Logging.Write("BookCollector Initializing"); grindArea = ProfileManager.CurrentProfile.GrindArea; HotspotList = grindArea.Hotspots.ConvertAll <WoWPoint>(hs => hs.ToWoWPoint()); HotspotIndex = 0; CurrentHotspot = grindArea.CurrentHotSpot; } }
private void CreateGrindArea() { if (Hotspots.Count == 0) { Hotspots.Add(new HotSpot(XYZ, Radius)); Hotspots.IsCyclic = false; Hotspots.Index = 0; } var grindArea = new GrindArea() { TargetMobs = NpcIds.Select(r => new TargetMob() { Id = r }).ToList(), Hotspots = Hotspots.ToList(), Name = QuestName }; NeoProfileManager.CurrentGrindArea = grindArea; NeoProfileManager.UpdateGrindArea(); }
private void button1_Click(object sender, EventArgs e) { string NpcName = textBox1.Text.Trim(); var results = Program.MappyHelper.GetNpcsByName(NpcName); var spell = (AozAction)comboBox1.SelectedItem; //richTextBox2.Text += $"{spell.Action.Name} - {spell.Action.Key}\n"; richTextBox1.Text = ""; richTextBox2.Text = ""; richTextBox2.Text += $"Count: {results.Count()}\n"; List <HotSpot> hotspots = new List <HotSpot>(); var first = Program.MappyHelper.GetNpcByName(NpcName); richTextBox2.Text += $"Filtered Count: {results.Count(i => i.MapTerritoryID == first.MapTerritoryID && i.Location.Distance2D(first.Location) > 75)}"; foreach (var result in results.Where(i => i.MapTerritoryID == first.MapTerritoryID && i.Location.Distance2D(first.Location) > 75)) { richTextBox1.Text += $"{result.Name} {result.MapTerritoryID} {result.GetCords()}\n"; richTextBox1.Text += $"{result.TerritoryType.As<Aetheryte>("Aetheryte").PlaceName.Name} "; richTextBox1.Text += $"{result.TerritoryType.As<Aetheryte>("Aetheryte").IsAetheryte} "; richTextBox1.Text += $"{result.TerritoryType.As<Aetheryte>("Aetheryte").Key}\n"; hotspots.Add(new HotSpot(result.Name.Replace(' ', '_'), result.Location, 50)); } TargetMob target = new TargetMob(); target.Id = SaintCHelper.GetNpcIdByName(first.Name); GrindArea grindArea = new GrindArea(); grindArea.Name = first.Name.Replace(' ', '_'); grindArea.Hotspots = hotspots; grindArea.MinLevel = 60; grindArea.MaxLevel = 80; grindArea.TargetMobs = new List <TargetMob> { target }; Profile profile = new Profile(); profile.Name = spell.Action.Name; profile.Order = " "; profile.GrindAreas = new List <GrindArea> { grindArea }; profile.KillRadius = 50; int spellId = spell.Action.Key; XmlSerializer serializer = new XmlSerializer(typeof(Profile)); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", ""); string filename = @"G:\test.xml"; TextWriter writer = new StreamWriter(filename); serializer.Serialize(writer, profile, ns); writer.Close(); var doc = new XmlDocument(); doc.Load(filename); var root = doc.GetElementsByTagName("Profile")[0]; root.Normalize(); var node1 = doc.GetElementsByTagName("Order")[0]; // doc. //XmlNode myNode = doc.CreateNode(XmlNodeType.Element, "If"); XmlNode myNode = doc.CreateElement("If"); var attr1 = doc.CreateAttribute("condition"); attr1.Value = "Core.Me.CurrentJob == ClassJobType.BlueMage"; myNode.Attributes.Append(attr1); //myNode.Normalize(); var newNode = node1.AppendChild(myNode); XmlNode myNode2 = doc.CreateElement("If"); var attr2 = doc.CreateAttribute("condition"); attr2.Value = $"not ActionManager.HasSpell({spellId})"; myNode2.Attributes.Append(attr2); myNode2.Normalize(); var newNode1 = newNode.AppendChild(myNode2); XmlNode myNode3 = doc.CreateElement("If"); var attr3 = doc.CreateAttribute("condition"); attr3.Value = $"not IsOnMap({first.MapTerritoryID})"; myNode3.Attributes.Append(attr3); myNode3.Normalize(); var newNode2 = newNode1.AppendChild(myNode3); XmlNode myNode4 = doc.CreateElement("TeleportTo"); var attr4 = doc.CreateAttribute("name"); attr4.Value = $"{first.TerritoryType.As<Aetheryte>("Aetheryte").PlaceName.Name}"; var attr5 = doc.CreateAttribute("aetheryteId"); attr5.Value = $"{first.TerritoryType.As<Aetheryte>("Aetheryte").Key}"; var attr6 = doc.CreateAttribute("force"); attr6.Value = $"true"; myNode4.Attributes.Append(attr4); myNode4.Attributes.Append(attr5); myNode4.Attributes.Append(attr6); myNode4.Normalize(); var newNode3 = newNode2.AppendChild(myNode4); XmlNode myNode5 = doc.CreateElement("Grind"); var attr7 = doc.CreateAttribute("grindRef"); attr7.Value = $"{first.Name.Replace(' ', '_')}"; var attr8 = doc.CreateAttribute("postCombatDelay"); attr8.Value = $"1"; var attr9 = doc.CreateAttribute("while"); attr9.Value = $"not ActionManager.HasSpell({spellId})"; myNode5.Attributes.Append(attr7); myNode5.Attributes.Append(attr8); myNode5.Attributes.Append(attr9); myNode5.Normalize(); var newNode4 = newNode1.AppendChild(myNode5); doc.Save($@"g:\{spell.Action.Name}.xml"); // myNode.AppendChild(); /* if (result != null) * { * richTextBox1.Text = $"{result.Name} {result.MapTerritoryID} {result.GetCords()}\n"; * richTextBox1.Text += $"{result.TerritoryType.As<Aetheryte>("Aetheryte").PlaceName.Name}\n"; * richTextBox1.Text += $"{result.TerritoryType.As<Aetheryte>("Aetheryte").IsAetheryte}\n"; * richTextBox1.Text += $"{result.TerritoryType.As<Aetheryte>("Aetheryte").Key}\n"; * }*/ //richTextBox1.Text += result; }
public void Init(System.EventArgs args) { if (StyxSettings.Instance.EnabledPlugins.Contains(Name)) { Logging.Write("BookCollector Initializing"); grindArea = ProfileManager.CurrentProfile.GrindArea; HotspotList = grindArea.Hotspots.ConvertAll<WoWPoint>(hs => hs.ToWoWPoint()); HotspotIndex = 0; CurrentHotspot = grindArea.CurrentHotSpot; } }
private void OnDrawing(Device device) { try { OverlaySettings settings = OverlaySettings.Instance; if (settings.OnlyDrawInForeground && Imports.GetForegroundWindow() != StyxWoW.Memory.Process.MainWindowHandle) { return; } if (!StyxWoW.IsInGame) { DrawHelper.DrawShadowedText("Not in game!", settings.GameStatsPositionX, settings.GameStatsPositionY, settings.GameStatsForegroundColor, settings.GameStatsShadowColor, settings.GameStatsFontSize ); return; } if (!TreeRoot.IsRunning) { ObjectManager.Update(); } WoWPoint mypos = StyxWoW.Me.Location; Vector3 vecStart = new Vector3(mypos.X, mypos.Y, mypos.Z); int myLevel = StyxWoW.Me.Level; if (settings.DrawGameStats) { StringBuilder sb = new StringBuilder(); WoWUnit currentTarget = StyxWoW.Me.CurrentTarget; if (currentTarget != null) { sb.AppendLine("Current Target: " + currentTarget.Name + ", Distance: " + Math.Round(currentTarget.Distance, 3)); WoWPoint end = currentTarget.Location; Vector3 vecEnd = new Vector3(end.X, end.Y, end.Z); DrawHelper.DrawLine(vecStart, vecEnd, 2f, Color.FromArgb(150, Color.Black)); } sb.AppendLine("My Position: " + StyxWoW.Me.Location); sb.AppendLine(""); sb.AppendLine(string.Format(Globalization.XP_HR___0_, GameStats.XPPerHour.ToString("F0"))); sb.AppendLine(string.Format(Globalization.Kills___0____1__hr_, GameStats.MobsKilled, GameStats.MobsPerHour.ToString("F0"))); sb.AppendLine(string.Format(Globalization.Deaths___0____1__hr_, GameStats.Deaths, GameStats.DeathsPerHour.ToString("F0"))); sb.AppendLine(string.Format(Globalization.Loots___0____1__hr_, GameStats.Loots, GameStats.LootsPerHour.ToString("F0"))); if (BotManager.Current is BGBuddy) { sb.AppendLine(string.Format("Honor Gained: {0} ({1}/hr)", GameStats.HonorGained, GameStats.HonorPerHour.ToString("F0"))); sb.AppendLine(string.Format("BGs Won: {0} Lost: {1} Total: {2} ({3}/hr)", GameStats.BGsWon, GameStats.BGsLost, GameStats.BGsCompleted, GameStats.BGsPerHour.ToString("F0"))); } if (myLevel < 90) { sb.AppendLine(string.Format("Time to Level: {0}", GameStats.TimeToLevel)); } sb.AppendLine(string.Format("TPS: {0}", GameStats.TicksPerSecond.ToString("F2"))); sb.AppendLine(); if (!string.IsNullOrEmpty(TreeRoot.GoalText)) { sb.AppendLine(string.Format(Globalization.Goal___0_, TreeRoot.GoalText)); } if (settings.UseShadowedText) { DrawHelper.DrawShadowedText(sb.ToString(), settings.GameStatsPositionX, settings.GameStatsPositionY, settings.GameStatsForegroundColor, settings.GameStatsShadowColor, settings.GameStatsFontSize ); } else { DrawHelper.DrawText(sb.ToString(), settings.GameStatsPositionX, settings.GameStatsPositionY, settings.GameStatsForegroundColor, settings.GameStatsFontSize ); } } if (settings.DrawHostilityBoxes || settings.DrawUnitLines || settings.DrawGameObjectBoxes || settings.DrawGameObjectLines) { foreach (WoWObject obj in ObjectManager.GetObjectsOfType <WoWObject>(true)) { string name = obj.Name; WoWPoint objLoc = obj.Location; Vector3 vecCenter = new Vector3(objLoc.X, objLoc.Y, objLoc.Z); WoWGameObject gobject = obj as WoWGameObject; if (gobject != null) { Color color = Color.FromArgb(150, Color.Blue); if (gobject.IsMineral) { color = Color.FromArgb(150, Color.DarkGray); } if (gobject.IsHerb) { color = Color.FromArgb(150, Color.Fuchsia); } if (settings.DrawGameObjectNames) { DrawHelper.Draw3DText(name, vecCenter); } if (settings.DrawGameObjectBoxes) { DrawHelper.DrawOutlinedBox(vecCenter, 2.0f, 2.0f, 2.0f, Color.FromArgb(150, color) ); } if (settings.DrawGameObjectLines) { bool inLos = gobject.InLineOfSight; if (settings.DrawGameObjectLinesLos && inLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, Color.FromArgb(150, color)); } else { if (!settings.DrawGameObjectLinesLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, Color.FromArgb(150, color)); } } } } WoWPlayer player = obj as WoWPlayer; if (player != null) { if (OverlaySettings.Instance.DrawPlayerNames) { DrawHelper.Draw3DText(name, vecCenter); } } WoWUnit u = obj as WoWUnit; if (u != null) { Color hostilityColor = Color.FromArgb(150, Color.Green); if (u.IsHostile) { hostilityColor = Color.FromArgb(150, Color.Red); if (settings.DrawAggroRangeCircles) { DrawHelper.DrawCircle(vecCenter, u.MyAggroRange, 16, Color.FromArgb(75, Color.DeepSkyBlue)); } } if (u.IsNeutral) { hostilityColor = Color.FromArgb(150, Color.Yellow); } if (u.IsFriendly) { hostilityColor = Color.FromArgb(150, Color.Green); } if (settings.DrawHostilityBoxes) { float boundingHeight = u.BoundingHeight; float boundingRadius = u.BoundingRadius; DrawHelper.DrawOutlinedBox(vecCenter, boundingRadius, boundingRadius, boundingHeight, hostilityColor ); //DrawHelper.DrawSphere(vecCenter, 1f, 5, 5, hostilityColor); } if (OverlaySettings.Instance.DrawUnitNames) { DrawHelper.Draw3DText(name, vecCenter); } if (settings.DrawUnitLines) { vecCenter.Z += u.BoundingHeight / 2; bool inLos = u.InLineOfSight; if (settings.DrawUnitLinesLos && inLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, hostilityColor); } else { if (!settings.DrawUnitLinesLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, hostilityColor); } } } } } } if (settings.DrawCurrentPath) { MeshNavigator navigator = Navigator.NavigationProvider as MeshNavigator; if (navigator != null && navigator.CurrentMovePath != null) { Tripper.Tools.Math.Vector3[] points = navigator.CurrentMovePath.Path.Points; for (int i = 0; i < points.Length; i++) { Vector3 vecEnd = new Vector3(points[i].X, points[i].Y, points[i].Z); if (i - 1 >= 0) { Tripper.Tools.Math.Vector3 prevPoint = points[i - 1]; Vector3 vecPreviousPoint = new Vector3(prevPoint.X, prevPoint.Y, prevPoint.Z); DrawHelper.DrawLine(vecPreviousPoint, vecEnd, 2f, Color.FromArgb(150, Color.Black)); } DrawHelper.DrawBox(vecEnd, 1.0f, 1.0f, 1.0f, Color.FromArgb(150, Color.BlueViolet)); } } } if (settings.DrawBgMapboxes && BGBuddy.Instance != null) { Battleground curBg = BGBuddy.Instance.Battlegrounds.FirstOrDefault(bg => bg.MapId == StyxWoW.Me.MapId); if (curBg != null) { BgBotProfile curBgProfile = curBg.Profile; if (curBgProfile != null) { foreach (var box in curBgProfile.Boxes[curBg.Side]) { float width = box.BottomRight.X - box.TopLeft.X; float height = box.BottomRight.Z - box.TopLeft.Z; var c = box.Center; Vector3 vecCenter = new Vector3(c.X, c.Y, c.Z); DrawHelper.DrawOutlinedBox(vecCenter, width, width, height, Color.FromArgb(150, Color.Gold)); } foreach (Blackspot bs in curBgProfile.Blackspots) { var p = bs.Location; Vector3 vec = new Vector3(p.X, p.Y, p.X); DrawHelper.DrawCircle(vec, bs.Radius, 32, Color.FromArgb(200, Color.Black)); if (!string.IsNullOrWhiteSpace(bs.Name)) { DrawHelper.Draw3DText("Blackspot: " + bs.Name, vec); } else { DrawHelper.Draw3DText("Blackspot", vec); } } } } } Profile curProfile = ProfileManager.CurrentProfile; if (curProfile != null) { if (settings.DrawHotspots) { GrindArea ga = QuestState.Instance.CurrentGrindArea; if (ga != null) { if (ga.Hotspots != null) { foreach (Hotspot hs in ga.Hotspots) { var p = hs.Position; Vector3 vec = new Vector3(p.X, p.Y, p.Z); DrawHelper.DrawCircle(vec, 10.0f, 32, Color.FromArgb(200, Color.Red)); if (!string.IsNullOrWhiteSpace(hs.Name)) { DrawHelper.Draw3DText("Hotspot: " + hs.Name, vec); } else { DrawHelper.Draw3DText("Hotspot", vec); } } } } // This is only used by grind profiles. if (curProfile.HotspotManager != null) { foreach (WoWPoint p in curProfile.HotspotManager.Hotspots) { Vector3 vec = new Vector3(p.X, p.Y, p.Z); DrawHelper.DrawCircle(vec, 10.0f, 32, Color.FromArgb(200, Color.Red)); DrawHelper.Draw3DText("Hotspot", vec); } } } if (settings.DrawBlackspots) { if (curProfile.Blackspots != null) { foreach (Blackspot bs in curProfile.Blackspots) { var p = bs.Location; Vector3 vec = new Vector3(p.X, p.Y, p.Z); DrawHelper.DrawCircle(vec, bs.Radius, 32, Color.FromArgb(200, Color.Black)); if (!string.IsNullOrWhiteSpace(bs.Name)) { DrawHelper.Draw3DText("Blackspot: " + bs.Name, vec); } else { DrawHelper.Draw3DText("Blackspot: " + vec, vec); } } } } } if (settings.DrawDbAvoidObjects) { foreach (var avoid in AvoidanceManager.Avoids) { var c = avoid.Location; var center = new Vector3(c.X, c.Y, c.Z); DrawHelper.DrawCircle(center, avoid.Radius, 32, Color.FromArgb(200, Color.LightBlue)); center.Z += 1.0f; DrawHelper.Draw3DText("Db Avoid Object", center); } } } catch (Exception) { } }