Added mileage, changed all namespaces from reallife_gamemode to ReallifeGamemode

This commit is contained in:
hydrant
2019-03-06 21:12:34 +01:00
parent 13142edbb7
commit bee3497fc3
104 changed files with 1408 additions and 297 deletions

View File

@@ -60,6 +60,17 @@ mp.events.add('render', () =>
outline: true, outline: true,
centre: false centre: false
}); });
var drivenDistance = player.vehicle.getVariable("drivenDistance");
var drivenDistanceStr = "0";
if (drivenDistance) drivenDistanceStr = parseFloat(drivenDistance).toFixed(3).toString();
mp.game.graphics.drawText(drivenDistanceStr + " KM", [0.48, 0.973], {
font: 0,
color: [255, 255, 255, 255],
scale: [0.35, 0.35],
outline: true,
centre: false
});
} }
else { else {
if (dictLoaded) { if (dictLoaded) {

View File

@@ -1,11 +1,11 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.Linq; using System.Linq;
namespace reallife_gamemode.Server.Business namespace ReallifeGamemode.Server.Business
{ {
public abstract class BusinessBase : IBankAccountOwner public abstract class BusinessBase : IBankAccountOwner
{ {

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Business namespace ReallifeGamemode.Server.Business
{ {
public abstract class CarDealerBusinessBase : BusinessBase public abstract class CarDealerBusinessBase : BusinessBase
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
namespace reallife_gamemode.Server.Business namespace ReallifeGamemode.Server.Business
{ {
public class ShopBusiness : BusinessBase public class ShopBusiness : BusinessBase
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
namespace reallife_gamemode.Server.Business namespace ReallifeGamemode.Server.Business
{ {
public class TelefonBusiness : BusinessBase public class TelefonBusiness : BusinessBase
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
namespace reallife_gamemode.Server.Business namespace ReallifeGamemode.Server.Business
{ {
public class VapidCarDealerBusiness : CarDealerBusinessBase public class VapidCarDealerBusiness : CarDealerBusinessBase
{ {

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Classes namespace ReallifeGamemode.Server.Classes
{ {
public class TempBlip public class TempBlip
{ {

View File

@@ -3,17 +3,17 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using reallife_gamemode.Server.Business; using ReallifeGamemode.Server.Business;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using reallife_gamemode.Server.Classes; using ReallifeGamemode.Server.Classes;
using reallife_gamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Factions.Medic;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
/** /**
* @overview Life of German Reallife - Admin Commands (Admin.cs) * @overview Life of German Reallife - Admin Commands (Admin.cs)
@@ -21,7 +21,7 @@ using reallife_gamemode.Server.Models;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Commands namespace ReallifeGamemode.Server.Commands
{ {
public class Admin : Script public class Admin : Script
{ {

View File

@@ -1,9 +1,9 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Factions.Medic;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -13,7 +13,7 @@ using System.Text.RegularExpressions;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Commands namespace ReallifeGamemode.Server.Commands
{ {
class Faction : Script class Faction : Script
{ {

View File

@@ -1,11 +1,11 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.Linq; using System.Linq;
namespace reallife_gamemode.Server.Commands namespace ReallifeGamemode.Server.Commands
{ {
class User : Script class User : Script
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
/** /**
* @overview Life of German Reallife - Entities Ban (Ban.cs) * @overview Life of German Reallife - Entities Ban (Ban.cs)
@@ -11,7 +11,7 @@ using reallife_gamemode.Server.Entities;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class Ban public class Ban
{ {

View File

@@ -1,13 +1,13 @@
using reallife_gamemode.Server.Business; using ReallifeGamemode.Server.Business;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class BusinessBankAccount : IBankAccount public class BusinessBankAccount : IBankAccount
{ {

View File

@@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations.Schema;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class Character public class Character
{ {

View File

@@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations.Schema;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class CharacterCloth public class CharacterCloth
{ {

View File

@@ -11,7 +11,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class ClothCombination public class ClothCombination
{ {

View File

@@ -11,7 +11,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class Door public class Door
{ {

View File

@@ -10,7 +10,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class DutyCloth public class DutyCloth
{ {

View File

@@ -1,5 +1,5 @@
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
@@ -10,7 +10,7 @@ using System.Linq;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class Faction : IBankAccountOwner public class Faction : IBankAccountOwner
{ {

View File

@@ -1,5 +1,5 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@@ -11,7 +11,7 @@ using System.Text;
* @author VegaZ * @author VegaZ
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class FactionBankAccount : IBankAccount public class FactionBankAccount : IBankAccount
{ {

View File

@@ -1,8 +1,8 @@
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class FactionRank public class FactionRank
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
@@ -8,7 +8,7 @@ using System.Linq;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
[Table("FactionVehicles")] [Table("FactionVehicles")]
public class FactionVehicle : ServerVehicle public class FactionVehicle : ServerVehicle

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
/** /**
* @overview Life of German Reallife - Entities GotoPoints (GotoPoints.cs) * @overview Life of German Reallife - Entities GotoPoints (GotoPoints.cs)
@@ -11,7 +11,7 @@ using reallife_gamemode.Server.Entities;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class GotoPoint public class GotoPoint
{ {

View File

@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class Interior public class Interior
{ {

View File

@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class News public class News
{ {

View File

@@ -1,11 +1,11 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public abstract class ServerVehicle public abstract class ServerVehicle
{ {
@@ -24,6 +24,7 @@ namespace reallife_gamemode.Server.Entities
public int SecondaryColor { get; set; } public int SecondaryColor { get; set; }
public bool Locked { get; set; } public bool Locked { get; set; }
public bool Active { get; set; } public bool Active { get; set; }
public float DistanceDriven { get; set; }
[NotMapped] [NotMapped]
public Vector3 Position => new Vector3(PositionX, PositionY, PositionZ); public Vector3 Position => new Vector3(PositionX, PositionY, PositionZ);
@@ -42,6 +43,8 @@ namespace reallife_gamemode.Server.Entities
VehicleStreaming.SetLockStatus(veh, this.Locked); VehicleStreaming.SetLockStatus(veh, this.Locked);
VehicleManager.AddVehicle(this, veh); VehicleManager.AddVehicle(this, veh);
veh.SetSharedData("drivenDistance", this.DistanceDriven);
string numberplate = $"{this.Id}"; string numberplate = $"{this.Id}";
if(this is FactionVehicle fV) if(this is FactionVehicle fV)

View File

@@ -1,6 +1,6 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Business; using ReallifeGamemode.Server.Business;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@@ -13,7 +13,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
[Table("ShopVehicles")] [Table("ShopVehicles")]
public class ShopVehicle : ServerVehicle public class ShopVehicle : ServerVehicle

View File

@@ -1,6 +1,6 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@@ -13,7 +13,7 @@ using System.Linq;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class User : IBankAccountOwner public class User : IBankAccountOwner
{ {

View File

@@ -1,6 +1,6 @@
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
@@ -11,7 +11,7 @@ using System.Linq;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class UserBankAccount : IBankAccount public class UserBankAccount : IBankAccount
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
@@ -9,7 +9,7 @@ using System.Linq;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class UserItem public class UserItem
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
@@ -8,7 +8,7 @@ using System.Linq;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
[Table("UserVehicles")] [Table("UserVehicles")]
public class UserVehicle : ServerVehicle public class UserVehicle : ServerVehicle

View File

@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class VehicleMod public class VehicleMod
{ {

View File

@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Entities namespace ReallifeGamemode.Server.Entities
{ {
public class Whitelist public class Whitelist
{ {

View File

@@ -1,7 +1,7 @@
using GTANetworkAPI; using GTANetworkAPI;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class Chat : Script public class Chat : Script
{ {

View File

@@ -1,9 +1,9 @@
using System; using System;
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
/** /**
* @overview Life of German Reallife - Event Login (Login.cs) * @overview Life of German Reallife - Event Login (Login.cs)
@@ -11,7 +11,7 @@ using reallife_gamemode.Server.Util;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
class Connect : Script class Connect : Script
{ {

View File

@@ -1,10 +1,10 @@
using System; using System;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Factions.Medic;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
/** /**
* @overview Life of German Reallife - Events Death (Death.cs) * @overview Life of German Reallife - Events Death (Death.cs)
@@ -12,7 +12,7 @@ using reallife_gamemode.Server.Util;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class Death : Script public class Death : Script
{ {

View File

@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
/** /**
* @overview Life of German Reallife - Event Login (Login.cs) * @overview Life of German Reallife - Event Login (Login.cs)
@@ -12,7 +12,7 @@ using reallife_gamemode.Server.Models;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class Disconnect : Script public class Disconnect : Script
{ {

View File

@@ -2,10 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class EnterVehicleAttempt : Script public class EnterVehicleAttempt : Script

View File

@@ -1,12 +1,12 @@
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
class Faction : Script class Faction : Script
{ {

View File

@@ -2,21 +2,21 @@
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using reallife_gamemode.Server.Classes; using ReallifeGamemode.Server.Classes;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Factions.Medic;
using reallife_gamemode.Server.Inventory; using ReallifeGamemode.Server.Inventory;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
/** /**
* @overview Life of German Reallife - Event Key (Key.cs) * @overview Life of German Reallife - Event Key (Key.cs)
* @author VegaZ * @author VegaZ
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class Key : Script public class Key : Script
{ {

View File

@@ -1,8 +1,8 @@
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
/** /**
* @overview Life of German Reallife - Event Login (Login.cs) * @overview Life of German Reallife - Event Login (Login.cs)
@@ -10,7 +10,7 @@ using reallife_gamemode.Server.Util;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class Login : Script public class Login : Script
{ {

View File

@@ -1,6 +1,6 @@
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
/** /**
* @overview Life of German Reallife - Event Register (Register.cs) * @overview Life of German Reallife - Event Register (Register.cs)
@@ -8,7 +8,7 @@ using reallife_gamemode.Server.Models;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
class Register : Script class Register : Script
{ {

View File

@@ -1,7 +1,7 @@
using GTANetworkAPI; using GTANetworkAPI;
using GTANetworkMethods; using GTANetworkMethods;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -13,7 +13,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class ResourceStop : Script public class ResourceStop : Script
{ {

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
class Siren : Script class Siren : Script
{ {

View File

@@ -0,0 +1,57 @@
using GTANetworkAPI;
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Events
{
class Update : Script
{
private Dictionary<NetHandle, Vector3> lastPositions = new Dictionary<NetHandle, Vector3>();
private DateTime lastSave = DateTime.UtcNow;
[ServerEvent(Event.Update)]
void UpdateEvent()
{
NAPI.Pools.GetAllVehicles().ForEach(v =>
{
Vector3 lastPosition = v.Position;
if (lastPositions.ContainsKey(v.Handle)) lastPosition = lastPositions[v.Handle];
double distanceDriven = v.HasSharedData("drivenDistance") ? v.GetSharedData("drivenDistance") : 0;
distanceDriven += (lastPosition.DistanceTo(v.Position) / 1000.0);
v.SetSharedData("drivenDistance", (float)distanceDriven);
lastPositions[v.Handle] = v.Position;
});
if (DateTime.UtcNow.Subtract(lastSave).Seconds >= 30)
{
lastSave = DateTime.UtcNow;
NAPI.Chat.SendChatMessageToAll("save distances");
// save to db
using (var dbContext = new DatabaseContext())
{
foreach(var key in lastPositions.Keys)
{
Vehicle v = key.Entity<Vehicle>();
if (!v.HasSharedData("drivenDistance")) continue;
ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(v, dbContext);
if (sVeh == null) continue;
sVeh.DistanceDriven = (float)v.GetSharedData("drivenDistance");
}
dbContext.SaveChanges();
}
}
}
}
}

View File

@@ -2,11 +2,11 @@
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class UpdateCharacterCloth : Script public class UpdateCharacterCloth : Script
{ {

View File

@@ -1,12 +1,12 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class VehicleMenu : Script public class VehicleMenu : Script
{ {

View File

@@ -1,10 +1,10 @@
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using static reallife_gamemode.Server.Util.AdminLevel; using static ReallifeGamemode.Server.Util.AdminLevel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Extensions namespace ReallifeGamemode.Server.Extensions
{ {
public static class AdminLevelExtension public static class AdminLevelExtension
{ {

View File

@@ -1,6 +1,6 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System; using System;
using System.Linq; using System.Linq;
@@ -10,7 +10,7 @@ using System.Linq;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Extensions namespace ReallifeGamemode.Server.Extensions
{ {
public static class ClientExtension public static class ClientExtension
{ {

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Extensions namespace ReallifeGamemode.Server.Extensions
{ {
public static class IntegerExtension public static class IntegerExtension
{ {

View File

@@ -1,11 +1,11 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Extensions namespace ReallifeGamemode.Server.Extensions
{ {
public static class VehicleExtension public static class VehicleExtension
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
/** /**
* @overview Life of German Reallife - Server Factions Medic Medic.cs * @overview Life of German Reallife - Server Factions Medic Medic.cs
@@ -12,7 +12,7 @@ using reallife_gamemode.Server.Services;
*/ */
namespace reallife_gamemode.Server.Factions.Medic namespace ReallifeGamemode.Server.Factions.Medic
{ {
public class Medic : Script public class Medic : Script
{ {

View File

@@ -10,7 +10,7 @@ using GTANetworkAPI;
*/ */
namespace reallife_gamemode.Server.Factions.Medic namespace ReallifeGamemode.Server.Factions.Medic
{ {
public class MedicTask public class MedicTask
{ {

View File

@@ -1,13 +1,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using System.Linq; using System.Linq;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
namespace reallife_gamemode.Server.Inventory namespace ReallifeGamemode.Server.Inventory
{ {
public class GroundItem : Script public class GroundItem : Script
{ {

View File

@@ -1,5 +1,5 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -10,7 +10,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Interfaces namespace ReallifeGamemode.Server.Inventory.Interfaces
{ {
public interface IDroppableItem : IItem public interface IDroppableItem : IItem
{ {

View File

@@ -8,7 +8,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Interfaces namespace ReallifeGamemode.Server.Inventory.Interfaces
{ {
public interface IItem public interface IItem
{ {

View File

@@ -1,5 +1,5 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -10,7 +10,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Interfaces namespace ReallifeGamemode.Server.Inventory.Interfaces
{ {
public interface IUsableItem : IItem, IDroppableItem public interface IUsableItem : IItem, IDroppableItem
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -9,7 +9,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Cheeseburger : FoodItem public class Cheeseburger : FoodItem
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -9,7 +9,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Chickenburger : FoodItem public class Chickenburger : FoodItem
{ {

View File

@@ -1,13 +1,13 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public abstract class DropItem : IDroppableItem public abstract class DropItem : IDroppableItem
{ {

View File

@@ -1,13 +1,13 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public abstract class FoodItem : IUsableItem public abstract class FoodItem : IUsableItem
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -9,7 +9,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Hamburger : FoodItem public class Hamburger : FoodItem
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -9,7 +9,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Holz : IDroppableItem public class Holz : IDroppableItem
{ {

View File

@@ -1,4 +1,4 @@
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -9,7 +9,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Kraftstoff : DropItem public class Kraftstoff : DropItem
{ {

View File

@@ -10,7 +10,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Logs namespace ReallifeGamemode.Server.Logs
{ {
public class BankAccountTransactionHistory public class BankAccountTransactionHistory
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
/** /**
* @overview Life of German Reallife - Logs Death (Death.cs) * @overview Life of German Reallife - Logs Death (Death.cs)
@@ -11,7 +11,7 @@ using reallife_gamemode.Server.Entities;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Logs namespace ReallifeGamemode.Server.Logs
{ {
public class Death public class Death
{ {

View File

@@ -1,8 +1,8 @@
using System.Globalization; using System.Globalization;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Classes; using ReallifeGamemode.Server.Classes;
using reallife_gamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
/** /**
* @overview Life of German Reallife - Main Class (Main.cs) * @overview Life of German Reallife - Main Class (Main.cs)
@@ -10,7 +10,7 @@ using reallife_gamemode.Server.Util;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode namespace ReallifeGamemode.Server
{ {
public class Main : Script public class Main : Script
{ {

View File

@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Business; using ReallifeGamemode.Server.Business;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
/** /**
* @overview Life of German Reallife - Managers BankManager (BankManager.cs) * @overview Life of German Reallife - Managers BankManager (BankManager.cs)
@@ -15,7 +15,7 @@ using reallife_gamemode.Server.Util;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class BankManager public class BankManager
{ {

View File

@@ -1,15 +1,15 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Business; using ReallifeGamemode.Server.Business;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
class BusinessManager : Script class BusinessManager : Script
{ {

View File

@@ -1,10 +1,10 @@
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class CharacterCreator : Script public class CharacterCreator : Script
{ {

View File

@@ -1,17 +1,17 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
/** /**
* @overview Life of German Reallife - Managers BankManager (BankManager.cs) * @overview Life of German Reallife - Managers BankManager (BankManager.cs)
* @author VegaZ * @author VegaZ
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class DoorManager : Script public class DoorManager : Script
{ {

View File

@@ -1,7 +1,7 @@
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -12,7 +12,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class InteractionManager : Script public class InteractionManager : Script
{ {

View File

@@ -1,10 +1,10 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class InteriorManager : Script public class InteriorManager : Script
{ {

View File

@@ -1,11 +1,11 @@
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Inventory; using ReallifeGamemode.Server.Inventory;
using reallife_gamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Services; using ReallifeGamemode.Server.Services;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -17,7 +17,7 @@ using System.Reflection;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class InventoryManager : Script public class InventoryManager : Script
{ {

View File

@@ -1,7 +1,7 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Saves; using ReallifeGamemode.Server.Saves;
/** /**
* @overview Life of German Reallife - Managers LoadManager (LoadManager.cs) * @overview Life of German Reallife - Managers LoadManager (LoadManager.cs)
@@ -9,7 +9,7 @@ using reallife_gamemode.Server.Saves;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class LoadManager : Script public class LoadManager : Script
{ {

View File

@@ -2,9 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class PositionManager : Script public class PositionManager : Script
{ {

View File

@@ -1,12 +1,12 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Business; using ReallifeGamemode.Server.Business;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using reallife_gamemode.Server.Saves; using ReallifeGamemode.Server.Saves;
using System; using System;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class SaveManager : Script public class SaveManager : Script
{ {

View File

@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Timers; using System.Timers;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class TimeManager public class TimeManager
{ {

View File

@@ -1,11 +1,11 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
class TuningManager : Script class TuningManager : Script
{ {

View File

@@ -1,10 +1,10 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace reallife_gamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
public class VehicleManager public class VehicleManager
{ {
@@ -110,11 +110,24 @@ namespace reallife_gamemode.Server.Managers
return GetVehicleFromHandle(_serverVehicles[serverVehicle.Id]); return GetVehicleFromHandle(_serverVehicles[serverVehicle.Id]);
} }
public static ServerVehicle GetServerVehicleFromVehicle(Vehicle veh) public static ServerVehicle GetServerVehicleFromVehicle(Vehicle veh, DatabaseContext dbContext = null)
{ {
using (var dbContext = new DatabaseContext()) if(dbContext == null)
{ {
foreach(KeyValuePair<int, NetHandle> pair in _serverVehicles) using (dbContext = new DatabaseContext())
{
foreach (KeyValuePair<int, NetHandle> pair in _serverVehicles)
{
if (pair.Value == veh.Handle)
{
return dbContext.ServerVehicles.Find(pair.Key);
}
}
}
}
else
{
foreach (KeyValuePair<int, NetHandle> pair in _serverVehicles)
{ {
if (pair.Value == veh.Handle) if (pair.Value == veh.Handle)
{ {

View File

@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
namespace ReallifeGamemode.Migrations namespace ReallifeGamemode.Migrations
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ReallifeGamemode.Migrations
{
public partial class VehicleDistanceDriven : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<float>(
name: "DistanceDriven",
table: "ServerVehicles",
nullable: false,
defaultValue: 0f);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DistanceDriven",
table: "ServerVehicles");
}
}
}

View File

@@ -3,7 +3,7 @@ using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
namespace ReallifeGamemode.Migrations namespace ReallifeGamemode.Migrations
{ {
@@ -404,6 +404,8 @@ namespace ReallifeGamemode.Migrations
b.Property<string>("Discriminator") b.Property<string>("Discriminator")
.IsRequired(); .IsRequired();
b.Property<float>("DistanceDriven");
b.Property<float>("Heading"); b.Property<float>("Heading");
b.Property<bool>("Locked"); b.Property<bool>("Locked");

View File

@@ -6,7 +6,7 @@
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Models namespace ReallifeGamemode.Server.Models
{ {
public partial class DatabaseContext : DbContext public partial class DatabaseContext : DbContext
{ {
@@ -30,74 +30,74 @@ namespace reallife_gamemode.Server.Models
{ {
base.OnModelCreating(modelBuilder); base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Server.Entities.BusinessBankAccount>() modelBuilder.Entity<Entities.BusinessBankAccount>()
.HasIndex(b => b.BusinessId) .HasIndex(b => b.BusinessId)
.IsUnique(true); .IsUnique(true);
modelBuilder.Entity<Server.Entities.User>() modelBuilder.Entity<Entities.User>()
.HasIndex(u => u.BusinessId) .HasIndex(u => u.BusinessId)
.IsUnique(true); .IsUnique(true);
modelBuilder.Entity<Server.Entities.ServerVehicle>() modelBuilder.Entity<Entities.ServerVehicle>()
.Property(sv => sv.Active) .Property(sv => sv.Active)
.HasDefaultValue(true); .HasDefaultValue(true);
modelBuilder.Entity<Server.Entities.VehicleMod>() modelBuilder.Entity<Entities.VehicleMod>()
.HasIndex(vM => new { vM.ServerVehicleId, vM.Slot }).IsUnique(); .HasIndex(vM => new { vM.ServerVehicleId, vM.Slot }).IsUnique();
} }
//User //User
public DbSet<Server.Entities.Ban> Bans { get; set; } public DbSet<Entities.Ban> Bans { get; set; }
public DbSet<Server.Entities.Character> Characters { get; set; } public DbSet<Entities.Character> Characters { get; set; }
public DbSet<Server.Entities.CharacterCloth> CharacterClothes { get; set; } public DbSet<Entities.CharacterCloth> CharacterClothes { get; set; }
public DbSet<Server.Entities.DutyCloth> DutyClothes { get; set; } public DbSet<Entities.DutyCloth> DutyClothes { get; set; }
public DbSet<Server.Entities.ClothCombination> ClothCombinations { get; set; } public DbSet<Entities.ClothCombination> ClothCombinations { get; set; }
public DbSet<Server.Entities.User> Users { get; set; } public DbSet<Entities.User> Users { get; set; }
public DbSet<Server.Entities.UserVehicle> UserVehicles { get; set; } public DbSet<Entities.UserVehicle> UserVehicles { get; set; }
public DbSet<Server.Entities.UserBankAccount> UserBankAccounts { get; set; } public DbSet<Entities.UserBankAccount> UserBankAccounts { get; set; }
//Inventar //Inventar
public DbSet<Server.Entities.UserItem> UserItems { get; set; } public DbSet<Entities.UserItem> UserItems { get; set; }
//Faction //Faction
public DbSet<Server.Entities.Faction> Factions { get; set; } public DbSet<Entities.Faction> Factions { get; set; }
public DbSet<Server.Entities.FactionBankAccount> FactionBankAccounts { get; set; } public DbSet<Entities.FactionBankAccount> FactionBankAccounts { get; set; }
public DbSet<Server.Entities.FactionRank> FactionRanks { get; set; } public DbSet<Entities.FactionRank> FactionRanks { get; set; }
public DbSet<Server.Entities.FactionVehicle> FactionVehicles { get; set; } public DbSet<Entities.FactionVehicle> FactionVehicles { get; set; }
//Shops //Shops
//Logs //Logs
//public DbSet<Server.Logs.Ban> BanLogs { get; set; } //public DbSet<Logs.Ban> BanLogs { get; set; }
public DbSet<Server.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; } public DbSet<Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
public DbSet<Server.Logs.Death> DeathLogs { get; set; } public DbSet<Logs.Death> DeathLogs { get; set; }
//Saves //Saves
public DbSet<Server.Saves.SavedBlip> Blips { get; set; } public DbSet<Saves.SavedBlip> Blips { get; set; }
public DbSet<Server.Entities.Door> Doors { get; set; } public DbSet<Entities.Door> Doors { get; set; }
public DbSet<Server.Entities.GotoPoint> GotoPoints { get; set; } public DbSet<Entities.GotoPoint> GotoPoints { get; set; }
public DbSet<Server.Saves.SavedMarker> Markers { get; set; } public DbSet<Saves.SavedMarker> Markers { get; set; }
public DbSet<Server.Saves.SavedPed> Peds { get; set; } public DbSet<Saves.SavedPed> Peds { get; set; }
public DbSet<Server.Saves.SavedPickup> Pickups { get; set; } public DbSet<Saves.SavedPickup> Pickups { get; set; }
public DbSet<Server.Saves.SavedTextLabel> TextLabels { get; set; } public DbSet<Saves.SavedTextLabel> TextLabels { get; set; }
public DbSet<Server.Saves.SavedVehicle> Vehicles { get; set; } public DbSet<Saves.SavedVehicle> Vehicles { get; set; }
public DbSet<Server.Entities.ShopVehicle> ShopVehicles { get; set; } public DbSet<Entities.ShopVehicle> ShopVehicles { get; set; }
// Business // Business
public DbSet<Server.Entities.BusinessBankAccount> BusinessBankAccounts { get; set; } public DbSet<Entities.BusinessBankAccount> BusinessBankAccounts { get; set; }
// Control Panel // Control Panel
public DbSet<Server.Entities.News> News { get; set; } public DbSet<Entities.News> News { get; set; }
// Server Vehicles // Server Vehicles
public DbSet<Server.Entities.ServerVehicle> ServerVehicles { get; set; } public DbSet<Entities.ServerVehicle> ServerVehicles { get; set; }
public DbSet<Server.Entities.VehicleMod> VehicleMods { get; set; } public DbSet<Entities.VehicleMod> VehicleMods { get; set; }
// Whitelist // Whitelist
public DbSet<Server.Entities.Whitelist> WhitelistEntries { get; set; } public DbSet<Entities.Whitelist> WhitelistEntries { get; set; }
// Interiors // Interiors
public DbSet<Server.Entities.Interior> Interiors { get; set; } public DbSet<Entities.Interior> Interiors { get; set; }
} }
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<RootNamespace>ReallifeGamemode</RootNamespace> <RootNamespace>ReallifeGamemode.Server</RootNamespace>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>

View File

@@ -10,7 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Saves namespace ReallifeGamemode.Server.Saves
{ {
public class SavedBlip public class SavedBlip
{ {

View File

@@ -10,7 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Saves namespace ReallifeGamemode.Server.Saves
{ {
public class SavedMarker public class SavedMarker
{ {

View File

@@ -10,7 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Saves namespace ReallifeGamemode.Server.Saves
{ {
public class SavedPed public class SavedPed
{ {

View File

@@ -10,7 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Saves namespace ReallifeGamemode.Server.Saves
{ {
public class SavedPickup public class SavedPickup
{ {

View File

@@ -10,7 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Saves namespace ReallifeGamemode.Server.Saves
{ {
public class SavedTextLabel public class SavedTextLabel
{ {

View File

@@ -4,7 +4,7 @@ using System.Text;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
/** /**
* @overview Life of German Reallife - Saves SavedVehicle.cs * @overview Life of German Reallife - Saves SavedVehicle.cs
@@ -12,7 +12,7 @@ using reallife_gamemode.Server.Entities;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Saves namespace ReallifeGamemode.Server.Saves
{ {
public class SavedVehicle : ServerVehicle public class SavedVehicle : ServerVehicle
{ {

View File

@@ -1,7 +1,7 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using reallife_gamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.Collections.Generic; using System.Collections.Generic;
/** /**
@@ -10,7 +10,7 @@ using System.Collections.Generic;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Services namespace ReallifeGamemode.Server.Services
{ {
class ChatService class ChatService
{ {

View File

@@ -9,7 +9,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Services namespace ReallifeGamemode.Server.Services
{ {
class ClientService class ClientService
{ {

View File

@@ -8,7 +8,7 @@ using System.Text;
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
namespace reallife_gamemode.Server.Util namespace ReallifeGamemode.Server.Util
{ {
public enum AdminLevel : int public enum AdminLevel : int
{ {

View File

@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Util namespace ReallifeGamemode.Server.Util
{ {
public class Converter public class Converter
{ {

View File

@@ -1,8 +1,8 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
using System.Linq; using System.Linq;
namespace reallife_gamemode.Server.Util namespace ReallifeGamemode.Server.Util
{ {
class DatabaseHelper class DatabaseHelper
{ {

View File

@@ -1,8 +1,8 @@
using GTANetworkAPI; using GTANetworkAPI;
using reallife_gamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
namespace reallife_gamemode.Server.Util namespace ReallifeGamemode.Server.Util
{ {
class FactionHelper class FactionHelper
{ {

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Util namespace ReallifeGamemode.Server.Util
{ {
class FactionRankHelper class FactionRankHelper
{ {

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace reallife_gamemode.Server.Util namespace ReallifeGamemode.Server.Util
{ {
public interface IBankAccount public interface IBankAccount
{ {

View File

@@ -1,6 +1,6 @@
using reallife_gamemode.Server.Models; using ReallifeGamemode.Server.Models;
namespace reallife_gamemode.Server.Util namespace ReallifeGamemode.Server.Util
{ {
public interface IBankAccountOwner public interface IBankAccountOwner
{ {

Some files were not shown because too many files have changed in this diff Show More