Exemple #1
0
        public static void UpdateItemById(ClothesTypes itemChoise, int id)
        {
            while (true)
            {
                try
                {
                    switch (itemChoise)
                    {
                    case ClothesTypes.Tops:
                        var topsItem = Misc.SelectTopsById(itemChoise, id);
                        Misc.ShowItem(topsItem);
                        Misc.ChangeProperty(topsItem);
                        break;

                    case ClothesTypes.Pants:
                        var pantsItem = Misc.SelectPantsById(itemChoise, id);
                        Misc.ShowItem(pantsItem);
                        Misc.ChangeProperty(pantsItem);
                        break;

                    case ClothesTypes.Shoes:
                        var shoesItem = Misc.SelectShoesById(itemChoise, id);
                        Misc.ShowItem(shoesItem);
                        Misc.ChangeProperty(shoesItem);
                        break;
                    }
                    break;
                }
                catch (Exception)
                {
                    break;
                }
            }
        }
Exemple #2
0
        public static void RemoveItembyId(ClothesTypes itemChoise, int id)
        {
            while (true)
            {
                try
                {
                    switch (itemChoise)
                    {
                    case ClothesTypes.Tops:
                        var topsItem = Misc.SelectTopsById(itemChoise, id);
                        db.Tops.Remove(topsItem);
                        break;

                    case ClothesTypes.Pants:
                        var pantsItem = Misc.SelectPantsById(itemChoise, id);
                        db.Pants.Remove(pantsItem);
                        break;

                    case ClothesTypes.Shoes:
                        var shoesItem = Misc.SelectShoesById(itemChoise, id);
                        db.Shoes.Remove(shoesItem);
                        break;
                    }
                    break;
                }
                catch (Exception)
                {
                    break;
                }
            }
        }
Exemple #3
0
        public static void AddItem(ClothesTypes itemChoise)
        {
            while (true)
            {
                try
                {
                    switch (itemChoise)
                    {
                    case ClothesTypes.Tops:
                        var topsItem = db.Tops.Add(new Tops());
                        Misc.ChangeProperty(topsItem);
                        break;

                    case ClothesTypes.Pants:
                        var pantsItem = db.Pants.Add(new Pants());
                        Misc.ChangeProperty(pantsItem);
                        break;

                    case ClothesTypes.Shoes:
                        var shoesItem = db.Shoes.Add(new Shoes());
                        Misc.ChangeProperty(shoesItem);
                        break;
                    }
                    break;
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Exemple #4
0
        public static void ShowDB(ClothesTypes itemChoise)
        {
            switch (itemChoise)
            {
            case ClothesTypes.Tops:
                foreach (var item in db.Tops)
                {
                    Misc.ShowItem(item);
                }
                break;

            case ClothesTypes.Pants:
                foreach (var item in db.Pants)
                {
                    Misc.ShowItem(item);
                }
                break;

            case ClothesTypes.Shoes:
                foreach (var item in db.Shoes)
                {
                    Misc.ShowItem(item);
                }
                break;
            }
        }
Exemple #5
0
 public static int GetId(ClothesTypes itemChoise, ClothesContext db)
 {
     while (true)
     {
         try
         {
             Console.Write("Enter item's Id: ");
             var id = Convert.ToInt32(Console.ReadLine());
             if ((db.Tops.Find(id) == null && itemChoise == ClothesTypes.Tops) || (db.Pants.Find(id) == null && itemChoise == ClothesTypes.Pants) || (db.Shoes.Find(id) == null && itemChoise == ClothesTypes.Shoes))
             {
                 Misc.ConsoleLog(ConsoleColor.Yellow, $"Sorry, there is no {itemChoise} in DataBase with such ID, exit (Y/N)?");
                 string temp = Console.ReadLine();
                 if (temp == "Y" || temp == "y")
                 {
                     return(-1);
                 }
             }
             else
             {
                 return(id);
             }
         }
         catch (Exception)
         {
             Misc.ConsoleLog(ConsoleColor.Yellow, "Incorrect Id, try again");
         }
     }
 }
Exemple #6
0
 private static void ClothesAssigment(Clothes playerClothes, ClothesTypes typeClothes)
 {
     playerClothes.MaskSlot       = typeClothes.MaskSlot;
     playerClothes.MaskDraw       = typeClothes.MaskDraw;
     playerClothes.TorsoSlot      = typeClothes.TorsoSlot;
     playerClothes.TorsoDraw      = typeClothes.TorsoDraw;
     playerClothes.LegsSlot       = typeClothes.LegsSlot;
     playerClothes.LegsDraw       = typeClothes.LegsDraw;
     playerClothes.BagsSlot       = typeClothes.BagsSlot;
     playerClothes.BagsDraw       = typeClothes.BagsDraw;
     playerClothes.FeetSlot       = typeClothes.FeetSlot;
     playerClothes.FeetDraw       = typeClothes.FeetDraw;
     playerClothes.AccessSlot     = typeClothes.AccessSlot;
     playerClothes.AccessDraw     = typeClothes.AccessDraw;
     playerClothes.UndershirtSlot = typeClothes.UndershirtSlot;
     playerClothes.UndershirtDraw = typeClothes.UndershirtDraw;
     playerClothes.ArmorSlot      = typeClothes.ArmorSlot;
     playerClothes.ArmorDraw      = typeClothes.ArmorDraw;
     playerClothes.TopsSlot       = typeClothes.TopsSlot;
     playerClothes.TopsDraw       = typeClothes.TopsDraw;
     playerClothes.HatsSlot       = typeClothes.HatsSlot;
     playerClothes.HatsDraw       = typeClothes.HatsDraw;
     playerClothes.GlassesSlot    = typeClothes.GlassesSlot;
     playerClothes.GlassesDraw    = typeClothes.GlassesDraw;
 }
Exemple #7
0
        public static void SetPlayerSkinClothes(Client player, int type, Character character, bool isFirstTime)
        {
            Clothes      playerClothes     = null;
            ClothesTypes playerTypeClothes = null;

            if (type == 0)
            {
                playerClothes = ContextFactory.Instance.Clothes.FirstOrDefault(x => x.CharacterId == character.Id);
            }
            else
            {
                playerTypeClothes = ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == type);
            }

            // FIRST REGISTARTION of character clothes:
            if (isFirstTime)
            {
                var isMale = character.Model == 1885233650;

                playerClothes = new Clothes();
                var typeClothes = isMale ?
                                  ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == 999) :
                                  ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == 9990);
                if (typeClothes == null)
                {
                    return;
                }

                playerClothes.CharacterId = character.Id;
                character.ActiveClothes   = isMale ? 999 : 9990;
                ClothesAssigment(playerClothes, typeClothes);

                ContextFactory.Instance.Clothes.Add(playerClothes);
                ContextFactory.Instance.SaveChanges();

                //API.shared.setPlayerClothes(player, 0, 0, 0);
                SetPlayerClothesAccessory(player, playerClothes);
            }

            // PLAYER CLOTHES (table Clothes):
            if (!isFirstTime && type == 0)
            {
                SetPlayerClothesAccessory(player, playerClothes);
            }

            // FRACTION CLOTHES (table ClothesTypes):
            if (!isFirstTime && type != 0)
            {
                SetPlayerTypeClothesAccessory(player, playerTypeClothes);
            }
        }
Exemple #8
0
 private static void SetPlayerTypeClothesAccessory(Client player, ClothesTypes playerClothes)
 {
     API.shared.setPlayerClothes(player, 1, playerClothes.MaskSlot, playerClothes.MaskDraw);
     API.shared.setPlayerClothes(player, 3, playerClothes.TorsoSlot, playerClothes.TorsoDraw);
     API.shared.setPlayerClothes(player, 4, playerClothes.LegsSlot, playerClothes.LegsDraw);
     API.shared.setPlayerClothes(player, 5, playerClothes.BagsSlot, playerClothes.BagsDraw);
     API.shared.setPlayerClothes(player, 6, playerClothes.FeetSlot, playerClothes.FeetDraw);
     API.shared.setPlayerClothes(player, 7, playerClothes.AccessSlot, playerClothes.AccessDraw);
     API.shared.setPlayerClothes(player, 8, playerClothes.UndershirtSlot, playerClothes.UndershirtDraw);
     API.shared.setPlayerClothes(player, 9, playerClothes.ArmorSlot, playerClothes.ArmorDraw);
     API.shared.setPlayerClothes(player, 11, playerClothes.TopsSlot, playerClothes.TopsDraw);
     API.shared.setPlayerAccessory(player, 0, playerClothes.HatsSlot, playerClothes.HatsDraw);
     API.shared.setPlayerAccessory(player, 1, playerClothes.GlassesSlot, playerClothes.GlassesDraw);
 }
Exemple #9
0
 public static int ActionChoice(ClothesTypes ClothesType)
 {
     Misc.ConsoleLog(ConsoleColor.Yellow, $"1-remove {ClothesType} (by ID)\n2-add default {ClothesType}" +
                     $" \n3-add {ClothesType} with parameters \n4-search info about the {ClothesType} by ID" +
                     $"\n5-update {ClothesType} by ID");
     while (true)
     {
         var result = Int32.TryParse(Console.ReadLine(), out int choice);
         if (result && choice == 1 || choice == 2 || choice == 3 || choice == 4 || choice == 5)
         {
             return(choice);
         }
         Misc.ConsoleLog(ConsoleColor.Yellow, "Choose 1, 2, 3, 4 or 5");
     }
 }
Exemple #10
0
        public static void AddDefault(ClothesTypes itemChoise)
        {
            switch (itemChoise)
            {
            case ClothesTypes.Tops:
                db.Tops.Add(new Tops());
                break;

            case ClothesTypes.Pants:
                db.Pants.Add(new Pants());
                break;

            case ClothesTypes.Shoes:
                db.Shoes.Add(new Shoes());
                break;
            }
        }
Exemple #11
0
        public static Shoes SelectShoesById(ClothesTypes itemChoise, int id)
        {
            var shoesItem = AppFuncs.db.Shoes.Find(id);

            return(shoesItem);
        }
Exemple #12
0
        public static Pants SelectPantsById(ClothesTypes itemChoise, int id)
        {
            var pantsItem = AppFuncs.db.Pants.Find(id);

            return(pantsItem);
        }
Exemple #13
0
        public static Tops SelectTopsById(ClothesTypes itemChoise, int id)
        {
            var topsItem = AppFuncs.db.Tops.Find(id);

            return(topsItem);
        }
        public static void SetPlayerSkinClothes(Client player, int type, Character character, int check)
        {
            Clothes      playerClothes     = null;
            ClothesTypes playerTypeClothes = null;

            if (type == 0)
            {
                playerClothes = ContextFactory.Instance.Clothes.FirstOrDefault(x => x.CharacterId == character.Id);
            }
            else
            {
                playerTypeClothes = ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == type);
            }

            // First registration of character clothes
            if (check == 0)
            {
                playerClothes = new Clothes();
                var typeClothes = ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == 101);
                playerClothes.CharacterId    = character.Id;
                playerClothes.MaskSlot       = typeClothes.MaskSlot;
                playerClothes.MaskDraw       = typeClothes.MaskDraw;
                playerClothes.TorsoSlot      = typeClothes.TorsoSlot;
                playerClothes.TorsoDraw      = typeClothes.TorsoDraw;
                playerClothes.LegsSlot       = typeClothes.LegsSlot;
                playerClothes.LegsDraw       = typeClothes.LegsDraw;
                playerClothes.BagsSlot       = typeClothes.BagsSlot;
                playerClothes.BagsDraw       = typeClothes.BagsDraw;
                playerClothes.FeetSlot       = typeClothes.FeetSlot;
                playerClothes.FeetDraw       = typeClothes.FeetDraw;
                playerClothes.AccessSlot     = typeClothes.AccessSlot;
                playerClothes.AccessDraw     = typeClothes.AccessDraw;
                playerClothes.UndershirtSlot = typeClothes.UndershirtSlot;
                playerClothes.UndershirtDraw = typeClothes.UndershirtDraw;
                playerClothes.ArmorSlot      = typeClothes.ArmorSlot;
                playerClothes.ArmorDraw      = typeClothes.ArmorDraw;
                playerClothes.TopsSlot       = typeClothes.TopsSlot;
                playerClothes.TopsDraw       = typeClothes.TopsDraw;
                playerClothes.HatsSlot       = typeClothes.HatsSlot;
                playerClothes.HatsDraw       = typeClothes.HatsDraw;
                playerClothes.GlassesSlot    = typeClothes.GlassesSlot;
                playerClothes.GlassesDraw    = typeClothes.GlassesDraw;

                ContextFactory.Instance.Clothes.Add(playerClothes);
                ContextFactory.Instance.SaveChanges();

                //API.shared.setPlayerSkin(player, (PedHash)character.Model); // TODO: delete after face custom
                API.shared.setPlayerClothes(player, 0, 0, 0);
                API.shared.setPlayerClothes(player, 1, playerClothes.MaskSlot, playerClothes.MaskDraw);
                API.shared.setPlayerClothes(player, 3, playerClothes.TorsoSlot, playerClothes.TorsoDraw);
                API.shared.setPlayerClothes(player, 4, playerClothes.LegsSlot, playerClothes.LegsDraw);
                API.shared.setPlayerClothes(player, 5, playerClothes.BagsSlot, playerClothes.BagsDraw);
                API.shared.setPlayerClothes(player, 6, playerClothes.FeetSlot, playerClothes.FeetDraw);
                API.shared.setPlayerClothes(player, 7, playerClothes.AccessSlot, playerClothes.AccessDraw);
                API.shared.setPlayerClothes(player, 8, playerClothes.UndershirtSlot, playerClothes.UndershirtDraw);
                API.shared.setPlayerClothes(player, 9, playerClothes.ArmorSlot, playerClothes.ArmorDraw);
                API.shared.setPlayerClothes(player, 11, playerClothes.TopsSlot, playerClothes.TopsDraw);
                API.shared.setPlayerAccessory(player, 0, playerClothes.HatsSlot, playerClothes.HatsDraw);
                API.shared.setPlayerAccessory(player, 1, playerClothes.GlassesSlot, playerClothes.GlassesDraw);
            }

            if (check == 1 && type == 0)
            {
                //API.shared.setPlayerSkin(player, (PedHash)character.Model); // TODO: delete after face custom
                API.shared.setPlayerClothes(player, 1, playerClothes.MaskSlot, playerClothes.MaskDraw);
                API.shared.setPlayerClothes(player, 3, playerClothes.TorsoSlot, playerClothes.TorsoDraw);
                API.shared.setPlayerClothes(player, 4, playerClothes.LegsSlot, playerClothes.LegsDraw);
                API.shared.setPlayerClothes(player, 5, playerClothes.BagsSlot, playerClothes.BagsDraw);
                API.shared.setPlayerClothes(player, 6, playerClothes.FeetSlot, playerClothes.FeetDraw);
                API.shared.setPlayerClothes(player, 7, playerClothes.AccessSlot, playerClothes.AccessDraw);
                API.shared.setPlayerClothes(player, 8, playerClothes.UndershirtSlot, playerClothes.UndershirtDraw);
                API.shared.setPlayerClothes(player, 9, playerClothes.ArmorSlot, playerClothes.ArmorDraw);
                API.shared.setPlayerClothes(player, 11, playerClothes.TopsSlot, playerClothes.TopsDraw);
                API.shared.setPlayerAccessory(player, 0, playerClothes.HatsSlot, playerClothes.HatsDraw);
                API.shared.setPlayerAccessory(player, 1, playerClothes.GlassesSlot, playerClothes.GlassesDraw);
            }
            if (check == 1 && type != 0)
            {
                //API.shared.setPlayerSkin(player, (PedHash)character.Model); // TODO: delete after face custom
                API.shared.setPlayerClothes(player, 1, playerTypeClothes.MaskSlot, playerTypeClothes.MaskDraw);
                API.shared.setPlayerClothes(player, 3, playerTypeClothes.TorsoSlot, playerTypeClothes.TorsoDraw);
                API.shared.setPlayerClothes(player, 4, playerTypeClothes.LegsSlot, playerTypeClothes.LegsDraw);
                API.shared.setPlayerClothes(player, 5, playerTypeClothes.BagsSlot, playerTypeClothes.BagsDraw);
                API.shared.setPlayerClothes(player, 6, playerTypeClothes.FeetSlot, playerTypeClothes.FeetDraw);
                API.shared.setPlayerClothes(player, 7, playerTypeClothes.AccessSlot, playerTypeClothes.AccessDraw);
                API.shared.setPlayerClothes(player, 8, playerTypeClothes.UndershirtSlot, playerTypeClothes.UndershirtDraw);
                API.shared.setPlayerClothes(player, 9, playerTypeClothes.ArmorSlot, playerTypeClothes.ArmorDraw);
                API.shared.setPlayerClothes(player, 11, playerTypeClothes.TopsSlot, playerTypeClothes.TopsDraw);
                API.shared.setPlayerAccessory(player, 0, playerTypeClothes.HatsSlot, playerTypeClothes.HatsDraw);
                API.shared.setPlayerAccessory(player, 1, playerTypeClothes.GlassesSlot, playerTypeClothes.GlassesDraw);
            }
        }