예제 #1
0
        public override object GetJsonObject()
        {
            MannequinExtraData extraData = null;

            try
            {
                extraData = JsonConvert.DeserializeObject <MannequinExtraData>(Item.Data.ExtraData);
            }
            catch { }

            // Revert if any fields were left empty
            if (extraData != null)
            {
                if (string.IsNullOrEmpty(extraData.Gender) || string.IsNullOrEmpty(extraData.Figure) || string.IsNullOrEmpty(extraData.OutfitName))
                {
                    extraData = null;
                }
            }

            if (extraData == null)
            {
                /*[FloorItemUpdate] [8d6478866f292deeeb22b5f6f726e371]
                 * Incoming[3996, _-1w] <- [0][0][0]¾œÓ[13]¦[0][0]J[0][0][0][4][0][0][0][6][0][0][0][2][0][3]0.0[0][3]1.0[0][0][0][0][0][0][0][1][0][0][0][3][0][6]GENDER[0][1]m[0][6]FIGURE[0]Sch-876-1331-110.lg-280-110.sh-295-1331.ca-3217-91-91.wa-3263-110-92.cc-3007-109-109[0][11]OUTFIT_NAME[0]Concealed Guardÿÿÿÿ[0][0][0][2][1]g1Ò*/

                extraData = new MannequinExtraData()
                {
                    //"ch-3030-66.lg-275-64.ca-1806-73.cc-260-1408",
                    //"ch-875-1331-1331.lg-280-91.sh-295-1331.wa-3211-110-110.cc-3007-1331-1331"
                    //"hd-180-1.hr-100-61.ch-210-66.lg-270-82.sh-290-80"
                    Figure     = "lg-275-64.cc-260-62.ca-1806-73.ch-3030-62.hd-180-1.hr-100-61",
                    Gender     = "M",
                    OutfitName = "Default Mannequin"
                };
            }

            return(extraData);
        }
예제 #2
0
        /// <summary>
        /// Generate item data for purchasing item
        /// </summary>
        private List <ItemData> GenerateItemData(int userId, CataloguePackage cataloguePackage, string userInputMessage, long datePurchase)
        {
            ItemDefinition definition = cataloguePackage.Definition;

            if (definition == null)
            {
                return(null);
            }

            List <ItemData> items = new List <ItemData>();

            int    itemsToGenerate = cataloguePackage.Data.Amount;
            object serializeable   = null;

            switch (definition.InteractorType)
            {
            case InteractorType.TROPHY:
            {
                serializeable = new TrophyExtraData
                {
                    UserId  = userId,
                    Message = userInputMessage,
                    Date    = datePurchase
                };
            }
            break;

            case InteractorType.MANNEQUIN:
            {
                //  { "Gender":"M","Figure":"lg-275-64.cc-260-62.ca-1806-73.ch-3030-62.hd-180-1.hr-100-61","OutfitName":"Default Mannequin"}

                serializeable = new MannequinExtraData();

                /*
                 * {
                 *  //"ch-3030-66.lg-275-64.ca-1806-73.cc-260-1408",
                 *  //"ch-875-1331-1331.lg-280-91.sh-295-1331.wa-3211-110-110.cc-3007-1331-1331"
                 *  //"hd-180-1.hr-100-61.ch-210-66.lg-270-82.sh-290-80"
                 *  Figure = "lg-275-64.cc-260-62.ca-1806-73.ch-3030-62.hd-180-1.hr-100-61",
                 *  Gender = "M",
                 *  OutfitName = "Default Mannequin"
                 * };
                 */
            }
            break;
            }

            var extraData = string.Empty;

            if (serializeable != null)
            {
                extraData = JsonConvert.SerializeObject(serializeable);
            }

            if (!string.IsNullOrEmpty(cataloguePackage.Data.SpecialSpriteId))
            {
                extraData = cataloguePackage.Data.SpecialSpriteId;
            }

            if (definition.InteractorType == InteractorType.TELEPORTER)
            {
                ItemData firstTeleporter = new ItemData();
                firstTeleporter.OwnerId      = userId;
                firstTeleporter.DefinitionId = cataloguePackage.Definition.Data.Id;

                ItemData secondTeleporter = new ItemData();
                secondTeleporter.OwnerId      = userId;
                secondTeleporter.DefinitionId = cataloguePackage.Definition.Data.Id;

                firstTeleporter.ExtraData = JsonConvert.SerializeObject(new TeleporterExtraData
                {
                    LinkedItem = secondTeleporter.Id.ToString()
                });

                secondTeleporter.ExtraData = JsonConvert.SerializeObject(new TeleporterExtraData
                {
                    LinkedItem = firstTeleporter.Id.ToString()
                });

                items.Add(firstTeleporter);
                items.Add(secondTeleporter);
            }
            else
            {
                for (int i = 0; i < itemsToGenerate; i++)
                {
                    ItemData itemData = new ItemData();
                    itemData.OwnerId      = userId;
                    itemData.DefinitionId = cataloguePackage.Definition.Data.Id;
                    itemData.ExtraData    = extraData;
                    items.Add(itemData);
                }
            }

            return(items);
        }