Example #1
0
        protected TextureFile GetDefaultTexture(int textureID, bool hexName = false)
        {
            TextureFile defaultTexture = new TextureFile();

            defaultTexture.ID = textureID;

            if (!hexName)
            {
                defaultTexture.Name = String.Format("{0} - Missing texture", textureID);
            }
            else
            {
                defaultTexture.Name = String.Format("0x{0:X} - Missing texture", textureID);
            }

            defaultTexture.Image = _DefaultBitmap;

            return(defaultTexture);
        }
Example #2
0
        protected virtual TextureFile EnhancedTexture_Getter(int textureID)
        {
            try
            {
                if (Globals.Instance.EnhancedAssets != null)
                {
                    byte[] data = Globals.Instance.EnhancedAssets.GetTexture(textureID);

                    if (data != null)
                    {
                        string name = String.Format("0x{0:X}", textureID);

                        if (Globals.Instance.Clilocs != null)
                        {
                            int    cliloc     = UltimaItemGenerator.GetClilocFromItemID(textureID);
                            string clilocText = Globals.Instance.Clilocs.GetString(cliloc);

                            if (!String.IsNullOrEmpty(clilocText))
                            {
                                name = String.Format("{0} - {1}", name, clilocText);
                            }
                        }

                        TextureFile texture = new TextureFile();
                        texture.ID    = textureID;
                        texture.Name  = name;
                        texture.Data  = data;
                        texture.Image = DDS.FromMemory(data).GetTextureAsBitmapSource();

                        return(texture);
                    }
                }
            }
            catch (Exception ex)
            {
                App.Window.ShowNotification(NotificationType.Error, ex);
            }

            return(GetDefaultTexture(textureID, true));
        }
Example #3
0
        protected override TextureFile EnhancedTexture_Getter(int bodyID)
        {
            try
            {
                if (Globals.Instance.EnhancedAssets != null)
                {
                    byte[] data = null;
                    int    move = 0;

                    while (data == null && move < 99)
                    {
                        data = Globals.Instance.EnhancedAssets.GetAnimation(bodyID, move++, 6);
                    }

                    string name = Globals.Instance.EnhancedAssets.GetAnimationName(bodyID);

                    if (data != null)
                    {
                        UltimaAnimation animation = UltimaAnimation.FromMemory(data);

                        if (animation.Frames != null && animation.Frames.Count > 0)
                        {
                            TextureFile file = new TextureFile();
                            file.ID    = bodyID;
                            file.Image = animation.GetImageAsBitmapSource();
                            file.Name  = name;

                            return(file);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                App.Window.ShowNotification(NotificationType.Error, ex);
            }

            return(GetDefaultTexture(bodyID));
        }
Example #4
0
        protected virtual TextureFile LegacyTexture_Getter( int textureID )
        {
            try
            {
                if ( Globals.Instance.LegacyAssets != null )
                {
                    byte[] data = Globals.Instance.LegacyAssets.GetTexture( textureID );

                    if ( data != null )
                    {
                        string name = String.Format( "0x{0:X}", textureID );

                        if ( Globals.Instance.Clilocs != null )
                        {
                            int cliloc = UltimaItemGenerator.GetClilocFromItemID( textureID );
                            string clilocText = Globals.Instance.Clilocs.GetString( cliloc );

                            if ( !String.IsNullOrEmpty( clilocText ) )
                                name = String.Format( "{0} - {1}", name, clilocText );
                        }

                        TextureFile texture = new TextureFile();
                        texture.ID = textureID;
                        texture.Name = name;
                        texture.Image = UltimaLegacyArt.FromMemory( data, false ).GetImageAsBitmapSource();

                        return texture;
                    }
                }
            }
            catch ( Exception ex )
            {
                App.Window.ShowNotification( NotificationType.Error, ex );
            }

            return GetDefaultTexture( textureID, true );
        }
Example #5
0
        protected TextureFile GetDefaultTexture( int textureID, bool hexName = false )
        {
            TextureFile defaultTexture = new TextureFile();
            defaultTexture.ID = textureID;

            if ( !hexName )
                defaultTexture.Name = String.Format( "{0} - Missing texture", textureID );
            else
                defaultTexture.Name = String.Format( "0x{0:X} - Missing texture", textureID );

            defaultTexture.Image = _DefaultBitmap;

            return defaultTexture;
        }
Example #6
0
        protected override TextureFile LegacyTexture_Getter( int bodyID )
        {
            try
            {
                if ( Globals.Instance.LegacyAssets != null )
                {
                    byte[] data = null;
                    int move = 0;

                    while ( data == null && move < 99 )
                        data = Globals.Instance.LegacyAssets.GetAnimation( bodyID, move++, 6 );

                    if ( data != null )
                    {
                        UltimaAnimation animation = UltimaAnimation.FromMemory( data, true );

                        if ( animation.Frames != null && animation.Frames.Count > 0 )
                        {
                            TextureFile file = new TextureFile();
                            file.ID = bodyID;
                            file.Image = animation.GetImageAsBitmapSource();
                            file.Name = String.Format( "{0}", bodyID );

                            return file;
                        }
                    }
                }
            }
            catch ( Exception ex )
            {
                App.Window.ShowNotification( NotificationType.Error, ex );
            }

            return GetDefaultTexture( bodyID );
        }