Exemplo n.º 1
0
        private AppearanceInstance ReadCreatureOutfit(Internal.ByteArray message, AppearanceInstance instance = null)
        {
            int outfitID;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameOutfitIDU16))
            {
                outfitID = message.ReadUnsignedShort();
            }
            else
            {
                outfitID = message.ReadUnsignedByte();
            }

            if (outfitID != 0)
            {
                int headColor   = message.ReadUnsignedByte();
                int torsoColor  = message.ReadUnsignedByte();
                int legsColor   = message.ReadUnsignedByte();
                int detailColor = message.ReadUnsignedByte();

                int addonsFlags = 0;
                if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GamePlayerAddons))
                {
                    addonsFlags = message.ReadUnsignedByte();
                }

                OutfitInstance outfitInstance = instance as OutfitInstance;
                if (!!outfitInstance)
                {
                    outfitInstance.UpdateProperties(headColor, torsoColor, legsColor, detailColor, addonsFlags);
                    return(instance);
                }

                return(AppearanceStorage.CreateOutfitInstance((uint)outfitID, headColor, torsoColor, legsColor, detailColor, addonsFlags));
            }

            uint           objectID       = message.ReadUnsignedShort();
            ObjectInstance objectInstance = instance as ObjectInstance;

            if (!!objectInstance && objectInstance.ID == objectID)
            {
                return(objectInstance);
            }

            if (objectID == 0)
            {
                return(AppearanceStorage.CreateOutfitInstance(OutfitInstance.InvisibleOutfitID, 0, 0, 0, 0, 0));
            }

            return(AppearanceStorage.CreateObjectInstance(objectID, 0));
        }
Exemplo n.º 2
0
        private AppearanceInstance ReadCreatureOutfit(InputMessage message, AppearanceInstance instance = null)
        {
            int lookType = message.GetU16();

            if (lookType != 0)
            {
                int head   = message.GetU8();
                int body   = message.GetU8();
                int legs   = message.GetU8();
                int feet   = message.GetU8();
                int addons = message.GetU8();

                OutfitInstance outfitInstance = instance as OutfitInstance;
                if (!!outfitInstance)
                {
                    outfitInstance.UpdateProperties(head, body, legs, feet, addons);
                    return(instance);
                }

                return(m_AppearanceStorage.CreateOutfitInstance((uint)lookType, head, body, legs, feet, addons));
            }

            int lookTypeEx = message.GetU16();

            ObjectInstance objectInstance = instance as ObjectInstance;

            if (!!objectInstance && objectInstance.ID == (uint)lookTypeEx)
            {
                return(objectInstance);
            }

            if (lookTypeEx == 0)
            {
                return(m_AppearanceStorage.CreateOutfitInstance(OutfitInstance.InvisibleOutfitID, 0, 0, 0, 0, 0));
            }

            return(m_AppearanceStorage.CreateObjectInstance((uint)lookTypeEx, 0));
        }