Ejemplo n.º 1
0
        partial void Merge(Backpack entity, ItemDTO dto, object state)
        {
            int defaultSkinId;
            if (int.TryParse(dto.DefaultSkin, out defaultSkinId))
            {
                entity.DefaultSkinId = defaultSkinId;
            }

            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            var infusionSlots = details.InfusionSlots;
            if (infusionSlots != null)
            {
                entity.InfusionSlots = this.infusionSlotCollectionConverter.Convert(infusionSlots, state);
            }

            var infixUpgrade = details.InfixUpgrade;
            if (infixUpgrade != null)
            {
                entity.InfixUpgrade = this.infixUpgradeConverter.Convert(infixUpgrade, state);
            }

            entity.SuffixItemId = details.SuffixItemId;

            int secondarySuffixItemId;
            if (int.TryParse(details.SecondarySuffixItemId, out secondarySuffixItemId))
            {
                entity.SecondarySuffixItemId = secondarySuffixItemId;
            }
        }
        partial void Merge(UpgradeComponent entity, ItemDTO dto, object state)
        {
            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            var flags = details.Flags;
            if (flags != null)
            {
                entity.UpgradeComponentFlags = this.upgradeComponentFlagCollectionConverter.Convert(flags, details);
            }

            var infusionUpgradeFlags = details.InfusionUpgradeFlags;
            if (infusionUpgradeFlags != null)
            {
                entity.InfusionUpgradeFlags = this.infusionSlotFlagCollectionConverter.Convert(infusionUpgradeFlags, details);
            }

            entity.Suffix = details.Suffix;

            var infixUpgrade = details.InfixUpgrade;
            if (infixUpgrade != null)
            {
                entity.InfixUpgrade = this.infixUpgradeConverter.Convert(infixUpgrade, details);
            }

            entity.Bonuses = details.Bonuses;
        }
Ejemplo n.º 3
0
 partial void Merge(GatheringTool entity, ItemDTO dto, object state)
 {
     int defaultSkinId;
     if (int.TryParse(dto.DefaultSkin, out defaultSkinId))
     {
         entity.DefaultSkinId = defaultSkinId;
     }
 }
Ejemplo n.º 4
0
        partial void Merge(DyeUnlocker entity, ItemDTO dto, object state)
        {
            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            if (details.ColorId.HasValue)
            {
                entity.ColorId = details.ColorId.Value;
            }
        }
Ejemplo n.º 5
0
        partial void Merge(SalvageTool entity, ItemDTO dto, object state)
        {
            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            if (details.Charges.HasValue)
            {
                entity.Charges = details.Charges.Value;
            }
        }
        partial void Merge(CraftingRecipeUnlocker entity, ItemDTO dto, object state)
        {
            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            if (details.RecipeId.HasValue)
            {
                entity.RecipeId = details.RecipeId.Value;
            }
        }
Ejemplo n.º 7
0
        partial void Merge(Weapon entity, ItemDTO dto, object state)
        {
            int defaultSkinId;
            if (int.TryParse(dto.DefaultSkin, out defaultSkinId))
            {
                entity.DefaultSkinId = defaultSkinId;
            }

            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            entity.DamageType = this.damageTypeConverter.Convert(details.DamageType, details);

            if (details.MinimumPower.HasValue)
            {
                entity.MinimumPower = details.MinimumPower.Value;
            }

            if (details.MaximumPower.HasValue)
            {
                entity.MaximumPower = details.MaximumPower.Value;
            }

            if (details.Defense.HasValue)
            {
                entity.Defense = details.Defense.Value;
            }

            var infusionSlots = details.InfusionSlots;
            if (infusionSlots != null)
            {
                entity.InfusionSlots = this.infusionSlotCollectionConverter.Convert(infusionSlots, details);
            }

            var infixUpgrade = details.InfixUpgrade;
            if (infixUpgrade != null)
            {
                entity.InfixUpgrade = this.infixUpgradeConverter.Convert(infixUpgrade, details);
            }

            entity.SuffixItemId = details.SuffixItemId;

            int secondarySuffixItemId;
            if (int.TryParse(details.SecondarySuffixItemId, out secondarySuffixItemId))
            {
                entity.SecondarySuffixItemId = secondarySuffixItemId;
            }
        }
Ejemplo n.º 8
0
        partial void Merge(Utility entity, ItemDTO dto, object state)
        {
            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            var duration = details.Duration;
            if (duration.HasValue)
            {
                entity.Duration = TimeSpan.FromMilliseconds(duration.Value);
            }

            entity.Effect = details.Description;
        }
Ejemplo n.º 9
0
        partial void Merge(Bag entity, ItemDTO dto, object state)
        {
            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            if (details.Size.HasValue)
            {
                entity.Size = details.Size.Value;
            }

            if (details.NoSellOrSort.HasValue)
            {
                entity.NoSellOrSort = details.NoSellOrSort.Value;
            }
        }
Ejemplo n.º 10
0
        partial void Merge(Armor entity, ItemDTO dto, object state)
        {
            int defaultSkinId;
            if (int.TryParse(dto.DefaultSkin, out defaultSkinId))
            {
                entity.DefaultSkinId = defaultSkinId;
            }

            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            entity.WeightClass = this.weightClassConverter.Convert(details.WeightClass, details);
            if (details.Defense.HasValue)
            {
                entity.Defense = details.Defense.Value;
            }

            var infusionSlots = details.InfusionSlots;
            if (infusionSlots != null)
            {
                entity.InfusionSlots = this.infusionSlotCollectionConverter.Convert(infusionSlots, details);
            }

            var infixUpgrade = details.InfixUpgrade;
            if (infixUpgrade != null)
            {
                entity.InfixUpgrade = this.infixUpgradeConverter.Convert(infixUpgrade, details);
            }

            entity.SuffixItemId = details.SuffixItemId;

            int secondarySuffixItemId;
            if (int.TryParse(details.SecondarySuffixItemId, out secondarySuffixItemId))
            {
                entity.SecondarySuffixItemId = secondarySuffixItemId;
            }
        }
Ejemplo n.º 11
0
        partial void Merge(Item entity, ItemDTO dto, object state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state", "Precondition: state is IResponse");
            }

            var response = state as IResponse;
            if (response == null)
            {
                throw new ArgumentException("Precondition: state is IResponse", "state");
            }

            entity.Culture = response.Culture;
            entity.ItemId = dto.Id;
            entity.ChatLink = dto.ChatLink;
            entity.Name = dto.Name;
            entity.Description = dto.Description;
            entity.Level = dto.Level;
            entity.Rarity = this.itemRarityConverter.Convert(dto.Rarity, dto);
            entity.VendorValue = dto.VendorValue;
            entity.Type = dto.Type;
            var gameTypes = dto.GameTypes;
            if (gameTypes != null)
            {
                entity.GameTypes = this.gameTypesConverter.Convert(gameTypes, dto);
            }

            var flags = dto.Flags;
            if (flags != null)
            {
                entity.Flags = this.itemFlagsConverter.Convert(flags, dto);
            }

            var restrictions = dto.Restrictions;
            if (restrictions != null)
            {
                entity.Restrictions = this.itemRestrictionsConverter.Convert(restrictions, dto);
            }

            // Set the icon file identifier and signature
            Uri icon;
            if (Uri.TryCreate(dto.Icon, UriKind.Absolute, out icon))
            {
                // Set the icon file URL
                entity.IconFileUrl = icon;

                // Split the path into segments
                // Format: /file/{signature}/{identifier}.{extension}
                var segments = icon.LocalPath.Split('.')[0].Split('/');

                // Set the icon file signature
                if (segments.Length >= 3 && segments[2] != null)
                {
                    entity.IconFileSignature = segments[2];
                }

                // Set the icon file identifier
                int iconFileId;
                if (segments.Length >= 4 && int.TryParse(segments[3], out iconFileId))
                {
                    entity.IconFileId = iconFileId;
                }
            }
        }