Nicht als Beifahrer + Nicht an aus an aus

This commit is contained in:
Mac_Slash
2020-04-28 20:32:38 +02:00
parent 5de5864c0f
commit 9ac064a5ea
2 changed files with 88 additions and 58 deletions

View File

@@ -6,6 +6,8 @@ using Newtonsoft.Json;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Database.Models;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Job
{
@@ -132,46 +134,58 @@ namespace ReallifeGamemode.Server.Job
[RemoteEvent("startBusRoute")]
public void StartBusRoute(Player player, string type)
{
if (type == "Kurz 1")
if (player.VehicleSeat == 0)
{
CheckPointHandle.StartCheckPointRoute(player, Route1, 3000, 1, 7, 5, "busDriverJob");
if (type == "Kurz 1")
{
CheckPointHandle.StartCheckPointRoute(player, Route1, 3000, 1, 7, 5, "busDriverJob");
}
else if (type == "Kurz 2")
{
CheckPointHandle.StartCheckPointRoute(player, Route2, 3000, 1, 7, 5, "busDriverJob");
}
else if (type == "Mittel 1")
{
CheckPointHandle.StartCheckPointRoute(player, Route3, 3000, 1, 7, 5, "busDriverJob");
}
else if (type == "Lang 1")
{
CheckPointHandle.StartCheckPointRoute(player, RouteLong, 3000, 1, 7, 5, "busDriverJob");
}
else if (type == "Lang 2")
{
CheckPointHandle.StartCheckPointRoute(player, RouteVeryLong, 3000, 1, 7, 5, "busDriverJob");
}
}
else if (type == "Kurz 2")
{
CheckPointHandle.StartCheckPointRoute(player, Route2, 3000, 1, 7, 5, "busDriverJob");
}
else if (type == "Mittel 1")
{
CheckPointHandle.StartCheckPointRoute(player, Route3, 3000, 1, 7, 5, "busDriverJob");
}
else if (type == "Lang 1")
{
CheckPointHandle.StartCheckPointRoute(player, RouteLong, 3000, 1, 7, 5, "busDriverJob");
}
else if (type == "Lang 2")
{
CheckPointHandle.StartCheckPointRoute(player, RouteVeryLong, 3000, 1, 7, 5, "busDriverJob");
}
}
public static void payWage(Player jobber, int wage)
{
using (var dbContext = new DatabaseContext())
{
jobber.GetUser(dbContext).BankAccount.Balance += wage;
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen.");
jobber.GetUser(dbContext).BusSkill++;
dbContext.SaveChanges();
if (jobber.GetUser(dbContext).BusSkill == 300)
if (jobber.VehicleSeat == 0)
{
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 2 ~w~erreicht!");
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt auch mit dem Coach-Bus fahren!");
jobber.GetUser(dbContext).BankAccount.Balance += wage;
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen.");
jobber.GetUser(dbContext).BusSkill++;
dbContext.SaveChanges();
if (jobber.GetUser(dbContext).BusSkill == 300)
{
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 2 ~w~erreicht!");
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt auch mit dem Coach-Bus fahren!");
}
if (jobber.GetUser(dbContext).BusSkill == 800)
{
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 3 ~w~erreicht!");
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt mit dem Coach, und dem Tourbus fahren!");
}
}
if (jobber.GetUser(dbContext).BusSkill == 800)
else
{
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 3 ~w~erreicht!");
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt mit dem Coach, und dem Tourbus fahren!");
JobBase job = JobManager.GetJob(jobber.GetUser().JobId.Value);
job.StopJob(jobber);
CheckPointHandle.DeleteCheckpoints(jobber);
ChatService.SendMessage(jobber, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
}
//BusLetzterCheckpoint(jobber);
//BusDriverJob rt = null;

View File

@@ -5,6 +5,9 @@ using ReallifeGamemode.Server.Util;
using Newtonsoft.Json;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Job
{
class PilotJob : JobBase
@@ -139,43 +142,56 @@ namespace ReallifeGamemode.Server.Job
[RemoteEvent("startPilotRoute")]
public void StartPilotRoute(Player player, string type)
{
if (type == "Route 1")
if (player.VehicleSeat == 0)
{
CheckPointHandle.StartCheckPointRoute(player, Route1, 0, 6, 40, 40, "pilotJob"); //6, 23, 25, 26, 27, 28
}
else if (type == "Route 2")
{
CheckPointHandle.StartCheckPointRoute(player, Route2, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 3")
{
CheckPointHandle.StartCheckPointRoute(player, Route3, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 4")
{
CheckPointHandle.StartCheckPointRoute(player, Route4, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 5")
{
CheckPointHandle.StartCheckPointRoute(player, Route5, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 6")
{
CheckPointHandle.StartCheckPointRoute(player, Route6, 0, 6, 40, 40, "pilotJob");
if (type == "Route 1")
{
CheckPointHandle.StartCheckPointRoute(player, Route1, 0, 6, 40, 40, "pilotJob"); //6, 23, 25, 26, 27, 28
}
else if (type == "Route 2")
{
CheckPointHandle.StartCheckPointRoute(player, Route2, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 3")
{
CheckPointHandle.StartCheckPointRoute(player, Route3, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 4")
{
CheckPointHandle.StartCheckPointRoute(player, Route4, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 5")
{
CheckPointHandle.StartCheckPointRoute(player, Route5, 0, 6, 40, 40, "pilotJob");
}
else if (type == "Route 6")
{
CheckPointHandle.StartCheckPointRoute(player, Route6, 0, 6, 40, 40, "pilotJob");
}
}
}
public static void payWage(Player jobber, int wage)
{
using (var dbContext = new DatabaseContext())
{
jobber.GetUser(dbContext).BankAccount.Balance += wage;
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen.");
jobber.GetUser(dbContext).PilotSkill++;
dbContext.SaveChanges();
if (jobber.GetUser(dbContext).PilotSkill == 300)
if (jobber.VehicleSeat == 0)
{
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 2 ~w~erreicht!");
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt auch mit dem Velum Flugzeug (LS Airport) fliegen!");
jobber.GetUser(dbContext).BankAccount.Balance += wage;
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen.");
jobber.GetUser(dbContext).PilotSkill++;
dbContext.SaveChanges();
if (jobber.GetUser(dbContext).PilotSkill == 300)
{
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 2 ~w~erreicht!");
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt auch mit dem Velum Flugzeug (LS Airport) fliegen!");
}
}
else
{
JobBase job = JobManager.GetJob(jobber.GetUser().JobId.Value);
job.StopJob(jobber);
CheckPointHandle.DeleteCheckpoints(jobber);
ChatService.SendMessage(jobber, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
}
}
}