Пример #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));
        }
Пример #2
0
        private AppearanceInstance ReadMountOutfit(Internal.ByteArray message, AppearanceInstance instance = null)
        {
            uint outfitID = message.ReadUnsignedShort();

            OutfitInstance outfitInstance = instance as OutfitInstance;

            if (!!outfitInstance && outfitInstance.ID == outfitID)
            {
                return(outfitInstance);
            }

            if (outfitID != 0)
            {
                return(AppearanceStorage.CreateOutfitInstance(outfitID, 0, 0, 0, 0, 0));
            }

            return(null);
        }
Пример #3
0
        private AppearanceInstance ReadMountOutfit(Internal.CommunicationStream message, AppearanceInstance instance = null)
        {
            uint outfitId = message.ReadUnsignedShort();

            OutfitInstance outfitInstance = instance as OutfitInstance;

            if (!!outfitInstance && outfitInstance.Id == outfitId)
            {
                return(outfitInstance);
            }

            if (outfitId != 0)
            {
                return(AppearanceStorage.CreateOutfitInstance(outfitId, 0, 0, 0, 0, 0));
            }

            return(null);
        }