protected override void OnRender(DrawingContext drawingContext) { base.OnRender(drawingContext); var bc = new BrushConverter(); ActorItem user = XIVInfoViewModel.Instance.CurrentUser; if (user == null) { return; } var origin = new Coordinate { X = (float)(this.ActualWidth / 2), Y = (float)(this.ActualHeight / 2), }; var scale = (float)(this.ActualHeight / 2.0f) / 125.0f; var angle = Math.Abs(user.Heading * (180 / Math.PI) - 180); var drawingGroup = new DrawingGroup(); if (Settings.Default.RadarCompassMode) { drawingGroup.Transform = new RotateTransform { Angle = angle, CenterX = origin.X, CenterY = origin.Y, }; } drawingGroup.Children.Add(new ImageDrawing(Game.RadarHeading, new Rect(origin.X - 64, origin.Y - 128, 128, 128))); drawingGroup.Children.Add(new ImageDrawing(Game.Player, new Rect(origin.X - 8, origin.Y - 16, 16, 21))); this.DrawDrawing(drawingContext, drawingGroup); var sb = new StringBuilder(); List <ActorItem> npcEntites = new List <ActorItem>(XIVInfoViewModel.Instance.CurrentNPCs.Select(kvp => kvp.Value).ToList()); List <ActorItem> monsterEntites = new List <ActorItem>(XIVInfoViewModel.Instance.CurrentMonsters.Select(kvp => kvp.Value).ToList()); List <ActorItem> pcEntites = new List <ActorItem>(XIVInfoViewModel.Instance.CurrentPCs.Select(kvp => kvp.Value).ToList()); if (Settings.Default.FilterRadarItems) { List <RadarFilterItem> npcFilters = PluginViewModel.Instance.Filters.Where(filter => filter.Type != "PC" && filter.Type != "Monster").ToList(); if (npcFilters.Any()) { npcEntites = RadarFilterHelper.ResolveFilteredEntities(npcFilters, npcEntites); } List <RadarFilterItem> monsterFilters = PluginViewModel.Instance.Filters.Where(filter => filter.Type == "Monster").ToList(); if (PluginViewModel.Instance.RankedFilters.Any()) { monsterFilters.AddRange(PluginViewModel.Instance.RankedFilters); } if (monsterFilters.Any()) { monsterEntites = RadarFilterHelper.ResolveFilteredEntities(monsterFilters, monsterEntites); } List <RadarFilterItem> pcFilters = PluginViewModel.Instance.Filters.Where(filter => filter.Type == "PC").ToList(); if (pcFilters.Any()) { pcEntites = RadarFilterHelper.ResolveFilteredEntities(pcFilters, pcEntites); } monsterEntites = RadarFilterHelper.CleanupEntities(monsterEntites); } #region Resolve PCs if (Settings.Default.PCShow) { foreach (ActorItem actorEntity in pcEntites) { sb.Clear(); var fontSizeModifier = 0; drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { Coordinate coord = user.Coordinate.Subtract(actorEntity.Coordinate).Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate).Rotate2D(user.Heading).Scale(scale).Add(origin); } screen = screen.Add(-8, -8, 0); if (Settings.Default.PCShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.PCShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.PCShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), this.ResolveHeightVariance(user, actorEntity)); } var useJob = Settings.Default.PCShowJob; if (Settings.Default.PCShowJob) { #region Get Job Icons switch (actorEntity.Job) { case Actor.Job.Unknown: if (actorEntity.OwnerID > 0 && actorEntity.OwnerID < 3758096384) { this.DrawImage(drawingContext, Game.Chocobo, new Rect(new Point(), new Size(16, 16))); } useJob = false; break; default: this.DrawImage(drawingContext, Game.GetIconByName(actorEntity.Job.ToString()), new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; } #endregion } if (!useJob) { BitmapImage imageSource = actorEntity.HPCurrent > 0 ? Game.Player : Game.Unknown; this.DrawImage(drawingContext, imageSource, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } this.RenderDebugInformation(actorEntity, ref sb); if (Settings.Default.PCShowName || Settings.Default.PCShowHPPercent) { var text = new FormattedText(sb.ToString(), this._cultureInfo, this._flowDirection, this._typeface, int.Parse(Settings.Default.PCFontSize) + fontSizeModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.PCFontColor)); this.DrawText(drawingContext, text, screen.X + 20, screen.Y); } } catch (Exception ex) { Logging.Log(Logger, new LogItem(ex, true)); } drawingContext.Pop(); } } #endregion #region Resolve Monsters if (Settings.Default.MonsterShow) { foreach (ActorItem actorEntity in monsterEntites) { sb.Clear(); var fontSizeModifier = 0; var fontColor = Settings.Default.MonsterFontColor; List <string> RankB = LocaleHelper.GetRankedMonsters("B"); List <string> RankA = LocaleHelper.GetRankedMonsters("A"); List <string> RankS = LocaleHelper.GetRankedMonsters("S"); var isRanked = false; if (Settings.Default.MonsterShowRankColor) { if (RankA.Any(x => x.Equals(actorEntity.Name, StringComparison.InvariantCultureIgnoreCase))) { fontColor = Settings.Default.MonsterFontColorARank; fontSizeModifier += 2; isRanked = true; } else if (RankS.Any(x => x.Equals(actorEntity.Name, StringComparison.InvariantCultureIgnoreCase))) { fontColor = Settings.Default.MonsterFontColorSRank; fontSizeModifier += 2; isRanked = true; } else if (RankB.Any(x => x.Equals(actorEntity.Name, StringComparison.InvariantCultureIgnoreCase))) { fontColor = Settings.Default.MonsterFontColorBRank; fontSizeModifier += 2; isRanked = true; } } drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { Coordinate coord = user.Coordinate.Subtract(actorEntity.Coordinate).Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate).Rotate2D(user.Heading).Scale(scale).Add(origin); } screen = screen.Add(-8, -8, 0); BitmapImage actorIcon; if (actorEntity.IsFate) { actorIcon = Game.MobFate; } else { switch (actorEntity.DifficultyRank) { case 6: actorIcon = actorEntity.IsAggressive ? Game.MobAggressive5 : Game.MobPassive5; break; case 4: actorIcon = actorEntity.IsAggressive ? Game.MobAggressive3 : Game.MobPassive3; break; case 3: actorIcon = actorEntity.IsAggressive ? Game.MobAggressive2 : Game.MobPassive2; break; case 2: actorIcon = actorEntity.IsAggressive ? Game.MobAggressive6 : Game.MobPassive6; break; case 1: actorIcon = actorEntity.IsAggressive ? Game.MobAggressive4 : Game.MobPassive4; break; default: actorIcon = actorEntity.IsAggressive ? Game.MobAggressive1 : Game.MobPassive1; break; } if (actorEntity.OwnerID > 0 && actorEntity.OwnerID < 3758096384) { actorIcon = Game.Chocobo; } } var iconSize = new Size(16, 16); var point = new Point(screen.X, screen.Y); if (isRanked) { iconSize = new Size(24, 24); point = new Point(screen.X - 4, screen.Y - 4); } if (actorEntity.HPCurrent > 0) { if (actorIcon != null) { this.DrawImage(drawingContext, actorIcon, new Rect(point, iconSize)); } } else { this.DrawImage(drawingContext, Game.Unknown, new Rect(point, iconSize)); } if (Settings.Default.MonsterShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.MonsterShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.MonsterShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), this.ResolveHeightVariance(user, actorEntity)); } this.RenderDebugInformation(actorEntity, ref sb); if (Settings.Default.MonsterShowName || Settings.Default.MonsterShowHPPercent) { var text = new FormattedText(sb.ToString(), this._cultureInfo, this._flowDirection, this._typeface, int.Parse(Settings.Default.MonsterFontSize) + fontSizeModifier, (SolidColorBrush)bc.ConvertFromString(fontColor)); this.DrawText(drawingContext, text, screen.X + 20, screen.Y); } } catch (Exception ex) { Logging.Log(Logger, new LogItem(ex, true)); } drawingContext.Pop(); } } #endregion #region Resolve NPCs, Gathering & Other foreach (ActorItem actorEntity in npcEntites) { sb.Clear(); var fontSizeModifier = 0; drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { Coordinate coord = user.Coordinate.Subtract(actorEntity.Coordinate).Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate).Rotate2D(user.Heading).Scale(scale).Add(origin); } screen = screen.Add(-8, -8, 0); BitmapImage actorIcon; switch (actorEntity.Type) { case Actor.Type.NPC: #region Resolve NPCs if (Settings.Default.NPCShow) { try { if (Settings.Default.NPCShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.NPCShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.NPCShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), this.ResolveHeightVariance(user, actorEntity)); } actorIcon = actorEntity.HPCurrent > 0 ? Game.Vendor : Game.Unknown; this.DrawImage(drawingContext, actorIcon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); this.RenderDebugInformation(actorEntity, ref sb); if (Settings.Default.NPCShowName || Settings.Default.NPCShowHPPercent) { var text = new FormattedText(sb.ToString(), this._cultureInfo, this._flowDirection, this._typeface, int.Parse(Settings.Default.NPCFontSize) + fontSizeModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.NPCFontColor)); this.DrawText(drawingContext, text, screen.X + 20, screen.Y); } } catch (Exception ex) { Logging.Log(Logger, new LogItem(ex, true)); } drawingContext.Pop(); } #endregion break; case Actor.Type.Gathering: #region Resolve Gathering if (Settings.Default.GatheringShow && actorEntity.GatheringInvisible == 0) { try { if (Settings.Default.GatheringShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.GatheringShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.GatheringShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), this.ResolveHeightVariance(user, actorEntity)); } actorIcon = Game.Gathering; if (Constants.GatheringNodes.TryGetValue(user.Job.ToString(), out List <GatheringNode> node)) { GatheringNode nodeMatch = node.FirstOrDefault(n => n.Localization.Matches(actorEntity.Name)); if (nodeMatch != null) { switch (user.Job) { case Actor.Job.BTN: actorIcon = Game.Harvesting; switch (nodeMatch.Rarity) { case GatheringRarity.Unspoiled: case GatheringRarity.Ephemeral: case GatheringRarity.Legendary: actorIcon = Game.HarvestingSuper; break; } break; case Actor.Job.FSH: actorIcon = Game.Fishing; break; case Actor.Job.MIN: actorIcon = Game.Mining; switch (nodeMatch.Rarity) { case GatheringRarity.Unspoiled: case GatheringRarity.Ephemeral: case GatheringRarity.Legendary: actorIcon = Game.MiningSuper; break; } break; } } } this.DrawImage(drawingContext, actorIcon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); this.RenderDebugInformation(actorEntity, ref sb); if (Settings.Default.GatheringShowName || Settings.Default.GatheringShowHPPercent) { var text = new FormattedText(sb.ToString(), this._cultureInfo, this._flowDirection, this._typeface, int.Parse(Settings.Default.GatheringFontSize) + fontSizeModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.GatheringFontColor)); this.DrawText(drawingContext, text, screen.X + 20, screen.Y); } } catch (Exception ex) { Logging.Log(Logger, new LogItem(ex, true)); } drawingContext.Pop(); } #endregion break; default: #region Resolve Other if (Settings.Default.OtherShow) { try { switch (actorEntity.Type) { case Actor.Type.Aetheryte: actorIcon = Game.Aetheryte; break; case Actor.Type.Minion: actorIcon = Game.Avatar; break; default: actorIcon = Game.Vendor; break; } if (actorEntity.HPCurrent > 0 || actorEntity.Type == Actor.Type.Aetheryte) { if (actorIcon != null) { this.DrawImage(drawingContext, actorIcon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } } else { this.DrawImage(drawingContext, Game.Unknown, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } if (Settings.Default.OtherShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.OtherShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.OtherShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), this.ResolveHeightVariance(user, actorEntity)); } this.RenderDebugInformation(actorEntity, ref sb); if (Settings.Default.OtherShowName || Settings.Default.OtherShowHPPercent) { var text = new FormattedText(sb.ToString(), this._cultureInfo, this._flowDirection, this._typeface, int.Parse(Settings.Default.OtherFontSize) + fontSizeModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.OtherFontColor)); this.DrawText(drawingContext, text, screen.X + 20, screen.Y); } } catch (Exception ex) { Logging.Log(Logger, new LogItem(ex, true)); } drawingContext.Pop(); } #endregion break; } } catch (Exception ex) { } } #endregion }
protected override void OnRender(DrawingContext drawingContext) { base.OnRender(drawingContext); var bc = new BrushConverter(); var user = XIVInfoViewModel.Instance.CurrentUser; if (user == null) { return; } var origin = new Coordinate { X = (float)(ActualWidth / 2), Y = (float)(ActualHeight / 2) }; var scale = ((float)(ActualHeight / 2.0f) / 125.0f); var angle = Math.Abs(user.Heading * (180 / Math.PI) - 180); if (Settings.Default.RadarCompassMode) { var drawingGroup = new DrawingGroup { Transform = new RotateTransform { Angle = angle, CenterX = origin.X, CenterY = origin.Y } }; drawingGroup.Children.Add(new ImageDrawing(RadarIconHelper.RadarHeading, new Rect(origin.X - 64, origin.Y - 128, 128, 128))); drawingContext.DrawDrawing(drawingGroup); } else { drawingContext.DrawImage(RadarIconHelper.RadarHeading, new Rect(new Point(origin.X - 64, origin.Y - 128), new Size(128, 128))); } var sb = new StringBuilder(); var npcEntites = new List <ActorEntity>(XIVInfoViewModel.Instance.CurrentNPCs.Select(kvp => kvp.Value) .ToList()); var monsterEntites = new List <ActorEntity>(XIVInfoViewModel.Instance.CurrentMonsters.Select(kvp => kvp.Value) .ToList()); var pcEntites = new List <ActorEntity>(XIVInfoViewModel.Instance.CurrentPCs.Select(kvp => kvp.Value) .ToList()); if (Settings.Default.FilterRadarItems) { var npcFilters = PluginViewModel.Instance.Filters.Where(filter => filter.Type != Actor.Type.PC && filter.Type != Actor.Type.Monster) .ToList(); if (npcFilters.Any()) { npcEntites = RadarFilterHelper.ResolveFilteredEntities(npcFilters, npcEntites); } var monsterFilters = PluginViewModel.Instance.Filters.Where(filter => filter.Type == Actor.Type.Monster) .ToList(); if (PluginViewModel.Instance.RankedFilters.Any()) { monsterFilters.AddRange(PluginViewModel.Instance.RankedFilters); } if (monsterFilters.Any()) { monsterEntites = RadarFilterHelper.ResolveFilteredEntities(monsterFilters, monsterEntites); } var pcFilters = PluginViewModel.Instance.Filters.Where(filter => filter.Type == Actor.Type.PC) .ToList(); if (pcFilters.Any()) { pcEntites = RadarFilterHelper.ResolveFilteredEntities(pcFilters, pcEntites); } } #region Resolve PCs if (Settings.Default.PCShow) { foreach (var actorEntity in pcEntites) { sb.Clear(); var fsModifier = 0; drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { var coord = user.Coordinate.Subtract(actorEntity.Coordinate) .Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate) .Rotate2D(user.Heading) .Scale(scale) .Add(origin); } screen = screen.Add(-8, -8, 0); if (Settings.Default.PCShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.PCShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.PCShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), ResolveHeightVariance(user, actorEntity)); } var useJob = Settings.Default.PCShowJob; if (Settings.Default.PCShowJob) { #region Get Job Icons switch (actorEntity.Job) { case Actor.Job.ACN: drawingContext.DrawImage(RadarIconHelper.Arcanist, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.ALC: drawingContext.DrawImage(RadarIconHelper.Alchemist, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.ARC: drawingContext.DrawImage(RadarIconHelper.Archer, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.ARM: drawingContext.DrawImage(RadarIconHelper.Armorer, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.AST: drawingContext.DrawImage(RadarIconHelper.Astrologian, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.BLM: drawingContext.DrawImage(RadarIconHelper.Blackmage, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.BRD: drawingContext.DrawImage(RadarIconHelper.Bard, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.BSM: drawingContext.DrawImage(RadarIconHelper.Blacksmith, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.BTN: drawingContext.DrawImage(RadarIconHelper.Botanist, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.CNJ: drawingContext.DrawImage(RadarIconHelper.Conjurer, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.CPT: drawingContext.DrawImage(RadarIconHelper.Carpenter, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.CUL: drawingContext.DrawImage(RadarIconHelper.Culinarian, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.DRG: drawingContext.DrawImage(RadarIconHelper.Dragoon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.DRK: drawingContext.DrawImage(RadarIconHelper.DarkKnight, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.FSH: drawingContext.DrawImage(RadarIconHelper.Fisher, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.GLD: drawingContext.DrawImage(RadarIconHelper.Gladiator, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.GSM: drawingContext.DrawImage(RadarIconHelper.Goldsmith, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.LNC: drawingContext.DrawImage(RadarIconHelper.Leatherworker, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.LTW: drawingContext.DrawImage(RadarIconHelper.Leatherworker, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.MCH: drawingContext.DrawImage(RadarIconHelper.Machinist, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.MIN: drawingContext.DrawImage(RadarIconHelper.Miner, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.MNK: drawingContext.DrawImage(RadarIconHelper.Monk, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.MRD: drawingContext.DrawImage(RadarIconHelper.Marauder, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.NIN: drawingContext.DrawImage(RadarIconHelper.Ninja, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.PGL: drawingContext.DrawImage(RadarIconHelper.Pugilist, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.PLD: drawingContext.DrawImage(RadarIconHelper.Paladin, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.ROG: drawingContext.DrawImage(RadarIconHelper.Rogue, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.SCH: drawingContext.DrawImage(RadarIconHelper.Scholar, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.Unknown: if (actorEntity.OwnerID > 0 && actorEntity.OwnerID < 3758096384) { drawingContext.DrawImage(RadarIconHelper.Chocobo, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } useJob = false; break; case Actor.Job.WAR: drawingContext.DrawImage(RadarIconHelper.Warrior, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.WHM: drawingContext.DrawImage(RadarIconHelper.Whitemage, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; case Actor.Job.WVR: drawingContext.DrawImage(RadarIconHelper.Weaver, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); break; } #endregion } if (!useJob) { var imageSource = actorEntity.HPCurrent > 0 ? RadarIconHelper.Player : RadarIconHelper.Skull; drawingContext.DrawImage(imageSource, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } if (Settings.Default.PCShowName || Settings.Default.PCShowHPPercent) { var label = new FormattedText(sb.ToString(), _cultureInfo, _flowDirection, _typeface, Int32.Parse(Settings.Default.PCFontSize) + fsModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.PCFontColor)); drawingContext.DrawText(label, new Point(screen.X + 20, screen.Y)); } } catch (Exception ex) { Logging.Log(Logger, ex.Message); } drawingContext.Pop(); } } #endregion #region Resolve Monsters if (Settings.Default.MonsterShow) { foreach (var actorEntity in monsterEntites) { sb.Clear(); var fsModifier = 0; var fontColor = Settings.Default.MonsterFontColor; var RankB = LocaleHelper.GetRankedMonsters("B"); var RankA = LocaleHelper.GetRankedMonsters("A"); var RankS = LocaleHelper.GetRankedMonsters("S"); if (Settings.Default.MonsterShowRankColor) { if (RankA.Any(x => x.Equals(actorEntity.Name, StringComparison.InvariantCultureIgnoreCase))) { fontColor = Settings.Default.MonsterFontColorARank; fsModifier += 2; } else if (RankS.Any(x => x.Equals(actorEntity.Name, StringComparison.InvariantCultureIgnoreCase))) { fontColor = Settings.Default.MonsterFontColorSRank; fsModifier += 2; } else if (RankB.Any(x => x.Equals(actorEntity.Name, StringComparison.InvariantCultureIgnoreCase))) { fontColor = Settings.Default.MonsterFontColorBRank; fsModifier += 2; } } drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { var coord = user.Coordinate.Subtract(actorEntity.Coordinate) .Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate) .Rotate2D(user.Heading) .Scale(scale) .Add(origin); } screen = screen.Add(-8, -8, 0); ImageSource actorIcon = null; switch (actorEntity.IsFate) { case true: actorIcon = RadarIconHelper.Fate; break; case false: if (actorEntity.OwnerID > 0 && actorEntity.OwnerID < 3758096384) { actorIcon = RadarIconHelper.ChocoboPersonal; } else { actorIcon = actorEntity.IsClaimed ? RadarIconHelper.MonsterClaimed : RadarIconHelper.Monster; } break; } if (actorEntity.HPCurrent > 0) { if (actorIcon != null) { drawingContext.DrawImage(actorIcon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } } else { drawingContext.DrawImage(RadarIconHelper.Skull, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } if (Settings.Default.MonsterShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.MonsterShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.MonsterShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), ResolveHeightVariance(user, actorEntity)); } if (Settings.Default.MonsterShowName || Settings.Default.MonsterShowHPPercent) { var label = new FormattedText(sb.ToString(), _cultureInfo, _flowDirection, _typeface, Int32.Parse(Settings.Default.MonsterFontSize) + fsModifier, (SolidColorBrush)bc.ConvertFromString(fontColor)); drawingContext.DrawText(label, new Point(screen.X + 20, screen.Y)); } } catch (Exception ex) { Logging.Log(Logger, ex.Message); } drawingContext.Pop(); } } #endregion #region Resolve NPCs, Gathering & Other foreach (var actorEntity in npcEntites) { switch (actorEntity.Type) { case Actor.Type.NPC: #region Resolve NPCs if (Settings.Default.NPCShow) { sb.Clear(); var fsModifier = 0; drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { var coord = user.Coordinate.Subtract(actorEntity.Coordinate) .Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate) .Rotate2D(user.Heading) .Scale(scale) .Add(origin); } screen = screen.Add(-8, -8, 0); if (Settings.Default.NPCShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.NPCShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.NPCShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), ResolveHeightVariance(user, actorEntity)); } var actorIcon = RadarIconHelper.NPC; if (actorEntity.HPCurrent > 0) { drawingContext.DrawImage(actorIcon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } else { drawingContext.DrawImage(RadarIconHelper.Skull, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } if (Settings.Default.NPCShowName || Settings.Default.NPCShowHPPercent) { var label = new FormattedText(sb.ToString(), _cultureInfo, _flowDirection, _typeface, Int32.Parse(Settings.Default.NPCFontSize) + fsModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.NPCFontColor)); drawingContext.DrawText(label, new Point(screen.X + 20, screen.Y)); } } catch (Exception ex) { Logging.Log(Logger, ex.Message); } drawingContext.Pop(); } #endregion break; case Actor.Type.Gathering: #region Resolve Gathering if (Settings.Default.GatheringShow) { sb.Clear(); var fsModifier = 0; drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { var coord = user.Coordinate.Subtract(actorEntity.Coordinate) .Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate) .Rotate2D(user.Heading) .Scale(scale) .Add(origin); } screen = screen.Add(-8, -8, 0); if (Settings.Default.GatheringShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.GatheringShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.GatheringShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), ResolveHeightVariance(user, actorEntity)); } var actorIcon = RadarIconHelper.Wood; if (actorEntity.HPCurrent > 0) { drawingContext.DrawImage(actorIcon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } else { drawingContext.DrawImage(RadarIconHelper.Skull, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } if (Settings.Default.GatheringShowName || Settings.Default.GatheringShowHPPercent) { var label = new FormattedText(sb.ToString(), _cultureInfo, _flowDirection, _typeface, Int32.Parse(Settings.Default.GatheringFontSize) + fsModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.GatheringFontColor)); drawingContext.DrawText(label, new Point(screen.X + 20, screen.Y)); } } catch (Exception ex) { Logging.Log(Logger, ex.Message); } drawingContext.Pop(); } #endregion break; default: #region Resolve Other if (Settings.Default.OtherShow) { sb.Clear(); var fsModifier = 0; drawingContext.PushOpacity(1); try { if (!actorEntity.IsValid || user == null) { continue; } if (actorEntity.ID == user.ID) { continue; } Coordinate screen; if (Settings.Default.RadarCompassMode) { var coord = user.Coordinate.Subtract(actorEntity.Coordinate) .Scale(scale); screen = new Coordinate(-coord.X, 0, -coord.Y).Add(origin); } else { screen = user.Coordinate.Subtract(actorEntity.Coordinate) .Rotate2D(user.Heading) .Scale(scale); } screen = screen.Add(-8, -8, 0); ImageSource actorIcon; switch (actorEntity.Type) { case Actor.Type.Aetheryte: actorIcon = RadarIconHelper.Crystal; break; case Actor.Type.Minion: actorIcon = RadarIconHelper.Sheep; break; default: actorIcon = RadarIconHelper.NPC; break; } if (actorEntity.HPCurrent > 0 || actorEntity.Type == Actor.Type.Aetheryte) { if (actorIcon != null) { drawingContext.DrawImage(actorIcon, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } } else { drawingContext.DrawImage(RadarIconHelper.Skull, new Rect(new Point(screen.X, screen.Y), new Size(16, 16))); } if (Settings.Default.OtherShowName) { sb.Append(actorEntity.Name); } if (Settings.Default.OtherShowHPPercent) { sb.AppendFormat(" {0:P0}", actorEntity.HPPercent); } if (Settings.Default.OtherShowDistance) { sb.AppendFormat(" {0:N2} {1}", user.GetDistanceTo(actorEntity), ResolveHeightVariance(user, actorEntity)); } if (Settings.Default.OtherShowName || Settings.Default.OtherShowHPPercent) { var label = new FormattedText(sb.ToString(), _cultureInfo, _flowDirection, _typeface, Int32.Parse(Settings.Default.OtherFontSize) + fsModifier, (SolidColorBrush)bc.ConvertFromString(Settings.Default.OtherFontColor)); drawingContext.DrawText(label, new Point(screen.X + 20, screen.Y)); } } catch (Exception ex) { Logging.Log(Logger, ex.Message); } drawingContext.Pop(); } #endregion break; } } #endregion }