private void ParkOutVehicleEvent(Client client, string eventName, object[] arguments) { CloseWindow(client); int id = Convert.ToInt32(arguments[0]); var garage = Garages.FirstOrDefault(x => x.Position.FromJson <Vector3>().DistanceTo(client.position) <= 2f); if (garage == null) { return; } GarageParkOutSpot foundSpot = null; foreach (GarageParkOutSpot spot in garage.ParkOutSpots) { if (OwnedVehicleController.IsAnyVehicleBlockingThisArea(spot.Position, spot.Radius)) { continue; } else { foundSpot = spot; break; } } if (foundSpot != null) { OwnedVehicleController.ParkOutVehicle(id, foundSpot.Position, foundSpot.Rotation); client.sendColoredNotification("Das Fahrzeug wurde erfolgreich ausgeparkt.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN); } else { client.sendColoredNotification("Es wurde kein freier Parkplatz gefunden..", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED); } }
private void ParkInGarageEvent(Client client, string eventName, object[] arguments) { CloseWindow(client); var garage = Garages.FirstOrDefault(x => x.Position.FromJson <Vector3>().DistanceTo(client.position) <= 2f); if (garage == null) { client.sendColoredNotification("Du bist zu weit von einer Garage entfernt..", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED); return; } if (garage.ParkOutSpots.Count == 0) { client.sendColoredNotification($"Es wurde kein Ausparkpunkt gefunden.. Melde dies einem Admin ({garage.Id})", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED); return; } OwnedVehicle vehicle = OwnedVehicleController.ExistingVehicles.FirstOrDefault(x => client.Account().CurrentCharacter.KeyRing.VehicleKeys.Keys.ToList().Contains(x.Id) && x.Handle.position.DistanceTo(garage.ParkInSpots[0].Position) <= garage.ParkInSpots[0].Radius); if (vehicle == null) { client.sendColoredNotification("Es wurde kein einparkbares Fahrzeug gefunden..", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED); return; } OwnedVehicleController.ParkVehicle(vehicle, garage.Id, false); client.sendColoredNotification("Das Fahrzeug wurde erfolgreich eingeparkt.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN); }
private void InteractionController_OnPlayerInteractOnFoot(object sender, Client e) { var garage = Garages.FirstOrDefault(x => x.Position.FromJson <Vector3>().DistanceTo(e.position) <= 1f); if (garage == null) { return; } OpenParkOverviewWindow(e, garage); }
private void ParkOutGarageEvent(Client client, string eventName, object[] arguments) { Character ch = client.Account().CurrentCharacter; var garage = Garages.FirstOrDefault(x => x.Position.FromJson <Vector3>().DistanceTo(client.position) <= 1f); if (garage == null) { return; } List <GarageVehicleList> list = new List <GarageVehicleList>(); List <OwnedVehicle> vehicles = new List <OwnedVehicle>(); using (var db = new Database()) { vehicles = db.OwnedVehicles.Where(x => ch.KeyRing.VehicleKeys.Keys.ToList().Contains(x.Id) && x.InGarage && x.CanParkOutEverywhere || ch.KeyRing.VehicleKeys.Keys.ToList().Contains(x.Id) && !x.CanParkOutEverywhere && garage.Id == x.LastGarageId).ToList(); } foreach (OwnedVehicle vehicle in vehicles) { list.Add(new GarageVehicleList { Id = vehicle.Id.ToString(), Title = vehicle.ModelName }); } if (list.Count == 0) { list.Add(new GarageVehicleList { Id = "0", Title = "Es wurden keine Fahrzeuge gefunden.." }); } client.triggerEvent("showBrowser", Constants.GarageParkOutListUrl, "FillWindow", JsonConvert.SerializeObject(list)); }