Пример #1
0
        public IEnumerable <MapOverlay> GetCustomOverlay()
        {
            MapOverlay overlay = new MapOverlay();

            foreach (PmvNetCharacterInfo character in this.characters.Values.ToArray())
            {
                var texture = new MapTexture()
                {
                    Texture           = API.Content.Textures.CharacterLocator,
                    KeyColor          = this.locatorColor,
                    Position          = new PositionDefinition(character.Zone, character.X, character.Z),
                    PositionAlignment = MapItemAlignment.Center,
                };

                var txt = new MapText
                {
                    Position          = new PositionDefinition(),
                    PositionAlignment = MapItemAlignment.Center,
                    Text         = character.Name,
                    TextColor    = texture.KeyColor,
                    OutlineColor = Color.Black,
                    Outline      = true,
                    Font         = API.Content.Fonts.GetFont(this.CharacterLocatorFont)
                };

                var mpt = new MapTextureText(texture, txt, 1)
                {
                    PositionAlignment = MapItemAlignment.Bottom | MapItemAlignment.Center,
                };

                overlay.MapItems.Add(mpt);
            }
            yield return(overlay);

            yield break;
        }
Пример #2
0
        private IMapItem[] GetCharacterLocators()
        {
            var mapTextureTexts = new List <IMapItem>();

            if (API.State.PlayerInfo.Count == 0)
            {
                return(new MapTexture[0]);
            }

            var characters = API.State.PlayerInfo.Values.ToArray();

            IMapItem activeTex = null;

            foreach (var character in characters)
            {
                var  activeCharacter = API.AoHook.GetActiveCharacter();
                bool isActive        = character.Identity == activeCharacter;
                if (character == null || character.Zone == null || character.Position == null || character.Name == null)
                {
                    continue;
                }
                if (!character.IsHooked && !this.DrawOfflineCharacters)
                {
                    // We ain't tracking offline characters.
                    continue;
                }

                var charColor = Color.Yellow;
                if (this.HighlightActiveCharacter && !isActive)
                {
                    charColor = new Color(255, 255, 156);
                }

                var texture = new MapTexture()
                {
                    Texture           = API.Content.Textures.CharacterLocator,
                    KeyColor          = charColor,
                    Position          = new PositionDefinition(character.Zone.ID, character.Position.X, character.Position.Z),
                    PositionAlignment = MapItemAlignment.Center,
                };

                if (!character.IsHooked)
                {
                    texture.KeyColor = Color.Gray;
                }

                var charRealPos = texture.Position.GetPosition();

                var txt = new MapText
                {
                    Position          = new PositionDefinition(),
                    PositionAlignment = MapItemAlignment.Center,
                    Text         = character.Name,
                    TextColor    = charColor,
                    OutlineColor = Color.Black,
                    Outline      = true,
                    Font         = API.Content.Fonts.GetFont(this.CharacterLocatorFont)
                };

                if (this.DrawCharacterDimension)
                {
                    txt.Text += " (" + character.Dimension.ToString().Substring(0, 1) + ")";
                }

                if (!character.IsHooked)
                {
                    txt.TextColor    = Color.LightGray;
                    txt.OutlineColor = Color.Gray;
                }
                var mpt = new MapTextureText(texture, txt, 1)
                {
                    PositionAlignment = MapItemAlignment.Bottom | MapItemAlignment.Center,
                };

                if (!isActive)
                {
                    mapTextureTexts.Add(mpt);
                }
                else
                {
                    activeTex = mpt;
                }
            }

            if (activeTex != null)
            {
                mapTextureTexts.Add(activeTex);
            }
            return(mapTextureTexts.ToArray());
        }