Anfang Bussystem + Skill

This commit is contained in:
Mac_Slash
2020-04-27 12:54:19 +02:00
parent 78ccd9a314
commit 929344c1c3
4 changed files with 125 additions and 8 deletions

View File

@@ -3,6 +3,9 @@ using System.Collections.Generic;
using GTANetworkAPI;
using ReallifeGamemode.Server.Util;
using Newtonsoft.Json;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Database.Models;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace ReallifeGamemode.Server.Job
{
@@ -154,7 +157,67 @@ namespace ReallifeGamemode.Server.Job
public static void payWage(Player jobber, int wage)
{
using (var dbContext = new DatabaseContext())
{
jobber.GetUser(dbContext).BankAccount.Balance += wage;
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!");
}
jobber.GetUser(dbContext).BusSkill++;
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen.");
dbContext.SaveChanges();
}
}
public void BusLetzterCheckpoint(Player player)
{
Vehicle v = player.Vehicle;
if (v.Model == (uint)Types.VehicleModel.Bus)
{
Random rnd = new Random();
int rroute = rnd.Next(1, 3);
switch (rroute)
{
case 1:
{
StartBusRoute(player, "Kurz 1");
break;
}
case 2:
{
StartBusRoute(player, "Kurz 2");
break;
}
}
}
if (v.Model == (uint)Types.VehicleModel.Coach)
{
Random rnd = new Random();
int rroute = rnd.Next(1, 3);
switch (rroute)
{
case 1:
{
StartBusRoute(player, "Lang 1");
break;
}
case 2:
{
StartBusRoute(player, "Lang 2");
break;
}
}
}
if (v.Model == (uint)Types.VehicleModel.Tourbus)
{
StartBusRoute(player, "Mittel 1");
}
}
}
}