public void DeleteCarshop(Client sender) { if (!sender.HasRank(ServerRank.AdministratorRozgrywki2)) { sender.SendWarning("Nie posiadasz uprawnień do usuwania salonu samochodowego."); return; } if (Carshops.Count == 0) { sender.SendWarning("Nie znaleziono salonu pojazdów który można usunąć."); return; } CarshopEntity carshop = Carshops.First(x => x.ColShape.IsPointWithin(sender.Position)); if (XmlHelper.TryDeleteXmlObject(carshop.Data.FilePath)) { sender.SendInfo("Usuwanie salonu zakończyło się pomyślnie"); Carshops.Remove(carshop); carshop.Dispose(); } else { sender.SendError("Usuwanie salonu zakończyło się niepomyślnie."); } }
private void OnResourceStart() { Vehicles = XmlHelper.GetXmlObjects <CarshopVehicleModel>( Path.Combine(Utils.XmlDirectory, "CarshopVehicles")); //Vehicles.AddRange(new List<CarshopVehicleModel> //{ // //Używane // //Rahapsody // //Blista2 // //Do zrobienia // //CogCabrio // //Oracle2 // //Sentinel2 // //Windsor2 // //Kompaktowe // new CarshopVehicleModel("Blista", VehicleHash.Blista, VehicleClass.Compact, new decimal(17999), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Brioso", VehicleHash.Brioso, VehicleClass.Compact, new decimal(21999), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Dilettante", VehicleHash.Dilettante, VehicleClass.Compact, new decimal(12000), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Issi", VehicleHash.Issi2, VehicleClass.Compact, new decimal(25000), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Panto", VehicleHash.Panto, VehicleClass.Compact, new decimal(10000), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Prairie", VehicleHash.Prairie, VehicleClass.Compact, new decimal(22000), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // //Coupe // new CarshopVehicleModel("Exemplar", VehicleHash.Exemplar, VehicleClass.Coupe, new decimal(190000), new List<CarshopType>() {CarshopType.Luxury}), // new CarshopVehicleModel("F620", VehicleHash.F620, VehicleClass.Coupe, new decimal(151999), new List<CarshopType>() {CarshopType.Luxury}), // new CarshopVehicleModel("Felon", VehicleHash.Felon2, VehicleClass.Coupe, new decimal(158999), new List<CarshopType>() {CarshopType.Luxury}), // new CarshopVehicleModel("Jackal", VehicleHash.Jackal, VehicleClass.Coupe, new decimal(31000), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("Oracle", VehicleHash.Oracle, VehicleClass.Coupe, new decimal(21000), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("Sentinel", VehicleHash.Sentinel, VehicleClass.Coupe, new decimal(40000), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("Windsor", VehicleHash.Windsor, VehicleClass.Coupe, new decimal(220000), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("Zion", VehicleHash.Zion, VehicleClass.Coupe, new decimal(32000), new List<CarshopType>() {CarshopType.Medium}), // //SUV // new CarshopVehicleModel("BeeJay XL", VehicleHash.BJXL, VehicleClass.Suv, new decimal(16999), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Baller I", VehicleHash.Baller, VehicleClass.Suv, new decimal(14999), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Baller II", VehicleHash.Baller2, VehicleClass.Suv, new decimal(51000), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("Cavalcade I", VehicleHash.Cavalcade, VehicleClass.Suv, new decimal(26000), new List<CarshopType>() {CarshopType.Poor, CarshopType.Medium}), // new CarshopVehicleModel("Cavalcade II", VehicleHash.Cavalcade2, VehicleClass.Suv, new decimal(71000), new List<CarshopType>() {CarshopType.Medium, CarshopType.Luxury}), // new CarshopVehicleModel("Dubsta", VehicleHash.Dubsta2, VehicleClass.Suv, new decimal(56999), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("FQ2", VehicleHash.FQ2, VehicleClass.Suv, new decimal(52000), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("Granger", VehicleHash.Granger, VehicleClass.Suv, new decimal(61799), new List<CarshopType>() {CarshopType.Medium}), // new CarshopVehicleModel("Gresley", VehicleHash.Gresley, VehicleClass.Suv, new decimal(56999), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Habanero", VehicleHash.Gresley, VehicleClass.Suv, new decimal(68799), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Huntley S", VehicleHash.Huntley, VehicleClass.Suv, new decimal(72699), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Landstalker", VehicleHash.Landstalker, VehicleClass.Suv, new decimal(41899), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Patriot", VehicleHash.Patriot, VehicleClass.Suv, new decimal(78999), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Radius", VehicleHash.Radi, VehicleClass.Suv, new decimal(36999), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Rocoto", VehicleHash.Rocoto, VehicleClass.Suv, new decimal(98000), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Seminole", VehicleHash.Seminole, VehicleClass.Suv, new decimal(64999), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("Serrano", VehicleHash.Serrano, VehicleClass.Suv, new decimal(28999), new List<CarshopType>() { CarshopType.Medium }), // new CarshopVehicleModel("XLS", VehicleHash.XLS, VehicleClass.Suv, new decimal(54999), new List<CarshopType>() {CarshopType.Medium}), // //Sedany //}); //Tworzenie salonow dla każdego pliku XML XmlHelper.GetXmlObjects <CarshopModel>(Path.Combine(Utils.XmlDirectory, "Carshops")) .ForEach(carshopModel => { CarshopEntity carshop = new CarshopEntity(carshopModel); carshop.Spawn(); Carshops.Add(carshop); }); }