public static async Task ClassEndMissionAsync(Player player) { switch (player.PlayerClass) { case PlayerClassType.TruckDriver: await TruckerController.EndMissionAsync(player); break; case PlayerClassType.BusDriver: BusDriverController.EndMission(player); break; case PlayerClassType.Pilot: PilotController.EndMission(player); break; case PlayerClassType.Police: PoliceController.EndMission(player); break; case PlayerClassType.Mafia: await MafiaController.EndMissionAsync(player); break; case PlayerClassType.Assistance: AssistanceController.EndMission(player); break; } }
private void Class_PlayerSpawned(object sender, SpawnEventArgs e) { if (!(sender is Player player)) { return; } switch (player.PlayerClass) { case PlayerClassType.TruckDriver: player.Color = PlayerClassColor.TruckerColor; break; case PlayerClassType.BusDriver: player.Color = PlayerClassColor.BusDriverColor; break; case PlayerClassType.Pilot: player.Color = PlayerClassColor.PilotColor; break; case PlayerClassType.Police: player.Color = PlayerClassColor.PoliceColor; player.CheckTimer?.Dispose(); player.CheckTimer = new Timer(TimeSpan.FromSeconds(1), true); player.CheckTimer.Tick += (senderObject, ev) => PoliceController.PoliceCheckTimer_Tick(senderObject, ev, player); if (Configuration.Instance.CanPoliceHaveWeapons) { foreach (var weapon in Configuration.PoliceWeapons) { player.GiveWeapon(weapon, Configuration.Instance.PoliceWeaponsAmmo); } } break; case PlayerClassType.Mafia: player.Color = PlayerClassColor.MafiaColor; player.CheckTimer?.Dispose(); player.CheckTimer = new Timer(TimeSpan.FromSeconds(1), true); player.CheckTimer.Tick += (senderObject, ev) => MafiaController.MafiaCheckTimer_Tick(senderObject, ev, player); break; case PlayerClassType.Assistance: player.Color = PlayerClassColor.AssistanceColor; player.CheckTimer?.Dispose(); player.CheckTimer = new Timer(TimeSpan.FromSeconds(1), true); player.CheckTimer.Tick += (senderObject, ev) => AssistanceController.AssistanceCheckTimer_Tick(senderObject, ev, player); break; } }
public static void OnStartMissionCommand(Player sender) { if (sender.IsDoingMission) { sender.SendClientMessage(Color.Red, Messages.AlreadyDoingAMission); return; } if (!sender.IsDriving()) { sender.SendClientMessage(Color.Red, Messages.CommandAllowedOnlyAsDriver); return; } var playerVehicleModel = sender.Vehicle?.Model; switch (sender.PlayerClass) { case PlayerClassType.TruckDriver: var convoy = sender.Convoy; if (sender.IsInConvoy && convoy?.Members[0] != sender) { sender.SendClientMessage(Color.Red, "You are not the leader of the convoy, you can not start a job."); return; } var dialogTruckerMission = new ListDialog(Messages.MissionTruckerSelectMissionMethod, Messages.DialogButtonSelect, Messages.DialogButtonCancel); dialogTruckerMission.AddItem("Setup your own load and route\r\nAuto assigned load"); switch (playerVehicleModel) { case VehicleModelType.Flatbed: case VehicleModelType.DFT30: case VehicleModelType.CementTruck: if (sender.Account.TruckerLicense == 1) { dialogTruckerMission.Show(sender); } else { TruckerController.StartRandomMission(sender); } break; case VehicleModelType.Roadtrain: case VehicleModelType.Linerunner: case VehicleModelType.Tanker: if (sender.Vehicle.Trailer != null) { if (sender.Account.TruckerLicense == 1) { dialogTruckerMission.Show(sender); } else { TruckerController.StartRandomMission(sender); } } else { sender.SendClientMessage(Color.Red, Messages.MissionTruckerTrailerNeeded); return; } break; default: sender.SendClientMessage(Color.Red, "You need to be the driver of a trucking vehicle to start a mission."); break; } dialogTruckerMission.Response += TruckerController.MissionDialogResponse; break; case PlayerClassType.BusDriver: var dialogBusDriverMission = new ListDialog(Messages.MissionTruckerSelectMissionMethod, Messages.DialogButtonSelect, Messages.DialogButtonCancel); dialogBusDriverMission.AddItem("Choose your own busroute\r\nAuto assigned busroute"); var random = new Random(); switch (playerVehicleModel) { case VehicleModelType.Coach: case VehicleModelType.Bus: if (sender.Account.BusLicense == 1) { dialogBusDriverMission.Show(sender); } else { BusDriverController.StartMission(sender, BusRoute.BusRoutes[random.Next(BusRoute.BusRoutes.Count)]); } break; default: sender.SendClientMessage(Color.Red, "You need to be the driver of a bus to start a mission."); break; } dialogBusDriverMission.Response += BusDriverController.DialogBusDriverMission_Response; break; case PlayerClassType.Pilot: switch (playerVehicleModel) { case VehicleModelType.Nevada: case VehicleModelType.Shamal: case VehicleModelType.Maverick: case VehicleModelType.Cargobob: PilotController.StartRandomMission(sender); break; } break; case PlayerClassType.Mafia: switch (sender.Vehicle.Model) { case VehicleModelType.Sandking: case VehicleModelType.Moonbeam: MafiaController.StartRandomMission(sender); break; } break; } }