Exemple #1
0
        public async Task aduty_CMDAsync(User player)
        {
            Users dbUser = Main.database.UserCollection.AsQueryable().FirstOrDefault(x => x.Username == player.Username);
            var   dbChar = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(x => x.ownerObjId == dbUser.id);

            if (player.adminLevel == 0)
            {
                await NotifyHandler.SendNotification(player, "Keine Rechte!");

                return;
            }

            if (player.isAduty)
            {
                player.Emit("player:aduty:leave");
                await Utils.Utils.LoadClothes(player, dbChar);

                Discord.Webhookhandler.sendMessage($"[{dbChar.firstName} {dbChar.lastName} / {dbUser.Username}] Aduty verlassen. `{DateTime.Now.ToLocalTime():dd.MM.yyyy HH:mm:ss}`");
                player.isAduty = false;
                return;
            }
            if (!player.isAduty)
            {
                player.Emit("player:aduty:enter", player.sex, player.adminLevel);
                Discord.Webhookhandler.sendMessage($"[{dbChar.firstName} {dbChar.lastName} / {dbUser.Username}] Aduty betreten. `{DateTime.Now.ToLocalTime():dd.MM.yyyy HH:mm:ss}`");
                player.isAduty = true;
            }
        }
        internal async Task <bool> addItem(int id, int amount)
        {
            var dbChar = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(c => c.ownerObjId == this.uid);
            var dbInv  = dbChar.Inventar;
            var Item   = new Item()
            {
                itemId = id, amount = amount
            };
            var dbInvItem = dbInv.FirstOrDefault(i => i.itemId == id);

            if (dbInvItem != null)
            {
                dbInvItem.amount += amount;
            }
            else
            {
                Console.WriteLine("ADD: " + id + " " + amount);
                dbInv.Add(Item);
            }
            double invWeight = 0;

            foreach (var item in dbInv)
            {
                var dbItem = Main.database.ItemCollection.AsQueryable().FirstOrDefault(i => i.itemId == item.itemId);
                invWeight += dbItem.weight * item.amount;
            }
            if (invWeight >= 50)
            {
                await NotifyHandler.SendNotification(this, "Dein Inventar ist voll!", 3000);

                return(false);
            }
            Main.database.CharacterCollection.ReplaceOne(c => c.ownerObjId == this.uid, dbChar);
            return(true);
        }
        public Task getNumber(User player)
        {
            var dbChar = Utils.Utils.GetDatabaseCharacter(player);

            NotifyHandler.SendNotification(player, "Deine Telefonnummer: " + dbChar.Number);
            return(Task.CompletedTask);
        }
        public async Task ausparken(User player, string model, string license, string objId)
        {
            var dbCar = Main.database.CarCollection.AsQueryable().FirstOrDefault(c => c.numPlate == license);

            var ausparkPunkte = Main.database.GarageCollection.AsQueryable().FirstOrDefault(g => g.garageId == dbCar.garageId).Ausparkpunkte;


            for (int i = 0; i < ausparkPunkte.Count; i++)
            {
                var ausparkPunkt    = ATMS.atmInteraction.toAltPos(ausparkPunkte.ElementAt(i).position);
                var ausparkRotation = ausparkPunkte.ElementAt(i).rotation;
                var ausparkBlocked  = Alt.GetAllVehicles().ToList().FirstOrDefault(v => v.Position.IsInRange(ausparkPunkt, 1.5f));
                var dbModifiers     = Main.database.VehicleModiferCollection.AsQueryable().FirstOrDefault(c => c.ModelName.ToLower() == dbCar.carmodel.ToLower());
                if (ausparkBlocked != null)
                {
                }
                else
                {
                    Car spawnCar = (Car)Alt.CreateVehicle(model, ausparkPunkt, new Rotation(0, 0, (float)ausparkRotation));
                    spawnCar.NumberplateText = license;


                    spawnCar.ownerId             = dbCar.ownerId;
                    spawnCar.allowedIds          = dbCar.allowedIds;
                    spawnCar.carmodel            = model;
                    spawnCar.numPlate            = license;
                    spawnCar.fuel                = dbCar.fuel;
                    spawnCar.kilometer           = dbCar.kilometer;
                    spawnCar.carId               = dbCar.carId;
                    spawnCar.ManualEngineControl = true;
                    spawnCar.LockState           = VehicleLockState.Locked;


                    dbCar.parkedIn = false;
                    await Main.database.CarCollection.ReplaceOneAsync(c => c.numPlate == license, dbCar);

                    if (dbModifiers != null && dbModifiers.VehSpeedModifier != 0)
                    {
                        Alt.EmitAllClients("vehicle:setSpeed", spawnCar, dbModifiers.VehSpeedModifier);
                    }


                    break;
                }

                if (i != ausparkPunkte.Count || !ausparkBlocked.Exists)
                {
                    continue;
                }
                await NotifyHandler.SendNotification(player, "Es sind keine Ausparkpunkte frei!");

                break;
            }
        }
Exemple #5
0
        public async Task carinfo_CMD(User player)
        {
            var carinrange = (Car)Alt.GetAllVehicles().FirstOrDefault(x => x.Position.IsInRange(player.Position, 1.5f));

            if (!carinrange.Exists)
            {
                return;
            }
            var dbCar      = Main.database.CarCollection.AsQueryable().FirstOrDefault(c => c.carId == carinrange.carId);
            var dbcarOwner = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(c => c.playerId == dbCar.ownerId);
            await NotifyHandler.SendNotification(player, $"Model: {dbCar.carmodel} CarID: {dbCar.carId} Owner: {dbcarOwner.firstName} {dbcarOwner.lastName}");
        }
        public Task jailtime_CMD(User player)
        {
            var dbChar = Utils.Utils.GetDatabaseCharacter(player.playerId);

            if (dbChar.jailTime > 1)
            {
                NotifyHandler.SendNotification(player, $"Du hast noch {dbChar.jailTime} Hafteinheiten!");
                return(Task.CompletedTask);
            }
            NotifyHandler.SendNotification(player, $"Du befindest dich nicht im Gefängnis!");
            return(Task.CompletedTask);
        }
        public async Task ooc_Chat(User player, params string[] args)
        {
            var playerPool  = Alt.GetAllPlayers();
            var dbChar      = Utils.Utils.GetDatabaseCharacter(player);
            var chatMessage = "";

            foreach (var x in args)
            {
                chatMessage += $"{x} ";
            }
            foreach (User p in playerPool.Where(x => x.Position.IsInRange(player.Position, 10f)))
            {
                await NotifyHandler.SendNotification(p, $"OOC: {dbChar.firstName} {dbChar.lastName} ({dbChar.playerId}) {chatMessage}");
            }
        }
        public async Task Leave(User player)
        {
            if (player.paintballArena == 0)
            {
                return;
            }
            await NotifyHandler.SendNotification(player, "Du hast Paintball verlassen!");

            await Utils.Utils.LoadClothes(player, Utils.Utils.GetDatabaseCharacter(player));

            Main.database.PaintballCollection.AsQueryable().FirstOrDefault(p => p.arenaId == player.paintballArena).playerCount -= 1;
            player.RemoveAllWeapons();
            player.paintballArena = 0;
            player.Dimension      = 0;
            await Utils.Utils.LoadPlayerWeapons(player);
        }
Exemple #9
0
        public async Task medicDuty_CMD(User player)
        {
            Console.WriteLine("Call Medic CMD" + "Jobduty: " + player.IsJobDuty);
            if (player.IsJobDuty)
            {
                await NotifyHandler.SendNotification(player, "Du bist nun nichtmehr im Medic-Dienst!");

                player.IsJobDuty = false;
                return;
            }
            else
            {
                await NotifyHandler.SendNotification(player, "Du bist nun im Medic-Dienst!");

                player.IsJobDuty = true;
                return;
            }
        }
        internal async Task <bool> removeMoneyAsync(int price)
        {
            var dbChar   = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(c => c.ownerObjId == this.uid);
            var oldMoney = dbChar.moneyHand;

            dbChar.moneyHand -= price;
            if (dbChar.moneyHand < 0)
            {
                dbChar.moneyHand = oldMoney;
                await NotifyHandler.SendNotification(this, "Du hast nicht genug Geld!");

                return(false);
            }

            await Main.database.CharacterCollection.ReplaceOneAsync(c => c.ownerObjId == this.uid, dbChar);

            await this.UpdateMoneyHud(dbChar.moneyHand);

            return(true);
        }
Exemple #11
0
        public Task OnColShape(IColShape colShape, IEntity entity, bool state)
        {
            if (state == false)
            {
                return(Task.CompletedTask);
            }
            if (entity is IPlayer)
            {
                var player = entity as User;
                if (!player.IsInVehicle)
                {
                    return(Task.CompletedTask);
                }
                NotifyHandler.SendNotification(player, "Verlasse dieses Gebiet innerhalb von 10 Sekunden", 10000);
            }

            if (entity is IVehicle)
            {
                var veh = entity as Car;
                Console.WriteLine("Create Timer");
                var EmpTimer = new Timer();
                EmpTimer.Interval = 10000;
                EmpTimer.Enabled  = true;
                EmpTimer.Elapsed += (sender, args) =>
                {
                    Console.WriteLine("Timer elapsed");

                    if (!veh.Position.IsInRange(colShape.Position, 200f))
                    {
                        EmpTimer.Dispose();
                        return;
                    }
                    ;
                    Console.WriteLine("Veh inside!");
                    EmpTimer.Dispose();
                    veh.SetNetworkOwner(veh.Driver, false);
                    veh.Driver.Emit("NetOwner:DestroyVehicle", veh);
                };
            }
            return(Task.CompletedTask);
        }
Exemple #12
0
        public Task revive_CMD(User player, int targetId)
        {
            if (!player.isAduty || player.adminLevel < 5)
            {
                return(Task.CompletedTask);
            }
            var playerpool = Alt.GetAllPlayers();

            foreach (User p in playerpool)
            {
                if (p.playerId != targetId)
                {
                    continue;
                }
                p.Spawn(p.Position, 0);
                NotifyHandler.SendNotification(p, "Du wurdest von einem Admin wiederbelebt!");
            }


            return(Task.CompletedTask);
        }
Exemple #13
0
        public async Task pwset_CMD(User player, string username, string password)
        {
            if (!player.isAduty)
            {
                return;
            }
            var dbUser = Utils.Utils.GetDatabasePlayer(player);

            if (dbUser.adminLevel != 9)
            {
                return;
            }
            var wantedUser = Main.database.UserCollection.AsQueryable().FirstOrDefault(u => u.Username.ToLower() == username.ToLower());

            if (wantedUser == null)
            {
                return;
            }
            wantedUser.Password = BCrypt.Net.BCrypt.HashString(password);
            Main.database.UserCollection.ReplaceOne(u => u.Username.ToLower() == username.ToLower(), wantedUser);
            await NotifyHandler.SendNotification(player, "Du hast das Passwort von " + username + " erfolgreich geändert!");
        }
        public async Task givekey_CMD(User player, string str_playerid)
        {
            int playerid = int.Parse(str_playerid);

            if (!player.Vehicle.Exists)
            {
                await NotifyHandler.SendNotification(player, "Du sitzt in keinem Auto!");

                return;
            }
            var playerVehicle = (Car)player.Vehicle;
            var dbCar         = Main.database.CarCollection.AsQueryable().ToList().FirstOrDefault(c => c.carId == playerVehicle.carId);

            if (dbCar.allowedIds.Contains(playerid))
            {
                await NotifyHandler.SendNotification(player, "Dieser Spieler hat bereits einen Schlüssel!");

                return;
            }
            dbCar.allowedIds.Add(playerid);
            playerVehicle.allowedIds.Add(playerid);
            await Main.database.CarCollection.ReplaceOneAsync(c => c.carId == playerVehicle.carId, dbCar);
        }
        public async Task ClientStartInteract(User player)
        {
            var dbChar             = Utils.Utils.GetDatabaseCharacter(player);
            var buergerBuero       = BuergerBueros.buergerBueroList.ToList().FirstOrDefault(x => player.Position.IsInRange(x.pos, 1.5f));
            var vehShop            = ServerNPCS.ServerNPCList.ToList().FirstOrDefault(x => player.Position.IsInRange(x.pos, 1.5f));
            var atm                = ATMS.atmInteractions.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.Position), 1.5f));
            var garage             = GarageInteractions.garageList.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.Pos), 1.5f));
            var itemshop           = itemShopInteraction.shopList.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.Pos), 2f));
            var paintball          = paintballInteraction.paintballNPCs.ToList().FirstOrDefault(x => player.Position.IsInRange(x.pos, 2f));
            var tankstelle         = fuelStationInteract.fuelStationList.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.Pos), 20f));
            var kleidershop        = ClothingStoreInteraction.clothingStores.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.Pos), 5f));
            var feld               = feldInteraction.feldListe.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.pos), x.radius));
            var fraknpc            = FrakNPCInteraction.frakNPCList.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.Pos), 3f));
            var carshop            = VehShopInteraction.vehShops.ToList().FirstOrDefault(x => player.Position.IsInRange(ATMS.atmInteraction.toAltPos(x.Pos), 2f));
            var frakGarage         = FrakGarageInteraction.frakGarages.ToList().FirstOrDefault(x => player.Position.IsInRange(x.Pos.ToAltPos(), 2.5f));
            var ammunation         = AmmunationInteraction.AmmunationList.ToList().FirstOrDefault(x => player.Position.IsInRange(x.Pos.ToAltPos(), 2.5f));
            var kleiderschrank     = KleiderSchrankInteraction.KlederSchränke.ToList().FirstOrDefault(x => player.Position.IsInRange(x.Position.ToAltPos(), x.Range));
            var jumppoint          = JumpPointInteraction.JumpPointList.ToList().FirstOrDefault(x => player.Position.IsInRange(x.Position.ToAltPos(), 2f));
            var frakkleiderschrank = FrakKleiderSchrankInteraction.KlederSchränke.ToList().FirstOrDefault(x => player.Position.IsInRange(x.Position.ToAltPos(), 2f));
            var itemproducer       = ItemProductionInteraction.ItemProductionList.ToList().FirstOrDefault(x => player.Position.IsInRange(x.Position.ToAltPos(), 5f));

            if (buergerBuero != null)
            {
                player.Emit("client:cef:loadBürgerBüro", true);
            }
            if (vehShop != null)
            {
            }
            if (atm != null)
            {
                var konto = Main.database.BankCollection.AsQueryable().FirstOrDefault(k => k.objectOwnerId == dbChar.id);
                player.Emit("client:cef:loadAtm", konto.kontoPin, konto.kontoStand);
            }
            if (garage != null)
            {
                #region Fetch parked in cars
                var carPool = Main.database.CarCollection.AsQueryable().ToList();
                var cars    = new List <Carcollection>();
                foreach (var car in carPool)
                {
                    if (car.ownerId == dbChar.playerId && car.parkedIn && car.garageId == garage.garageId || car.allowedIds.Contains(dbChar.playerId) && car.parkedIn && car.garageId == garage.garageId)
                    {
                        var tempCar = new Carcollection()
                        {
                            carmodel = car.carmodel,
                            numPlate = car.numPlate,
                            carId    = car.carId,
                            parkedIn = true
                        };
                        cars.Add(tempCar);
                    }
                }

                #endregion
                #region Fetch cars nearby
                var carpool = Alt.GetAllVehicles();
                // ReSharper disable once PossibleInvalidCastExceptionInForeachLoop
                foreach (Car car in carpool)
                {
                    if (car.frakId > 0)
                    {
                        continue;
                    }

                    if (car.Position.IsInRange(ATMS.atmInteraction.toAltPos(garage.Pos), 30f))
                    {
                        if (car.frakId != 0)
                        {
                            continue;
                        }
                        if (car.carId == 0)
                        {
                            continue;
                        }
                        if (car.ownerId == dbChar.playerId || car.allowedIds.Contains(dbChar.playerId))
                        {
                            var listCar = new Carcollection()
                            {
                                carmodel = car.carmodel,
                                numPlate = car.numPlate,
                                objectId = car.objectId,
                                parkedIn = false
                            };
                            cars.Add(listCar);
                        }
                    }
                }
                var carList = JsonConvert.SerializeObject(cars);
                player.Emit("client:cef:hud:loadgarage", carList, garage.garageId);
                #endregion
            }
            if (itemshop != null)
            {
                var itemList = new List <itemShopInteraction.ShopClientItem>();

                var shopItems = itemshop.shopItems;
                foreach (var item in shopItems)
                {
                    var dbItem  = Main.database.ItemCollection.AsQueryable().FirstOrDefault(i => i.itemId == item);
                    var newItem = new itemShopInteraction.ShopClientItem()
                    {
                        name = dbItem.name, price = dbItem.price.Value, itemId = dbItem.itemId
                    };
                    itemList.Add(newItem);
                }
                player.Emit("client:cef:loadItemShop", JsonConvert.SerializeObject(itemList), itemshop.shopId);
            }
            if (paintball != null)
            {
                var arenaList = Main.database.PaintballCollection.AsQueryable().ToList();
                player.Emit("client:cef:loadPaintball", JsonConvert.SerializeObject(arenaList));
            }

            if (tankstelle != null)
            {
                var vehicle = (Car)player.Vehicle;
                if (player.IsInVehicle)
                {
                    player.Emit("client:hud:showGasstation", vehicle.carId);
                }
            }

            if (kleidershop != null)
            {
                List <ClothesCollection> kleiderListe = new List <ClothesCollection>();

                switch (kleidershop.storeType)
                {
                case 1:
                    kleiderListe = Utils.Utils.Clothes.ponsonList.Where(c => int.Parse(c.gender) == player.sex || int.Parse(c.gender) == 3).ToList();
                    break;

                case 2:
                    kleiderListe = Utils.Utils.Clothes.suburbanList.Where(c => int.Parse(c.gender) == player.sex || int.Parse(c.gender) == 3).ToList();
                    break;

                case 3:
                    kleiderListe = Utils.Utils.Clothes.discountList.Where(c => int.Parse(c.gender) == player.sex || int.Parse(c.gender) == 3).ToList();
                    break;
                }


                var itemCount  = (int)kleiderListe.Count;
                var iterations = Math.Floor((decimal)(itemCount / 200));
                var rest       = itemCount % 200;
                for (var i = 0; i < iterations; i++)
                {
                    var skip = i * 200;
                    player.Emit("client:loadClothesStore", JsonConvert.SerializeObject(kleiderListe.Skip(skip).Take(200).ToList()));
                }
                if (rest != 0)
                {
                    player.Emit("client:loadClothesStore", JsonConvert.SerializeObject(kleiderListe.Skip((int)iterations * 200).ToList()));
                }
            }

            if (feld != null)
            {
                player.Emit("client:feld:farmen", feld.id);
            }

            if (fraknpc != null)
            {
                if (player.frakId != fraknpc.frakId)
                {
                    await NotifyHandler.SendNotification(player, $"({fraknpc.frakId}) Keine Rechte!");

                    return;
                }

                var itemList = new List <itemShopInteraction.ShopClientItem>();

                var shopItems = fraknpc.frakShopItems;
                foreach (var item in shopItems)
                {
                    var dbItem  = Main.database.ItemCollection.AsQueryable().FirstOrDefault(i => i.itemId == item.itemId);
                    var newItem = new itemShopInteraction.ShopClientItem()
                    {
                        name = dbItem.name, price = item.itemPrice, itemId = item.itemId
                    };
                    itemList.Add(newItem);
                }
                player.Emit("client:loadFrakShop", JsonConvert.SerializeObject(itemList), fraknpc.frakId);
            }

            if (carshop != null)
            {
                player.Emit("client:loadCarDealer", JsonConvert.SerializeObject(carshop.Cars), carshop.Id);
            }

            if (frakGarage != null)
            {
                if (player.frakId != frakGarage.FrakId)
                {
                    await NotifyHandler.SendNotification(player, $"Keine Rechte [{frakGarage.FrakId}]");

                    return;
                }
                var carPool = Main.database.FrakcarCollection.AsQueryable().ToList();
                var cars    = new List <frakCarCollection>();
                foreach (var car in carPool)
                {
                    if (car.frakId == dbChar.frakId && car.parkedIn && car.garageId == frakGarage.Id)
                    {
                        var tempCar = new frakCarCollection()
                        {
                            carmodel = car.carmodel,
                            numPlate = car.numPlate,
                            carId    = car.carId,
                            parkedIn = true
                        };
                        cars.Add(tempCar);
                    }
                }
                var carpool = Alt.GetAllVehicles();
                foreach (Car car in carpool)
                {
                    if (car.Position.IsInRange(ATMS.atmInteraction.toAltPos(frakGarage.Pos), 30f))
                    {
                        if (car.frakId != frakGarage.FrakId)
                        {
                            continue;
                        }
                        if (car.carId == 0)
                        {
                            continue;
                        }
                        if (car.frakId == dbChar.frakId)
                        {
                            var listCar = new frakCarCollection()
                            {
                                numPlate = car.numPlate,
                                carmodel = car.carmodel,
                                parkedIn = false,
                                carId    = car.carId
                            };
                            cars.Add(listCar);
                        }
                    }
                }

                var carList = JsonConvert.SerializeObject(cars);

                player.Emit("client:cef:hud:loadfrakgarage", carList, dbChar.frakId);
            }

            if (ammunation != null)
            {
                var itemList = new List <itemShopInteraction.ShopClientItem>();
                foreach (var item in ammunation.Inventory)
                {
                    var dbItem  = Main.database.ItemCollection.AsQueryable().FirstOrDefault(i => i.itemId == item.ItemId);
                    var newItem = new itemShopInteraction.ShopClientItem()
                    {
                        name = dbItem.name, price = item.Price, itemId = item.ItemId
                    };
                    itemList.Add(newItem);
                }

                Console.WriteLine($"AmmoID: {ammunation.Id}");
                player.Emit("client:loadAmmunation", JsonConvert.SerializeObject(itemList), ammunation.Id);
            }

            if (kleiderschrank != null)
            {
                //Get Player Clothing

                var clothing = new List <ClientClothing>();

                var ownedClothing = dbChar.OwnedClothes;
                if (player.sex == 1)
                {
                    clothing.Add(new ClientClothing()
                    {
                        ComponentId = 8, ColorId = 0, DrawableId = 57, ClothId = 11586, Name = "Kein Undershirt"
                    });
                }
                if (player.sex == 0)
                {
                    clothing.Add(new ClientClothing()
                    {
                        ComponentId = 8, ColorId = 0, DrawableId = 34, ClothId = 2393, Name = "Kein Undershirt"
                    });
                }


                foreach (var cloth in ownedClothing)
                {
                    var dbCloth = Main.database.ClothesCollection.AsQueryable()
                                  .FirstOrDefault(c => c.clothId == cloth.ToString());

                    var newcloth = new ClientClothing()
                    {
                        ComponentId = int.Parse(dbCloth.componentId), ColorId = int.Parse(dbCloth.colorId), DrawableId = int.Parse(dbCloth.drawableId), ClothId = int.Parse(dbCloth.clothId)
                    };
                    clothing.Add(newcloth);
                }

                foreach (var torso in Main.database.ClothesCollection.AsQueryable().Where(c => c.componentId == "3").Where(c => c.gender == player.sex.ToString()))
                {
                    var newcloth = new ClientClothing()
                    {
                        ComponentId = int.Parse(torso.componentId), ColorId = int.Parse(torso.colorId), DrawableId = int.Parse(torso.drawableId), ClothId = int.Parse(torso.clothId)
                    };
                    clothing.Add(newcloth);
                }

                player.Emit("client:openCloset", JsonConvert.SerializeObject(clothing));
            }

            if (jumppoint != null)
            {
                player.Position = jumppoint.TargetPosition.ToAltPos();
            }

            if (frakkleiderschrank != null)
            {
                var clothing = new List <ClientClothing>();
                if (player.sex == 1)
                {
                    clothing.Add(new ClientClothing()
                    {
                        ComponentId = 8, ColorId = 0, DrawableId = 57, ClothId = 11586, Name = "Kein Undershirt"
                    });
                    clothing.Add(new ClientClothing()
                    {
                        PropId = 0, ColorId = 0, DrawableId = 8, ClothId = 15035, Name = "Keine Kopfbedeckung"
                    });
                }

                if (player.sex == 0)
                {
                    clothing.Add(new ClientClothing()
                    {
                        ComponentId = 8, ColorId = 0, DrawableId = 34, ClothId = 2393, Name = "Kein Undershirt"
                    });
                    clothing.Add(new ClientClothing()
                    {
                        PropId = 0, ColorId = 0, DrawableId = 57, ClothId = 15036, Name = "Keine Kopfbedeckung"
                    });
                }
                clothing.Add(new ClientClothing()
                {
                    ComponentId = 7, ColorId = 0, DrawableId = 0, ClothId = 15034, Name = "Kein Accessoir"
                });
                clothing.Add(new ClientClothing()
                {
                    ComponentId = 9, ColorId = 0, DrawableId = 0, ClothId = 15030, Name = "Keine Weste"
                });
                clothing.Add(new ClientClothing()
                {
                    ComponentId = 1, ColorId = 0, DrawableId = 0, ClothId = 15033, Name = "Keine Maske"
                });

                var ownedClothing = dbChar.OwnedClothes;


                foreach (var cloth in ownedClothing)
                {
                    var dbCloth = Utils.Utils.CachedColthing
                                  .FirstOrDefault(c => c.clothId == cloth.ToString());

                    var newcloth = new ClientClothing()
                    {
                        ComponentId = int.Parse(dbCloth.componentId), ColorId = int.Parse(dbCloth.colorId), DrawableId = int.Parse(dbCloth.drawableId), ClothId = int.Parse(dbCloth.clothId)
                    };
                    clothing.Add(newcloth);
                }

                foreach (var torso in Utils.Utils.CachedColthing.Where(c => c.componentId == "3").Where(c => c.gender == player.sex.ToString()))
                {
                    var newcloth = new ClientClothing()
                    {
                        ComponentId = int.Parse(torso.componentId), ColorId = int.Parse(torso.colorId), DrawableId = int.Parse(torso.drawableId), ClothId = int.Parse(torso.clothId)
                    };
                    clothing.Add(newcloth);
                }

                foreach (var frakClothing in frakkleiderschrank.Clothing)
                {
                    var dbCloth = Utils.Utils.CachedColthing
                                  .FirstOrDefault(c => c.clothId == frakClothing.ToString());

                    if (dbCloth.gender.ToLower() != player.sex.ToString().ToLower() && dbCloth.gender.ToLower() != "3")
                    {
                        continue;
                    }
                    if (string.IsNullOrEmpty(dbCloth.componentId) && string.IsNullOrEmpty(dbCloth.propId))
                    {
                        continue;
                    }
                    if (!string.IsNullOrEmpty(dbCloth.componentId))
                    {
                        var newcloth = new ClientClothing()
                        {
                            ComponentId = int.Parse(dbCloth.componentId), ColorId = int.Parse(dbCloth.colorId), DrawableId = int.Parse(dbCloth.drawableId), ClothId = int.Parse(dbCloth.clothId), Name = dbCloth.name
                        };
                        clothing.Add(newcloth);
                    }
                    else if (!string.IsNullOrEmpty(dbCloth.propId))
                    {
                        var newprop = new ClientClothing()
                        {
                            PropId = int.Parse(dbCloth.propId), ColorId = int.Parse(dbCloth.colorId), DrawableId = int.Parse(dbCloth.drawableId), ClothId = int.Parse(dbCloth.clothId), Name = dbCloth.name
                        };
                        clothing.Add(newprop);
                    }
                }
                Console.WriteLine($"OpenCloset {clothing.Count}");
                player.Emit("client:openCloset", JsonConvert.SerializeObject(clothing), player.sex);
            }

            if (itemproducer != null)
            {
                Console.WriteLine("found itemproducer");

                var dbchar       = Utils.Utils.GetDatabaseCharacter(player);
                var dbItemInput  = Main.database.ItemCollection.AsQueryable().FirstOrDefault(i => i.itemId == itemproducer.NeededItemId);
                var dbItemOutput = Main.database.ItemCollection.AsQueryable().FirstOrDefault(i => i.itemId == itemproducer.OutComeItemId);
                var producerData = new
                {
                    Name       = itemproducer.Name,
                    Id         = itemproducer.Id,
                    CurrentIn  = dbchar.ItemVerarbeiter.CurrentIn,
                    CurrentOut = dbchar.ItemVerarbeiter.CurrentOut,
                    InputId    = itemproducer.NeededItemId,
                    OutputId   = itemproducer.OutComeItemId,
                    InputName  = dbItemInput.name,
                    OutputName = dbItemOutput.name
                };

                player.Emit("client:openProducer", JsonConvert.SerializeObject(producerData));
            }
        }
 public async Task myid_CMD(User player)
 {
     var dbchar = Utils.Utils.GetDatabaseCharacter(player);
     await NotifyHandler.SendNotification(player, $"Deine ID: {dbchar.playerId}");
 }