SphereCommunity
[UPDATED]Paperdoll & Web - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Submissions (/Forum-Script-Submissions)
+--- Thread: [UPDATED]Paperdoll & Web (/Thread-UPDATED-Paperdoll-Web)

Pages: 1 2 3 4 5 6 7 8


RE: [UPDATED]Paperdoll & Web - evening - 06-05-2014 01:21 PM

Yes
The database system is too strong
I like this style
I think I will try to learn it


RE: [UPDATED]Paperdoll & Web - Avatar - 06-07-2014 01:29 AM

Keep on working, you will certainly get what you want Wink


RE: [UPDATED]Paperdoll & Web - evening - 06-07-2014 01:14 PM

Thank you


RE: [UPDATED]Paperdoll & Web - admin phoenix - 06-10-2014 06:39 PM

I think it will be very easy to do this one if we have ingame a command which will show us the link from art to gump.
At the moment you have to find it out with a lot of work arounds and def names.
don´t know if it is hardcoded in the client?


RE: [UPDATED]Paperdoll & Web - horadryn - 06-15-2014 09:14 PM

Can someone translate this?

Code:
using System;
using System.Collections;

namespace Server.Engines.MyRunUO
{
    public class LayerComparer : IComparer
    {
        private static Layer PlateArms = (Layer)255;
        private static Layer ChainTunic = (Layer)254;
        private static Layer LeatherShorts = (Layer)253;

        private static Layer[] m_DesiredLayerOrder = new Layer[]
        {
            Layer.Cloak,
            Layer.Bracelet,
            Layer.Ring,
            Layer.Shirt,
            Layer.Pants,
            Layer.InnerLegs,
            Layer.Shoes,
            LeatherShorts,
            Layer.Arms,
            Layer.InnerTorso,
            LeatherShorts,
            PlateArms,
            Layer.MiddleTorso,
            Layer.OuterLegs,
            Layer.Neck,
            Layer.Waist,
            Layer.Gloves,
            Layer.OuterTorso,
            Layer.OneHanded,
            Layer.TwoHanded,
            Layer.FacialHair,
            Layer.Hair,
            Layer.Helm,
            Layer.Talisman
        };

        private static int[] m_TranslationTable;

        public static int[] TranslationTable
        {
            get{ return m_TranslationTable; }
        }

        static LayerComparer()
        {
            m_TranslationTable = new int[256];

            for ( int i = 0; i < m_DesiredLayerOrder.Length; ++i )
                m_TranslationTable[(int)m_DesiredLayerOrder[i]] = m_DesiredLayerOrder.Length - i;
        }

        public static bool IsValid( Item item )
        {
            return ( m_TranslationTable[(int)item.Layer] > 0 );
        }

        public static readonly IComparer Instance = new LayerComparer();

        public LayerComparer()
        {
        }

        public Layer Fix( int itemID, Layer oldLayer )
        {
            if ( itemID == 0x1410 || itemID == 0x1417 ) // platemail arms
                return PlateArms;

            if ( itemID == 0x13BF || itemID == 0x13C4 ) // chainmail tunic
                return ChainTunic;

            if ( itemID == 0x1C08 || itemID == 0x1C09 ) // leather skirt
                return LeatherShorts;

            if ( itemID == 0x1C00 || itemID == 0x1C01 ) // leather shorts
                return LeatherShorts;

            return oldLayer;
        }

        public int Compare( object x, object y )
        {
            Item a = (Item)x;
            Item b = (Item)y;

            Layer aLayer = a.Layer;
            Layer bLayer = b.Layer;

            aLayer = Fix( a.ItemID, aLayer );
            bLayer = Fix( b.ItemID, bLayer );

            return m_TranslationTable[(int)bLayer] - m_TranslationTable[(int)aLayer];
        }
    }
}



RE: [UPDATED]Paperdoll & Web - Feeh - 06-16-2014 03:24 AM

(06-15-2014 09:14 PM)horadryn Wrote:  Can someone translate this?

Code:
using System;
using System.Collections;
...

That's a layer comparer as the class name says.
RunUO does use it to place in order every gump piece of your paperdoll.
There is no easy translation to that, depends on what context you will be using, and may even be better to create a new way to compare depending on what you will use it.
I've played with RunUO for a long time and I can say its code is made to fit their specific needs, it can tell you what is needed to do something, but will not tell you how to do it
So, if you're playing with Sphere scripts, this class will take a totally different form than C#, the same for PHP, C++, etc...

(06-10-2014 06:39 PM)admin phoenix Wrote:  I think it will be very easy to do this one if we have ingame a command which will show us the link from art to gump.
At the moment you have to find it out with a lot of work arounds and def names.
don´t know if it is hardcoded in the client?
I never saw anything inside the client files that link an item art with gump art.
UO client always had (at least for me) a fame to be badly coded with lots of workarounds. UO community have a incredible vast amount of knowledge around UO classic client that if there were something like that the community would already have found it, unless EA made it well hidden Tongue
Even UltimaXNA and other custom clients does use a very same method to draw the gump in order


RE: [UPDATED]Paperdoll & Web - horadryn - 06-16-2014 03:43 AM

I think this is the part that establishes the hierarchy of the layers ... To avoid seeing the pants over the armor ...

although, looking deeply, I think this is the right part

Code:
public void InsertItems( Mobile mob )
        {
            ArrayList items = m_Items;
            items.AddRange( mob.Items );
            string serial = mob.Serial.Value.ToString();

            items.Sort( LayerComparer.Instance );

            int index = 0;

            bool hidePants = false;
            bool alive = mob.Alive;
            bool hideHair = !alive;

            for ( int i = 0; i < items.Count; ++i )
            {
                Item item = (Item)items[i];

                if ( !LayerComparer.IsValid( item ) )
                    break;

                if ( !alive && item.ItemID != 8270 )
                    continue;

                if ( item.ItemID == 0x1411 || item.ItemID == 0x141A ) // plate legs
                    hidePants = true;
                else if ( hidePants && item.Layer == Layer.Pants )
                    continue;

                if ( !hideHair && item.Layer == Layer.Helm )
                    hideHair = true;

                InsertItem( serial, index++, item.ItemID, item.Hue );
            }

            if ( mob.FacialHairItemID != 0 && alive )
                InsertItem( serial, index++, mob.FacialHairItemID, mob.FacialHairHue );

            if ( mob.HairItemID != 0 && !hideHair )
                InsertItem( serial, index++, mob.HairItemID, mob.HairHue );

            items.Clear();
        }



RE: [UPDATED]Paperdoll & Web - Extreme - 06-16-2014 07:19 AM

This code is used to set the order of the layers to be shown at paperdoll.

What you want is needed to properly show the gumps at website.
Yes, I have it done and I am sure Coruja too.

I can't share it right now because I'm not home.. Maybe wednesday, I'm not sure.

For the phoenix question, of course there is a way to get the gumps, how do you think they will show at website??
You can find it on paperdoll php file.


RE: [UPDATED]Paperdoll & Web - horadryn - 06-16-2014 08:31 PM

i love you!

A kiss, all for you

[Image: gene-simmons.jpg?w=300&amp;h=225]


RE: [UPDATED]Paperdoll & Web - admin phoenix - 06-17-2014 06:36 AM

@extreme
I mean ingame.
On the Homepage I already got it in the past with php Smile