示例#1
0
        internal static bool ValidateLook(string Look, string Gender, Habbo Habbo)
        {
            if (string.IsNullOrEmpty(Look))
            {
                return(false);
            }

            // Si no es chico ni chica.
            if (Gender != "M" && Gender != "F")
            {
                return(false);
            }

            // Partes imprescindibles.
            if (!Look.Contains("hd") || !Look.Contains("ch") || !Look.Contains("lg"))
            {
                return(false);
            }

            string[] Sets = Look.Split('.');

            foreach (string Set in Sets)
            {
                string[] Parts = Set.Split('-');

                // Pocas/Demasiadas partes.
                if (Parts.Length < 2 || Parts.Length > 4)
                {
                    return(false);
                }

                string Name = Parts[0];
                int    Type = int.Parse(Parts[1]);
                // var Color = int.Parse(Parts[1]);

                if (Type <= 0)
                {
                    return(false);
                }

                if (Name.Length != 2)
                {
                    return(false);
                }

                if (OtanixEnvironment.GetGame().GetClothingManager().IsPremiumPart(Type))
                {
                    //La ropa es premium y no está comprada.
                    if (!Habbo.GetUserClothingManager().ContainsPart(Type))
                    {
                        ServerMessage Alert = new ServerMessage(Outgoing.CustomAlert);
                        Alert.AppendString("furni_placement_error");
                        Alert.AppendInt32(2);
                        Alert.AppendString("message");
                        Alert.AppendString("Está roupa é VIP, você não pode usar ela! adquira VIP e desfrute dessas e outras vantagens!");
                        Alert.AppendString("image");
                        Alert.AppendString("${image.library.url}notifications/" + EmuSettings.EVENTHA_ICON + ".png");
                        Habbo.GetClient().SendMessage(Alert);

                        return(false);
                    }
                }
            }

            return(true);
        }
示例#2
0
        private bool ValidateLook(Habbo Habbo, string Look)
        {
            // Si no hay look.
            if (string.IsNullOrEmpty(Look))
            {
                return(false);
            }

            // Partes imprescindibles.
            if (!Look.Contains("hd") || !Look.Contains("ch") || !Look.Contains("lg"))
            {
                return(false);
            }

            // Partes
            string[] Sets = Look.Split('.');

            foreach (string Set in Sets)
            {
                string[] Parts = Set.Split('-');

                // Número de partes inválido.
                if (Parts.Length < 2 || Parts.Length > 4)
                {
                    return(false);
                }

                string ClothesName  = Parts[0];
                int    ClothesId    = int.Parse(Parts[1]);
                int    ClothesColor = -1;

                // Si esta ropa no existe.
                if (!Clothes.ContainsKey(ClothesName))
                {
                    return(false);
                }

                Clothes Ropa = Clothes[ClothesName].Where(t => t.Id == ClothesId).First();
                if (Ropa == null)
                {
                    return(false);
                }

                // Si no es de varios sexos.
                if (Ropa.Gender.ToUpper() != "U")
                {
                    // Género Inválido.
                    if (Ropa.Gender.ToUpper() != Habbo.Gender.ToUpper())
                    {
                        return(false);
                    }
                }

                if (Ropa.Colorable)
                {
                    // Si no hay 3 partes en la ropa.
                    if (Parts.Length != 3 && Parts.Length != 4)
                    {
                        return(false);
                    }

                    // Comprobamos los colores.
                    for (int i = 2; i < Parts.Length; i++)
                    {
                        ClothesColor = int.Parse(Parts[i]);

                        // Si la paletta de colores no existe.
                        if (!PaletteColors.ContainsKey(Ropa.PaletteId))
                        {
                            return(false);
                        }

                        // Si este color no está en la paleta.
                        if (!PaletteColors[Ropa.PaletteId].Exists(t => t.Id == ClothesColor))
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    // Si hay color cuando esta ropa no es coloreable.
                    if (Parts.Length != 2)
                    {
                        return(false);
                    }
                }

                if (Ropa.Sellable)
                {
                    // La ropa es premium y no está comprada.
                    if (!Habbo.GetUserClothingManager().ContainsPart(ClothesId))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }