Begin script abstraction
This commit is contained in:
46
ReallifeGamemode.Client/package-lock.json
generated
46
ReallifeGamemode.Client/package-lock.json
generated
@@ -346,7 +346,10 @@
|
||||
"NativeUI": {
|
||||
"version": "git+https://github.com/sprayzcs/RageMP-NativeUI.git#3f2412469f0be4dfd8f7ff495aac67949704bff6",
|
||||
"from": "git+https://github.com/sprayzcs/RageMP-NativeUI.git",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ajv": "^6.8.1"
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "6.2.1",
|
||||
@@ -1647,8 +1650,7 @@
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
@@ -1669,14 +1671,12 @@
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@@ -1691,20 +1691,17 @@
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
@@ -1821,8 +1818,7 @@
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
@@ -1834,7 +1830,6 @@
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
@@ -1849,7 +1844,6 @@
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@@ -1857,14 +1851,12 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
@@ -1883,7 +1875,6 @@
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
@@ -1964,8 +1955,7 @@
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
@@ -1977,7 +1967,6 @@
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
@@ -2063,8 +2052,7 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
@@ -2100,7 +2088,6 @@
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
@@ -2120,7 +2107,6 @@
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
@@ -2164,14 +2150,12 @@
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -18,21 +19,15 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net" Version="2.0.8" />
|
||||
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.11" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="2.2.12" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
@@ -26,9 +27,9 @@ namespace ReallifeGamemode.DataService
|
||||
{
|
||||
private readonly ILogger<Startup> logger;
|
||||
private readonly IConfiguration configuration;
|
||||
private readonly IHostingEnvironment environment;
|
||||
private readonly IWebHostEnvironment environment;
|
||||
|
||||
public Startup(IConfiguration configuration, IHostingEnvironment environment, ILogger<Startup> logger)
|
||||
public Startup(IConfiguration configuration,IWebHostEnvironment environment, ILogger<Startup> logger)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.environment = environment;
|
||||
@@ -122,15 +123,15 @@ namespace ReallifeGamemode.DataService
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
|
||||
{
|
||||
app.UseAuthentication();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseCors(c =>
|
||||
@@ -151,7 +152,10 @@ namespace ReallifeGamemode.DataService
|
||||
c.RouteTemplate = "doc/{documentName}.json";
|
||||
});
|
||||
|
||||
app.UseMvc();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - DatabaseContext.cs
|
||||
@@ -10,13 +11,23 @@ namespace ReallifeGamemode.Database.Models
|
||||
{
|
||||
public partial class DatabaseContext : DbContext
|
||||
{
|
||||
private readonly ILoggerFactory loggerFactory;
|
||||
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
||||
|
||||
public DatabaseContext() { }
|
||||
public DatabaseContext(ILoggerFactory loggerFactory = null) {
|
||||
this.loggerFactory = loggerFactory;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
|
||||
if(loggerFactory != null)
|
||||
{
|
||||
optionsBuilder.UseLoggerFactory(loggerFactory);
|
||||
}
|
||||
|
||||
optionsBuilder.UseMySql("Host=localhost;Port=3306;Database=gtav-devdb;Username=gtav-dev;Password=Test123");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
40
ReallifeGamemode.Server.Common/PasswordHasher.cs
Normal file
40
ReallifeGamemode.Server.Common/PasswordHasher.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Common
|
||||
{
|
||||
public class PasswordHasher
|
||||
{
|
||||
public static byte[] GetNewSalt(int length = 256)
|
||||
{
|
||||
if ((length % 8) != 0)
|
||||
{
|
||||
throw new ArgumentException("Length mus be completely divisble through 8");
|
||||
}
|
||||
|
||||
var salt = new byte[length / 8];
|
||||
|
||||
using (var rng = RandomNumberGenerator.Create())
|
||||
{
|
||||
rng.GetBytes(salt);
|
||||
}
|
||||
|
||||
return salt;
|
||||
}
|
||||
|
||||
public static string HashPassword(string password, byte[] salt, int length = 512)
|
||||
{
|
||||
if ((length % 8) != 0)
|
||||
{
|
||||
throw new ArgumentException("Length mus be completely divisble through 8");
|
||||
}
|
||||
|
||||
var hashedPassword = KeyDerivation.Pbkdf2(password, salt, KeyDerivationPrf.HMACSHA512, 50000, length / 8);
|
||||
|
||||
return Convert.ToBase64String(hashedPassword);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Types\ReallifeGamemode.Server.Types.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\Import\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
114
ReallifeGamemode.Server.Common/TypeExtensions.cs
Normal file
114
ReallifeGamemode.Server.Common/TypeExtensions.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ReallifeGamemode.Server.Common
|
||||
{
|
||||
public static class TypeExtensions
|
||||
{
|
||||
private static readonly JsonSerializerSettings settings = new JsonSerializerSettings()
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DateFormatHandling = DateFormatHandling.MicrosoftDateFormat,
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
|
||||
DateParseHandling = DateParseHandling.DateTime
|
||||
};
|
||||
|
||||
static TypeExtensions()
|
||||
{
|
||||
settings.Converters.Add(new StringEnumConverter());
|
||||
}
|
||||
|
||||
public static string SerializeJson(this object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(obj));
|
||||
}
|
||||
|
||||
return JsonConvert.SerializeObject(obj, settings);
|
||||
}
|
||||
|
||||
public static T DeserializeJson<T>(this string str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(str));
|
||||
}
|
||||
|
||||
return JsonConvert.DeserializeObject<T>(str, settings);
|
||||
}
|
||||
|
||||
public static bool IsNullOrEmpty(this string str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str.Trim().Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsNotNullOrEmpty(this string str) => !str.IsNullOrEmpty();
|
||||
|
||||
public static T GetEnumAttribute<T>(this Enum @enum) where T : Attribute
|
||||
{
|
||||
var type = @enum?.GetType();
|
||||
var memberInfo = type?.GetMember(@enum.ToString()).First();
|
||||
return memberInfo?.GetCustomAttribute<T>();
|
||||
}
|
||||
|
||||
public static string GetValue(this Enum @enum)
|
||||
{
|
||||
return @enum?.GetEnumAttribute<EnumMemberAttribute>()?.Value;
|
||||
}
|
||||
|
||||
public static string GetPrefix(this ChatPrefix prefix)
|
||||
{
|
||||
return prefix.GetValue();
|
||||
}
|
||||
|
||||
public static bool TryParseEnum(this string str, Type type, out object @enum)
|
||||
{
|
||||
var members = Enum.GetValues(type).Cast<Enum>();
|
||||
var directEnumMember = members.Where(e => e.ToString().ToLower() == str.ToLower()).FirstOrDefault();
|
||||
|
||||
if (directEnumMember != null)
|
||||
{
|
||||
@enum = directEnumMember;
|
||||
return true;
|
||||
}
|
||||
|
||||
var memberValueMember = members.Where(e => e.GetValue()?.ToLower() == str.ToLower()).FirstOrDefault();
|
||||
|
||||
if (memberValueMember != null)
|
||||
{
|
||||
@enum = memberValueMember;
|
||||
return true;
|
||||
}
|
||||
|
||||
var nativeResult = Enum.TryParse(type, str, true, out var result);
|
||||
@enum = result ?? (default);
|
||||
return nativeResult;
|
||||
}
|
||||
|
||||
public static long ToLong(this object obj)
|
||||
{
|
||||
return long.Parse(obj.ToString());
|
||||
}
|
||||
|
||||
public static int ToInt(this object obj)
|
||||
{
|
||||
return (int)obj.ToLong();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
ReallifeGamemode.Server.Core.API/IAPI.cs
Normal file
28
ReallifeGamemode.Server.Core.API/IAPI.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using ReallifeGamemode.Server.Core.API.API;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API
|
||||
{
|
||||
public interface IAPI
|
||||
{
|
||||
IColShapeAPI ColShape { get; }
|
||||
|
||||
IVehicleAPI Vehicle { get; }
|
||||
|
||||
void DisableDefaultCommandErrorMessages();
|
||||
|
||||
void DisableDefaultSpawnBehavior();
|
||||
|
||||
IPlayer GetPlayerFromNameOrId(string nameOrId);
|
||||
|
||||
void SetGlobalChatEnabled(bool enable);
|
||||
|
||||
void SetTime(int hour, int minute, int second);
|
||||
|
||||
void TriggerClientEventForAll(string eventName, params object[] args);
|
||||
}
|
||||
}
|
||||
14
ReallifeGamemode.Server.Core.API/IColShape.cs
Normal file
14
ReallifeGamemode.Server.Core.API/IColShape.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API
|
||||
{
|
||||
public interface IColShape : IEntity
|
||||
{
|
||||
delegate void ColShapeEvent(IColShape colShape, IEntity entity);
|
||||
|
||||
event ColShapeEvent OnEntityEnter;
|
||||
event ColShapeEvent OnEntityExit;
|
||||
}
|
||||
}
|
||||
13
ReallifeGamemode.Server.Core.API/IColShapeAPI.cs
Normal file
13
ReallifeGamemode.Server.Core.API/IColShapeAPI.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API.API
|
||||
{
|
||||
public interface IColShapeAPI
|
||||
{
|
||||
IColShape CreateCyclinder(Position position, float height, float range);
|
||||
|
||||
IColShape CreateSphere(Position position, float range);
|
||||
}
|
||||
}
|
||||
21
ReallifeGamemode.Server.Core.API/IEntity.cs
Normal file
21
ReallifeGamemode.Server.Core.API/IEntity.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API
|
||||
{
|
||||
public interface IEntity
|
||||
{
|
||||
ulong Handle { get; }
|
||||
|
||||
Position Position { get; set; }
|
||||
|
||||
Position Rotation { get; set; }
|
||||
|
||||
double Heading { get; set; }
|
||||
|
||||
void Remove();
|
||||
|
||||
void SetSharedData<T>(string key, T data);
|
||||
|
||||
T GetSharedData<T>(string key, T fallback);
|
||||
}
|
||||
}
|
||||
43
ReallifeGamemode.Server.Core.API/IPlayer.cs
Normal file
43
ReallifeGamemode.Server.Core.API/IPlayer.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Common;
|
||||
using System.Net;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API
|
||||
{
|
||||
public interface IPlayer : IEntity
|
||||
{
|
||||
string Name { get; set; }
|
||||
|
||||
string SocialClubName { get; }
|
||||
|
||||
int Health { get; set; }
|
||||
|
||||
int Armor { get; set; }
|
||||
|
||||
IPAddress RemoteAddress { get; }
|
||||
|
||||
IVehicle Vehicle { get; }
|
||||
|
||||
bool IsInVehicle { get; }
|
||||
|
||||
VehicleSeat VehicleSeat { get; }
|
||||
|
||||
void SendMessage(string message, ChatPrefix prefix = ChatPrefix.None) => SendRawMessage(prefix.GetValue() + message);
|
||||
|
||||
void SendRawMessage(string message);
|
||||
|
||||
void TriggerEvent(string eventName, params object[] args) => TriggerEventRaw("SERVER:" + eventName, args);
|
||||
void CancelAnimation();
|
||||
void TriggerEventRaw(string eventName, params object[] args);
|
||||
|
||||
void SetIntoVehicle(IVehicle vehicle, VehicleSeat seat);
|
||||
|
||||
void Kick();
|
||||
|
||||
void SendNotification(string message, bool flashing = true);
|
||||
|
||||
void Spawn(Position position, float heading = 0.0f);
|
||||
|
||||
void PlayAnimation(string dict, string name, AnimationFlags flags, float speed = 8.0f);
|
||||
}
|
||||
}
|
||||
17
ReallifeGamemode.Server.Core.API/IVehicle.cs
Normal file
17
ReallifeGamemode.Server.Core.API/IVehicle.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API
|
||||
{
|
||||
public interface IVehicle : IEntity
|
||||
{
|
||||
VehicleModel Model { get; }
|
||||
|
||||
sbyte PrimaryColor { get; set; }
|
||||
|
||||
sbyte SecondaryColor { get; set; }
|
||||
|
||||
void Repair();
|
||||
}
|
||||
}
|
||||
14
ReallifeGamemode.Server.Core.API/IVehicleAPI.cs
Normal file
14
ReallifeGamemode.Server.Core.API/IVehicleAPI.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API.API
|
||||
{
|
||||
public interface IVehicleAPI
|
||||
{
|
||||
IVehicle Spawn(VehicleModel model, Position position, Position rotation, sbyte primaryColor, sbyte secondaryColor);
|
||||
|
||||
IVehicle GetVehicleFromHandle(ulong handle);
|
||||
}
|
||||
}
|
||||
76
ReallifeGamemode.Server.Core.API/Position.cs
Normal file
76
ReallifeGamemode.Server.Core.API/Position.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.API
|
||||
{
|
||||
public class Position
|
||||
{
|
||||
public double X { get; set; }
|
||||
|
||||
public double Y { get; set; }
|
||||
|
||||
public double Z { get; set; }
|
||||
|
||||
public Position()
|
||||
{
|
||||
X = 0.0;
|
||||
Y = 0.0;
|
||||
Z = 0.0;
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public Position(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
public Position(decimal x, decimal y, decimal z)
|
||||
{
|
||||
X = (double)x;
|
||||
Y = (double)y;
|
||||
Z = (double)z;
|
||||
}
|
||||
|
||||
public Position(int x, int y, int z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public Position Add(Position toAdd)
|
||||
{
|
||||
return new Position(X + toAdd.X, Y + toAdd.Y, Z + toAdd.Z);
|
||||
}
|
||||
|
||||
public Position Subtract(Position toSubtract)
|
||||
{
|
||||
return new Position(X - toSubtract.X, Y - toSubtract.Y, Z - toSubtract.Z);
|
||||
}
|
||||
|
||||
public double DistanceTo(Position position)
|
||||
{
|
||||
var x = position.X - X;
|
||||
var y = position.Y - Y;
|
||||
var z = position.Z - Z;
|
||||
|
||||
return Math.Sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var x = Math.Round(this.X, 2).ToString(CultureInfo.InvariantCulture);
|
||||
var y = Math.Round(this.Y, 2).ToString(CultureInfo.InvariantCulture);
|
||||
var z = Math.Round(this.Z, 2).ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
return $"{x}, {y}, {z}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Common\ReallifeGamemode.Server.Common.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Types\ReallifeGamemode.Server.Types.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
76
ReallifeGamemode.Server.Core.Events/EventHandler.cs
Normal file
76
ReallifeGamemode.Server.Core.Events/EventHandler.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ReallifeGamemode.Server.Common;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Log;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.Events
|
||||
{
|
||||
public class EventHandler
|
||||
{
|
||||
private readonly IAPI api;
|
||||
|
||||
public delegate void PlayerEvent(IPlayer player);
|
||||
public delegate void VehicleEvent(IVehicle vehicle);
|
||||
public delegate void PlayerVehicleEvent(IPlayer player, IVehicle vehicle);
|
||||
public delegate void PlayerDisconnectEvent(IPlayer player, DisconnectReason reason, string reasonString);
|
||||
|
||||
public delegate void ClientEvent(IPlayer player, params object[] args);
|
||||
private static readonly Dictionary<string, ClientEvent> clientEvents = new Dictionary<string, ClientEvent>();
|
||||
|
||||
public static event PlayerEvent OnPlayerJoin;
|
||||
public static event PlayerDisconnectEvent OnPlayerLeave;
|
||||
public static event PlayerVehicleEvent OnPlayerExitVehicle;
|
||||
|
||||
private static readonly ILogger logger = LogManager.GetLogger<EventHandler>();
|
||||
|
||||
public EventHandler(IAPI api)
|
||||
{
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
public void RegisterClientEvent(string eventName, ClientEvent clientEvent)
|
||||
{
|
||||
if (eventName.IsNullOrEmpty())
|
||||
{
|
||||
logger.LogWarning("'eventName' is null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (clientEvents.ContainsKey(eventName))
|
||||
{
|
||||
logger.LogError("Client event '{EventName}' is already registered", eventName);
|
||||
return;
|
||||
}
|
||||
|
||||
clientEvents[eventName] = clientEvent;
|
||||
}
|
||||
|
||||
public void HandleEvent(IPlayer player, List<object> data)
|
||||
{
|
||||
logger.LogDebug("Client event from '{Name}', data: '{DataStr}'", player.Name, data.SerializeJson());
|
||||
|
||||
var eventName = data.Last() as string;
|
||||
|
||||
if (eventName.IsNullOrEmpty())
|
||||
{
|
||||
logger.LogError("Client event name is null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!clientEvents.ContainsKey(eventName))
|
||||
{
|
||||
logger.LogError("Client event '{EventName}' is not registered", eventName);
|
||||
return;
|
||||
}
|
||||
|
||||
var arguments = data.Take(data.Count - 1).ToArray();
|
||||
|
||||
clientEvents[eventName](player, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Common\ReallifeGamemode.Server.Common.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core.API\ReallifeGamemode.Server.Core.API.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Log\ReallifeGamemode.Server.Log.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
61
ReallifeGamemode.Server.Core.RageMP/RageAPI.cs
Normal file
61
ReallifeGamemode.Server.Core.RageMP/RageAPI.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Core.API.API;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
public class RageAPI : IAPI
|
||||
{
|
||||
public IColShapeAPI ColShape => new RageColShapeAPI();
|
||||
|
||||
public IVehicleAPI Vehicle => new RageVehicleAPI();
|
||||
|
||||
public void DisableDefaultCommandErrorMessages()
|
||||
{
|
||||
NAPI.Server.SetCommandErrorMessage(null);
|
||||
NAPI.Server.SetGlobalDefaultCommandMessages(false);
|
||||
}
|
||||
|
||||
public void SetGlobalChatEnabled(bool enable)
|
||||
{
|
||||
NAPI.Server.SetGlobalServerChat(enable);
|
||||
}
|
||||
|
||||
public void DisableDefaultSpawnBehavior()
|
||||
{
|
||||
NAPI.Server.SetAutoSpawnOnConnect(false);
|
||||
}
|
||||
|
||||
public IPlayer GetPlayerFromNameOrId(string nameOrId)
|
||||
{
|
||||
Player player;
|
||||
if (int.TryParse(nameOrId, out var playerId))
|
||||
{
|
||||
player = NAPI.Pools.GetAllPlayers().Where(u => u.Handle.Value == playerId).FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
player = NAPI.Player.GetPlayerFromName(nameOrId);
|
||||
}
|
||||
|
||||
if (player == null || player.Handle == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new RagePlayer(player);
|
||||
}
|
||||
|
||||
public void SetTime(int hour, int minute, int second)
|
||||
{
|
||||
NAPI.World.SetTime(hour, minute, second);
|
||||
}
|
||||
|
||||
public void TriggerClientEventForAll(string eventName, params object[] args)
|
||||
{
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("SERVER:" + eventName, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
ReallifeGamemode.Server.Core.RageMP/RageColShape.cs
Normal file
23
ReallifeGamemode.Server.Core.RageMP/RageColShape.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
public class RageColShape : RageEntity, IColShape
|
||||
{
|
||||
private GTANetworkAPI.ColShape colShape;
|
||||
|
||||
public RageColShape(GTANetworkAPI.ColShape colShape) : base(colShape)
|
||||
{
|
||||
this.colShape = colShape;
|
||||
|
||||
this.colShape.OnEntityEnterColShape += (c, p) => OnEntityEnter?.Invoke(this, new RagePlayer(p));
|
||||
this.colShape.OnEntityExitColShape += (c, p) => OnEntityExit?.Invoke(this, new RagePlayer(p));
|
||||
}
|
||||
|
||||
public event IColShape.ColShapeEvent OnEntityEnter;
|
||||
public event IColShape.ColShapeEvent OnEntityExit;
|
||||
}
|
||||
}
|
||||
21
ReallifeGamemode.Server.Core.RageMP/RageColShapeAPI.cs
Normal file
21
ReallifeGamemode.Server.Core.RageMP/RageColShapeAPI.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Core.API.API;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
class RageColShapeAPI : IColShapeAPI
|
||||
{
|
||||
public IColShape CreateCyclinder(Position position, float height, float range)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IColShape CreateSphere(Position position, float range)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
63
ReallifeGamemode.Server.Core.RageMP/RageEntity.cs
Normal file
63
ReallifeGamemode.Server.Core.RageMP/RageEntity.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Common;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
public class RageEntity : IEntity
|
||||
{
|
||||
|
||||
private readonly GTANetworkAPI.Entity entity;
|
||||
|
||||
public Position Position
|
||||
{
|
||||
get => entity.Position.ToPosition();
|
||||
set => entity.Position = value.ToVector3();
|
||||
}
|
||||
public Position Rotation
|
||||
{
|
||||
get => entity.Rotation.ToPosition();
|
||||
set => entity.Rotation = value.ToVector3();
|
||||
}
|
||||
|
||||
public ulong Handle => entity.Handle.Value;
|
||||
|
||||
public double Heading
|
||||
{
|
||||
get => Rotation.Z;
|
||||
set
|
||||
{
|
||||
var rotation = Rotation;
|
||||
rotation.Z = value;
|
||||
Rotation = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
public RageEntity(GTANetworkAPI.Entity rageEntity)
|
||||
{
|
||||
entity = rageEntity;
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
entity.Delete();
|
||||
}
|
||||
|
||||
public void SetSharedData<T>(string key, T data)
|
||||
{
|
||||
entity.SetSharedData(key, data.SerializeJson());
|
||||
}
|
||||
|
||||
public T GetSharedData<T>(string key, T fallback)
|
||||
{
|
||||
if (!entity.HasSharedData(key))
|
||||
{
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return (entity.GetSharedData<string>(key)).DeserializeJson<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
39
ReallifeGamemode.Server.Core.RageMP/RageExtensions.cs
Normal file
39
ReallifeGamemode.Server.Core.RageMP/RageExtensions.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
public static class RageExtensions
|
||||
{
|
||||
public static Vector3 ToVector3(this Position position)
|
||||
{
|
||||
return new Vector3(position.X, position.Y, position.Z);
|
||||
}
|
||||
|
||||
public static Position ToPosition(this Vector3 vector)
|
||||
{
|
||||
return new Position(vector.X, vector.Y, vector.Z);
|
||||
}
|
||||
|
||||
public static DisconnectReason ToDisconnectReason(this DisconnectionType disconnectionType)
|
||||
{
|
||||
switch (disconnectionType)
|
||||
{
|
||||
case DisconnectionType.Left:
|
||||
return DisconnectReason.Quit;
|
||||
|
||||
case DisconnectionType.Kicked:
|
||||
return DisconnectReason.Kick;
|
||||
|
||||
case DisconnectionType.Timeout:
|
||||
return DisconnectReason.Timeout;
|
||||
default:
|
||||
return DisconnectReason.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
79
ReallifeGamemode.Server.Core.RageMP/RagePlayer.cs
Normal file
79
ReallifeGamemode.Server.Core.RageMP/RagePlayer.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
public class RagePlayer : RageEntity, IPlayer
|
||||
{
|
||||
private readonly GTANetworkAPI.Player client;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => client.Name;
|
||||
set => client.Name = value;
|
||||
}
|
||||
|
||||
public string SocialClubName => client.SocialClubName;
|
||||
|
||||
public IPAddress RemoteAddress => IPAddress.Parse(client.Address);
|
||||
|
||||
public IVehicle Vehicle => client.IsInVehicle ? new RageVehicle(client.Vehicle) : null;
|
||||
|
||||
public VehicleSeat VehicleSeat => (VehicleSeat)client.VehicleSeat;
|
||||
|
||||
public bool IsInVehicle => Vehicle != null;
|
||||
|
||||
public int Health { get => client.Health; set => client.Health = value; }
|
||||
public int Armor { get => client.Armor; set => client.Armor = value; }
|
||||
|
||||
public RagePlayer(GTANetworkAPI.Player client) : base(client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public void SendRawMessage(string message)
|
||||
{
|
||||
client.SendChatMessage(message);
|
||||
}
|
||||
|
||||
public void TriggerEventRaw(string eventName, params object[] args)
|
||||
{
|
||||
client.TriggerEvent(eventName, args);
|
||||
}
|
||||
|
||||
public void SetIntoVehicle(IVehicle vehicle, VehicleSeat seat)
|
||||
{
|
||||
client.SetIntoVehicle(new GTANetworkAPI.NetHandle((ushort)vehicle.Handle, GTANetworkAPI.EntityType.Vehicle), (int)seat - 1);
|
||||
}
|
||||
|
||||
public void Kick() => client.Kick();
|
||||
|
||||
public void SendNotification(string message, bool flashing = true)
|
||||
{
|
||||
client.SendNotification(message, flashing);
|
||||
}
|
||||
|
||||
public void Spawn(Position position, float heading = 0)
|
||||
{
|
||||
Health = 100;
|
||||
Armor = 0;
|
||||
|
||||
Position = position;
|
||||
Heading = heading;
|
||||
}
|
||||
|
||||
public void PlayAnimation(string dict, string name, AnimationFlags flags, float speed = 8.0f)
|
||||
{
|
||||
GTANetworkAPI.NAPI.Player.PlayPlayerAnimation(client, (int)flags, dict, name, speed);
|
||||
}
|
||||
|
||||
public void CancelAnimation()
|
||||
{
|
||||
client.StopAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
ReallifeGamemode.Server.Core.RageMP/RageVehicle.cs
Normal file
30
ReallifeGamemode.Server.Core.RageMP/RageVehicle.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
class RageVehicle : RageEntity, IVehicle
|
||||
{
|
||||
private readonly Vehicle vehicle;
|
||||
|
||||
public RageVehicle(Vehicle vehicle) : base(vehicle)
|
||||
{
|
||||
this.vehicle = vehicle;
|
||||
}
|
||||
|
||||
public VehicleModel Model => (VehicleModel)vehicle.Model;
|
||||
|
||||
public sbyte PrimaryColor { get => (sbyte)vehicle.PrimaryColor; set => vehicle.PrimaryColor = value; }
|
||||
|
||||
public sbyte SecondaryColor { get => (sbyte)vehicle.SecondaryColor; set => vehicle.SecondaryColor = value; }
|
||||
|
||||
public void Repair()
|
||||
{
|
||||
vehicle.Repair();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
ReallifeGamemode.Server.Core.RageMP/RageVehicleAPI.cs
Normal file
22
ReallifeGamemode.Server.Core.RageMP/RageVehicleAPI.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Core.API.API;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
class RageVehicleAPI : IVehicleAPI
|
||||
{
|
||||
public IVehicle GetVehicleFromHandle(ulong handle)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IVehicle Spawn(VehicleModel model, Position position, Position rotation, sbyte primaryColor, sbyte secondaryColor)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Common\ReallifeGamemode.Server.Common.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core.API\ReallifeGamemode.Server.Core.API.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Bootstrapper">
|
||||
<HintPath>..\Import\Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
24
ReallifeGamemode.Server.Core/Commands/Command.cs
Normal file
24
ReallifeGamemode.Server.Core/Commands/Command.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Log;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.Commands
|
||||
{
|
||||
public abstract class Command
|
||||
{
|
||||
public abstract bool CanExecute(IPlayer player);
|
||||
|
||||
protected abstract IAPI Api { get; }
|
||||
protected ILogger Log { get; set; }
|
||||
public abstract string CommandName { get; }
|
||||
public virtual string HelpText { get; } = null;
|
||||
|
||||
public Command()
|
||||
{
|
||||
Log = LogManager.GetLogger(this.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
202
ReallifeGamemode.Server.Core/Commands/CommandHandler.cs
Normal file
202
ReallifeGamemode.Server.Core/Commands/CommandHandler.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Common;
|
||||
using ReallifeGamemode.Server.Log;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.Commands
|
||||
{
|
||||
class CommandHandler
|
||||
{
|
||||
private readonly Dictionary<string, Command> registeredCommands = new Dictionary<string, Command>();
|
||||
private readonly ILogger logger = LogManager.GetLogger<CommandHandler>();
|
||||
|
||||
private readonly IAPI api;
|
||||
|
||||
private Random random = new Random();
|
||||
|
||||
public CommandHandler(IAPI api)
|
||||
{
|
||||
this.api = api;
|
||||
Main.EventHandler.RegisterClientEvent("Command", OnPlayerCommand);
|
||||
}
|
||||
|
||||
private void OnPlayerCommand(IPlayer player, object[] args)
|
||||
{
|
||||
var command = (args.First() as string)?.ToString()?.ToLower();
|
||||
|
||||
logger.LogInformation("Player '{Name}' executed command '{command}'", player.Name, command);
|
||||
|
||||
if (!registeredCommands.ContainsKey(command))
|
||||
{
|
||||
player.SendMessage($"Der Befehl ~b~/{command}~s~ existiert nicht", ChatPrefix.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var executor = registeredCommands[command];
|
||||
|
||||
if (!executor.CanExecute(player))
|
||||
{
|
||||
player.SendMessage($"Du darfst diesen Befehl nicht ausführen", ChatPrefix.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var methodInfo = executor.GetType().GetMethod("Handle");
|
||||
|
||||
var arguments = new List<object>
|
||||
{
|
||||
player
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
arguments.AddRange(ComputeParameters(methodInfo, args.Skip(1).ToArray()));
|
||||
|
||||
var result = methodInfo.Invoke(executor, arguments.ToArray());
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
player.SendMessage($"Der Parameter ~y~'{ex.Message}'~s~ ist ungültig.", ChatPrefix.Error);
|
||||
}
|
||||
catch (SendHelpTextException)
|
||||
{
|
||||
player.SendMessage("/" + command + " " + executor.HelpText, ChatPrefix.Usage);
|
||||
}
|
||||
catch (TargetInvocationException ex)
|
||||
{
|
||||
var errorCode = GetNewErrorCode();
|
||||
ex.Data.Add("ErrorCode", errorCode);
|
||||
logger.LogError(ex, "Error (Code: {ErrorCode}) while executing command '{Command}' from user '{Name}'", errorCode, command, player.Name);
|
||||
player.SendMessage($"Bei der Ausführung des Befehls gab es einen unbekannten Fehler. ~m~({errorCode})", ChatPrefix.Error);
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterCommand(string command, Command commandExecutor)
|
||||
{
|
||||
command = command.ToLower();
|
||||
logger.LogDebug("Adding command '{command}'", command);
|
||||
|
||||
if (command.IsNullOrEmpty())
|
||||
{
|
||||
logger.LogError("Command name is null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (commandExecutor == null)
|
||||
{
|
||||
logger.LogError("Command executor for command '{command}' is null", command);
|
||||
return;
|
||||
}
|
||||
|
||||
var methodInfo = commandExecutor.GetType().GetMethod("Handle");
|
||||
|
||||
if (methodInfo == null)
|
||||
{
|
||||
logger.LogError("The executor for command '{command}' does not have a 'Handle' Method", command);
|
||||
return;
|
||||
}
|
||||
|
||||
registeredCommands[command] = commandExecutor;
|
||||
}
|
||||
|
||||
private object[] ComputeParameters(MethodInfo methodInfo, object[] arguments)
|
||||
{
|
||||
var computedParameters = new List<object>();
|
||||
|
||||
var parameterInfos = methodInfo.GetParameters();
|
||||
var parameterCount = parameterInfos.Length - 1;
|
||||
|
||||
var argumentCount = arguments.Length;
|
||||
|
||||
for (var i = 1; i <= parameterCount; i++)
|
||||
{
|
||||
var currentParameter = parameterInfos[i];
|
||||
|
||||
var parameterType = currentParameter.ParameterType;
|
||||
|
||||
object currentArgument;
|
||||
|
||||
if (i < argumentCount + 1)
|
||||
{
|
||||
currentArgument = arguments[i - 1];
|
||||
}
|
||||
else if (argumentCount <= (i - 1) && currentParameter.HasDefaultValue)
|
||||
{
|
||||
currentArgument = currentParameter.DefaultValue;
|
||||
computedParameters.Add(currentArgument);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandArgumentCountMismatchException();
|
||||
}
|
||||
|
||||
if (parameterType == typeof(IPlayer))
|
||||
{
|
||||
var player = api.GetPlayerFromNameOrId(currentArgument.ToString());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
throw new ArgumentException($"Der Spieler wurde nicht gefunden.");
|
||||
}
|
||||
|
||||
computedParameters.Add(player);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (parameterType == typeof(string))
|
||||
{
|
||||
if (i == parameterCount)
|
||||
{
|
||||
var str = string.Join(' ', arguments.Skip(i - 1));
|
||||
computedParameters.Add(str);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
computedParameters.Add(currentArgument);
|
||||
}
|
||||
}
|
||||
|
||||
if (parameterType.IsEnum)
|
||||
{
|
||||
var stringArg = currentArgument.ToString();
|
||||
if (stringArg.TryParseEnum(parameterType, out var result))
|
||||
{
|
||||
computedParameters.Add(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException(currentArgument.ToString());
|
||||
}
|
||||
}
|
||||
else if (parameterType.IsPrimitive)
|
||||
{
|
||||
try
|
||||
{
|
||||
computedParameters.Add(Convert.ChangeType(currentArgument, parameterType));
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new ArgumentException(currentArgument.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return computedParameters.ToArray();
|
||||
}
|
||||
|
||||
private string GetNewErrorCode()
|
||||
{
|
||||
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#?$";
|
||||
return new string(Enumerable.Repeat(chars, 6)
|
||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
70
ReallifeGamemode.Server.Core/Main.cs
Normal file
70
ReallifeGamemode.Server.Core/Main.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Core.Commands;
|
||||
using ReallifeGamemode.Server.Log;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core
|
||||
{
|
||||
public class Main
|
||||
{
|
||||
internal static IAPI API { get; private set; }
|
||||
internal static Events.EventHandler EventHandler { get; private set; }
|
||||
|
||||
private static List<Script> loadedScripts = new List<Script>();
|
||||
|
||||
private readonly ILogger logger = LogManager.GetLogger<Main>();
|
||||
|
||||
public Main(IAPI api, Events.EventHandler eventHandler)
|
||||
{
|
||||
logger.LogInformation("Loading scripts...");
|
||||
API = api;
|
||||
EventHandler = eventHandler;
|
||||
|
||||
LoadScript();
|
||||
LoadCommands();
|
||||
}
|
||||
|
||||
private void LoadScript()
|
||||
{
|
||||
var allTypes = Assembly.GetExecutingAssembly().GetTypes();
|
||||
var commandTypes = allTypes.Where(t => t.IsSubclassOf(typeof(Script)) && !t.IsAbstract);
|
||||
|
||||
foreach (var scriptType in commandTypes)
|
||||
{
|
||||
logger.LogDebug("Loading script '{FullName}'", scriptType.FullName);
|
||||
var script = Activator.CreateInstance(scriptType) as Script;
|
||||
loadedScripts.Add(script);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadCommands()
|
||||
{
|
||||
CommandHandler commandHandler = new CommandHandler(API);
|
||||
|
||||
var allTypes = Assembly.GetExecutingAssembly().GetTypes();
|
||||
var commandTypes = allTypes.Where(t => t.IsSubclassOf(typeof(Command)) && !t.IsAbstract);
|
||||
|
||||
foreach (var command in commandTypes)
|
||||
{
|
||||
var cmd = Activator.CreateInstance(command) as Command;
|
||||
commandHandler.RegisterCommand(cmd.CommandName, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public static DatabaseContext GetDbContext(bool useLoggerFactory = true)
|
||||
{
|
||||
return new DatabaseContext(useLoggerFactory ? LogManager.Factory : null);
|
||||
}
|
||||
|
||||
internal static TScript GetScript<TScript>() where TScript : Script
|
||||
{
|
||||
return loadedScripts.Where(s => s.GetType() == typeof(TScript)).First() as TScript;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReallifeGamemode.Database\ReallifeGamemode.Database.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Common\ReallifeGamemode.Server.Common.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core.API\ReallifeGamemode.Server.Core.API.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core.Events\ReallifeGamemode.Server.Core.Events.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Log\ReallifeGamemode.Server.Log.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Types\ReallifeGamemode.Server.Types.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
17
ReallifeGamemode.Server.Core/Script.cs
Normal file
17
ReallifeGamemode.Server.Core/Script.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core
|
||||
{
|
||||
internal abstract class Script
|
||||
{
|
||||
protected IAPI Api { get; } = Main.API;
|
||||
|
||||
public Script()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
27
ReallifeGamemode.Server.Types/AdminLevel.cs
Normal file
27
ReallifeGamemode.Server.Types/AdminLevel.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public enum AdminLevel
|
||||
{
|
||||
[EnumMember(Value = "None")]
|
||||
None = 0,
|
||||
[EnumMember(Value = "Team")]
|
||||
Team = 1,
|
||||
[EnumMember(Value = "Supporter")]
|
||||
Support = 2,
|
||||
[EnumMember(Value = "Administrator (1)")]
|
||||
Admin_1 = 3,
|
||||
[EnumMember(Value = "Administrator (2)")]
|
||||
Admin_2 = 4,
|
||||
[EnumMember(Value = "Administrator (3)")]
|
||||
Admin_3 = 5,
|
||||
[EnumMember(Value = "Head-Administrator")]
|
||||
Headadmin = 6,
|
||||
[EnumMember(Value = "Projektleiter")]
|
||||
Project_Lead = 7,
|
||||
}
|
||||
}
|
||||
16
ReallifeGamemode.Server.Types/AnimationFlags.cs
Normal file
16
ReallifeGamemode.Server.Types/AnimationFlags.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
[Flags]
|
||||
public enum AnimationFlags
|
||||
{
|
||||
Loop = 1 << 0,
|
||||
StopOnLastFrame = 1 << 1,
|
||||
OnlyAnimateUpperBody = 1 << 4,
|
||||
AllowPlayerControl = 1 << 5,
|
||||
Cancellable = 1 << 7
|
||||
}
|
||||
}
|
||||
22
ReallifeGamemode.Server.Types/ChatPrefix.cs
Normal file
22
ReallifeGamemode.Server.Types/ChatPrefix.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public enum ChatPrefix
|
||||
{
|
||||
None,
|
||||
[EnumMember(Value = "~m~Benutzung:~s~ ")]
|
||||
Usage,
|
||||
[EnumMember(Value = "~b~[ADMIN]~s~ ")]
|
||||
Admin,
|
||||
[EnumMember(Value = "~b~[INFO]~s~ ")]
|
||||
Info,
|
||||
[EnumMember(Value = "~y~[WARNUNG]~s~ ")]
|
||||
Warning,
|
||||
[EnumMember(Value = "~r~[FEHLER]~s~ ")]
|
||||
Error
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public class CommandArgumentCountMismatchException : Exception
|
||||
{
|
||||
}
|
||||
|
||||
public class SendHelpTextException : Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
14
ReallifeGamemode.Server.Types/DisconnectReason.cs
Normal file
14
ReallifeGamemode.Server.Types/DisconnectReason.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public enum DisconnectReason
|
||||
{
|
||||
Unknown,
|
||||
Quit,
|
||||
Timeout,
|
||||
Kick
|
||||
}
|
||||
}
|
||||
18
ReallifeGamemode.Server.Types/GroupRank.cs
Normal file
18
ReallifeGamemode.Server.Types/GroupRank.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public enum GroupRank
|
||||
{
|
||||
None,
|
||||
[EnumMember(Value = "Mitglied")]
|
||||
Member,
|
||||
[EnumMember(Value = "Manager")]
|
||||
Manager,
|
||||
[EnumMember(Value = "Leiter")]
|
||||
Leader
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
13
ReallifeGamemode.Server.Types/VehicleData.cs
Normal file
13
ReallifeGamemode.Server.Types/VehicleData.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public class VehicleData
|
||||
{
|
||||
public bool EngineState { get; set; }
|
||||
|
||||
public bool Locked { get; set; }
|
||||
}
|
||||
}
|
||||
682
ReallifeGamemode.Server.Types/VehicleModel.cs
Normal file
682
ReallifeGamemode.Server.Types/VehicleModel.cs
Normal file
@@ -0,0 +1,682 @@
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public enum VehicleModel : uint
|
||||
{
|
||||
Chimera = 6774487,
|
||||
Carbonrs = 11251904,
|
||||
Hermes = 15219735,
|
||||
Virgo3 = 16646064,
|
||||
Hotknife = 37348240,
|
||||
Tiptruck = 48339065,
|
||||
Faggio2 = 55628203,
|
||||
Youga = 65402552,
|
||||
Glendale = 75131841,
|
||||
Dominator = 80636076,
|
||||
Bf400 = 86520421,
|
||||
Kalahari = 92612664,
|
||||
Trophytruck = 101905590,
|
||||
Coquette = 108773431,
|
||||
Btype = 117401876,
|
||||
Boxville3 = 121658888,
|
||||
Baller2 = 142944341,
|
||||
Ardent = 159274291,
|
||||
Miljet = 165154707,
|
||||
Phantom3 = 177270108,
|
||||
Freightcar = 184361638,
|
||||
Elegy = 196747873,
|
||||
Speedo4 = 219613597,
|
||||
Cheetah2 = 223240013,
|
||||
Sabregt2 = 223258115,
|
||||
Speeder = 231083307,
|
||||
Reaper = 234062309,
|
||||
Buffalo3 = 237764926,
|
||||
Freightcont2 = 240201337,
|
||||
Tempesta = 272929391,
|
||||
Dinghy2 = 276773164,
|
||||
Tropic = 290013743,
|
||||
Gburrito2 = 296357396,
|
||||
Hexer = 301427732,
|
||||
Dynasty = 310284501,
|
||||
Stafford = 321186144,
|
||||
Crusader = 321739290,
|
||||
Cogcabrio = 330661258,
|
||||
Vacca = 338562499,
|
||||
Pbus2 = 345756458,
|
||||
Gauntlet2 = 349315417,
|
||||
Chino = 349605904,
|
||||
Polmav = 353883353,
|
||||
Proptrailer = 356391690,
|
||||
Cargoplane = 368211810,
|
||||
Slamvan5 = 373261600,
|
||||
Surano = 384071873,
|
||||
Hauler2 = 387748548,
|
||||
Cliffhanger = 390201602,
|
||||
Raketrailer = 390902130,
|
||||
Squalo = 400514754,
|
||||
Turismor = 408192225,
|
||||
Avenger2 = 408970549,
|
||||
Kuruma2 = 410882957,
|
||||
Infernus = 418536135,
|
||||
Nightshark = 433954513,
|
||||
Speeder2 = 437538602,
|
||||
Boxville4 = 444171386,
|
||||
Handler = 444583674,
|
||||
Imperator = 444994115,
|
||||
Volatol = 447548909,
|
||||
Cruiser = 448402357,
|
||||
Policet = 456714581,
|
||||
Tornado = 464687292,
|
||||
Lguard = 469291905,
|
||||
Baller5 = 470404958,
|
||||
Mixer2 = 475220373,
|
||||
Lynx = 482197771,
|
||||
Huntley = 486987393,
|
||||
Fusilade = 499169875,
|
||||
Swinger = 500482303,
|
||||
Dinghy3 = 509498602,
|
||||
Utillitruck = 516990260,
|
||||
Voodoo2 = 523724515,
|
||||
Boattrailer = 524108981,
|
||||
Moonbeam = 525509695,
|
||||
Dune2 = 534258863,
|
||||
Zr380 = 540101442,
|
||||
Khamelion = 544021352,
|
||||
Apc = 562680400,
|
||||
Packer = 569305213,
|
||||
Tankercar = 586013744,
|
||||
Hustler = 600450546,
|
||||
Luxor = 621481054,
|
||||
Romero = 627094268,
|
||||
Fcr = 627535535,
|
||||
Issi4 = 628003514,
|
||||
Barracks3 = 630371791,
|
||||
Banshee2 = 633712403,
|
||||
Baller4 = 634118882,
|
||||
Lectro = 640818791,
|
||||
Freightgrain = 642617954,
|
||||
Comet5 = 661493923,
|
||||
Baller6 = 666166960,
|
||||
Bruiser = 668439077,
|
||||
Cerberus2 = 679453769,
|
||||
Boxville5 = 682434785,
|
||||
Contender = 683047626,
|
||||
Drafter = 686471183,
|
||||
Surfer = 699456151,
|
||||
Cog552 = 704435172,
|
||||
Supervolito = 710198397,
|
||||
Trailersmall = 712162987,
|
||||
Ruston = 719660200,
|
||||
Gauntlet3 = 722226637,
|
||||
Dukes = 723973206,
|
||||
Speedo2 = 728614474,
|
||||
Slamvan = 729783779,
|
||||
Sadler2 = 734217681,
|
||||
Buffalo2 = 736902334,
|
||||
Gargoyle = 741090084,
|
||||
Pranger = 741586030,
|
||||
Sovereign = 743478836,
|
||||
Frogger = 744705981,
|
||||
Buzzard2 = 745926877,
|
||||
Ztype = 758895617,
|
||||
Alpha = 767087018,
|
||||
Submersible = 771711535,
|
||||
Ruiner3 = 777714999,
|
||||
Rhino = 782665360,
|
||||
Coquette3 = 784565758,
|
||||
Sanchez = 788045382,
|
||||
Buzzard = 788747387,
|
||||
Sheava = 819197656,
|
||||
Defiler = 822018448,
|
||||
Slamvan2 = 833469436,
|
||||
Annihilator = 837858166,
|
||||
Z190 = 838982985,
|
||||
Monster4 = 840387324,
|
||||
Rhapsody = 841808271,
|
||||
Bjxl = 850565707,
|
||||
Biff = 850991848,
|
||||
Jetmax = 861409633,
|
||||
Dinghy4 = 867467158,
|
||||
Pariah = 867799010,
|
||||
Metrotrain = 868868440,
|
||||
Sentinel2 = 873639469,
|
||||
Habanero = 884422927,
|
||||
Oppressor = 884483972,
|
||||
Stromberg = 886810209,
|
||||
Intruder = 886934177,
|
||||
Utillitruck2 = 887537515,
|
||||
Burrito4 = 893081117,
|
||||
Savestra = 903794909,
|
||||
Mule = 904750859,
|
||||
Cog55 = 906642318,
|
||||
Toro2 = 908897389,
|
||||
Mesa = 914654722,
|
||||
Rrocket = 916547552,
|
||||
Xa21 = 917809321,
|
||||
Freightcont1 = 920453016,
|
||||
Issi3 = 931280609,
|
||||
Ruiner2 = 941494461,
|
||||
Casco = 941800958,
|
||||
Pony2 = 943752001,
|
||||
Duster = 970356638,
|
||||
Hydra = 970385471,
|
||||
Sultan = 970598228,
|
||||
Tampa = 972671128,
|
||||
Voltic2 = 989294410,
|
||||
Sandking2 = 989381445,
|
||||
Impaler2 = 1009171724,
|
||||
Coquette2 = 1011753235,
|
||||
Graintrailer = 1019737494,
|
||||
Youga2 = 1026149675,
|
||||
Freight = 1030400667,
|
||||
Tezeract = 1031562256,
|
||||
Ninef = 1032823388,
|
||||
Dinghy = 1033245328,
|
||||
Nero = 1034187331,
|
||||
Nokota = 1036591958,
|
||||
Blista2 = 1039032026,
|
||||
Tula = 1043222410,
|
||||
Thrax = 1044193113,
|
||||
Skylift = 1044954915,
|
||||
Michelli = 1046206681,
|
||||
Jb700 = 1051415893,
|
||||
Jet = 1058115860,
|
||||
Bobcatxl = 1069929536,
|
||||
Toro = 1070967343,
|
||||
Barracks2 = 1074326203,
|
||||
Specter2 = 1074745671,
|
||||
Swift2 = 1075432268,
|
||||
Velum2 = 1077420264,
|
||||
Pigalle = 1078682497,
|
||||
Nero2 = 1093792632,
|
||||
Verlierer2 = 1102544804,
|
||||
Sentinel3 = 1104234922,
|
||||
Hotring = 1115909093,
|
||||
Slamvan3 = 1119641113,
|
||||
Superd = 1123216662,
|
||||
Bfinjection = 1126868326,
|
||||
Fbi = 1127131465,
|
||||
Tribike = 1127861609,
|
||||
BMX = 1131912276,
|
||||
Burrito5 = 1132262048,
|
||||
Caddy = 1147287684,
|
||||
Rumpo = 1162065741,
|
||||
Ambulance = 1171614426,
|
||||
Dubsta = 1177543287,
|
||||
Technical2 = 1180875963,
|
||||
Akula = 1181327175,
|
||||
Xls = 1203490606,
|
||||
Seminole = 1221512915,
|
||||
Marshall = 1233534620,
|
||||
Gp1 = 1234311532,
|
||||
Issi6 = 1239571361,
|
||||
Caracara = 1254014755,
|
||||
Hakuchou = 1265391242,
|
||||
Landstalker = 1269098716,
|
||||
Bestiagts = 1274868363,
|
||||
Deviant = 1279262537,
|
||||
Airbus = 1283517198,
|
||||
Emerus = 1323778901,
|
||||
Serrano = 1337041428,
|
||||
Vestra = 1341619767,
|
||||
Oracle = 1348744438,
|
||||
Sentinel = 1349725314,
|
||||
Sc1 = 1352136073,
|
||||
Flatbed = 1353720154,
|
||||
Technical3 = 1356124575,
|
||||
Warrener = 1373123368,
|
||||
Cyclone = 1392481335,
|
||||
Cargobob3 = 1394036463,
|
||||
Paragon2 = 1416466158,
|
||||
Fmj = 1426219628,
|
||||
Tractor3 = 1445631933,
|
||||
Tropic2 = 1448677353,
|
||||
Tulip = 1456744817,
|
||||
Rumpo3 = 1475773103,
|
||||
Deluxo = 1483171323,
|
||||
Paradise = 1488164764,
|
||||
Thruster = 1489874736,
|
||||
Schafter4 = 1489967196,
|
||||
Sanctus = 1491277511,
|
||||
Forklift = 1491375716,
|
||||
Trailerlarge = 1502869817,
|
||||
Torero = 1504306544,
|
||||
Picador = 1507916787,
|
||||
Hauler = 1518533038,
|
||||
Tornado2 = 1531094468,
|
||||
Issi5 = 1537277726,
|
||||
Scarab2 = 1542143200,
|
||||
Valkyrie2 = 1543134283,
|
||||
Stinger = 1545842587,
|
||||
Brioso = 1549126457,
|
||||
Airtug = 1560980623,
|
||||
Comet4 = 1561920505,
|
||||
Molotok = 1565978651,
|
||||
Windsor = 1581459400,
|
||||
Deveste = 1591739866,
|
||||
Fagaloa = 1617472902,
|
||||
Cargobob2 = 1621617168,
|
||||
Imperator2 = 1637620610,
|
||||
Tractor = 1641462412,
|
||||
Rancherxl = 1645267888,
|
||||
Pounder2 = 1653666139,
|
||||
T20 = 1663218586,
|
||||
Akuma = 1672195559,
|
||||
Dilettante2 = 1682114128,
|
||||
Strikeforce = 1692272545,
|
||||
Monster3 = 1721676810,
|
||||
Stratum = 1723137093,
|
||||
Rapidgt2 = 1737773231,
|
||||
Bison3 = 1739845664,
|
||||
Streiter = 1741861769,
|
||||
Slamvan6 = 1742022738,
|
||||
Stockade = 1747439474,
|
||||
Enduro = 1753414259,
|
||||
Tornado3 = 1762279763,
|
||||
Dloader = 1770332643,
|
||||
Washington = 1777363799,
|
||||
Mower = 1783355638,
|
||||
Tr3 = 1784254509,
|
||||
Diablous2 = 1790834270,
|
||||
Besra = 1824333165,
|
||||
Peyote = 1830407356,
|
||||
Thrust = 1836027715,
|
||||
Retinue = 1841130506,
|
||||
Issi7 = 1854776567,
|
||||
Zion3 = 1862507111,
|
||||
Yosemite = 1871995513,
|
||||
Ratbike = 1873600305,
|
||||
Camper = 1876516712,
|
||||
Baller3 = 1878062887,
|
||||
Specter = 1886268224,
|
||||
Bulldozer = 1886712733,
|
||||
Tropos = 1887331236,
|
||||
Moonbeam2 = 1896491931,
|
||||
Dune3 = 1897744184,
|
||||
Fugitive = 1909141499,
|
||||
Gb200 = 1909189272,
|
||||
Cerberus3 = 1909700336,
|
||||
Police3 = 1912215274,
|
||||
Trash = 1917016601,
|
||||
Schafter6 = 1922255844,
|
||||
Sheriff2 = 1922257928,
|
||||
Stalion = 1923400478,
|
||||
Rancherxl2 = 1933662059,
|
||||
Gauntlet4 = 1934384720,
|
||||
Firetruk = 1938952078,
|
||||
Vagner = 1939284556,
|
||||
Tourbus = 1941029835,
|
||||
Mule4 = 1945374990,
|
||||
Frogger2 = 1949211328,
|
||||
Taco = 1951180813,
|
||||
Tanker2 = 1956216962,
|
||||
Titan = 1981688531,
|
||||
Osiris = 1987142870,
|
||||
Daemon = 2006142190,
|
||||
Voodoo = 2006667053,
|
||||
Cavalcade = 2006918058,
|
||||
Trailerlogs = 2016027501,
|
||||
Futo = 2016857647,
|
||||
Cargobob4 = 2025593404,
|
||||
Esskey = 2035069708,
|
||||
Brutus3 = 2038858402,
|
||||
Menacer = 2044532910,
|
||||
Police = 2046537925,
|
||||
Rapidgt3 = 2049897956,
|
||||
Benson = 2053223216,
|
||||
Tyrus = 2067820283,
|
||||
Lurcher = 2068293287,
|
||||
Oppressor2 = 2069146067,
|
||||
Insurgent2 = 2071877360,
|
||||
Bison2 = 2072156101,
|
||||
Carbonizzare = 2072687711,
|
||||
Tr2 = 2078290630,
|
||||
Tr4 = 2091594960,
|
||||
Pounder = 2112052861,
|
||||
Prototipo = 2123327359,
|
||||
Utillitruck3 = 2132890591,
|
||||
Rocoto = 2136773105,
|
||||
Brutus = 2139203625,
|
||||
Bagger = 2154536131,
|
||||
Docktrailer = 2154757102,
|
||||
Phantom = 2157618379,
|
||||
Dump = 2164484578,
|
||||
Blazer = 2166734073,
|
||||
Manana = 2170765704,
|
||||
Stunt = 2172210288,
|
||||
Entity2 = 2174267100,
|
||||
Faction = 2175389151,
|
||||
Avenger = 2176659152,
|
||||
Avarus = 2179174271,
|
||||
Guardian = 2186977100,
|
||||
Rallytruck = 2191146052,
|
||||
Tug = 2194326579,
|
||||
Stingergt = 2196019706,
|
||||
Technical = 2198148358,
|
||||
Impaler = 2198276962,
|
||||
Phoenix = 2199527893,
|
||||
Gt500 = 2215179066,
|
||||
Tractor2 = 2218488798,
|
||||
Coach = 2222034228,
|
||||
Mesa3 = 2230595153,
|
||||
Slamvan4 = 2233918197,
|
||||
Trailers3 = 2236089197,
|
||||
Mule3 = 2242229361,
|
||||
Italigtb = 2246633323,
|
||||
Rebel2 = 2249373259,
|
||||
Bruiser3 = 2252616474,
|
||||
Primo2 = 2254540506,
|
||||
Faction3 = 2255212070,
|
||||
Tornado4 = 2261744861,
|
||||
Cognoscenti = 2264796000,
|
||||
Comet3 = 2272483501,
|
||||
Pbus = 2287941233,
|
||||
Feltzer2 = 2299640309,
|
||||
Terbyte = 2306538597,
|
||||
Boxville = 2307837162,
|
||||
Havok = 2310691317,
|
||||
Police4 = 2321795001,
|
||||
Stretch = 2333339779,
|
||||
Nightshade = 2351681756,
|
||||
Rapidgt = 2360515092,
|
||||
Windsor2 = 2364918497,
|
||||
Impaler3 = 2370166601,
|
||||
Insurgent3 = 2370534026,
|
||||
Wastelander = 2382949506,
|
||||
Asterope = 2391954683,
|
||||
Surge = 2400073108,
|
||||
Brutus2 = 2403970600,
|
||||
Premier = 2411098011,
|
||||
Emperor2 = 2411965148,
|
||||
Trailersmall2 = 2413121211,
|
||||
Insurgent = 2434067162,
|
||||
Neon = 2445973230,
|
||||
Volatus = 2449479409,
|
||||
Faggio = 2452219115,
|
||||
Pfister811 = 2465164804,
|
||||
Novak = 2465530446,
|
||||
Deathbike2 = 2482017624,
|
||||
Asea = 2485144969,
|
||||
Asea2 = 2487343317,
|
||||
Peyote2 = 2490551588,
|
||||
Gauntlet = 2494797253,
|
||||
Tornado5 = 2497353967,
|
||||
Faction2 = 2504420315,
|
||||
Policeold2 = 2515846680,
|
||||
Rumpo2 = 2518351607,
|
||||
Granger = 2519238556,
|
||||
Tvtrailer = 2524324030,
|
||||
Microlight = 2531412055,
|
||||
Penetrator = 2536829930,
|
||||
Seven70 = 2537130571,
|
||||
Mammatus = 2548391185,
|
||||
Gburrito = 2549763894,
|
||||
Impaler4 = 2550461639,
|
||||
Burrito3 = 2551651283,
|
||||
Rubble = 2589662668,
|
||||
Starling = 2594093022,
|
||||
Scrap = 2594165727,
|
||||
Bullet = 2598821281,
|
||||
Bruiser2 = 2600885406,
|
||||
Riot2 = 2601952180,
|
||||
Sabregt = 2609945748,
|
||||
Sheriff = 2611638396,
|
||||
Velum = 2621610858,
|
||||
Supervolito2 = 2623428164,
|
||||
Double = 2623969160,
|
||||
Dune = 2633113103,
|
||||
Mamba = 2634021974,
|
||||
Maverick = 2634305738,
|
||||
Radi = 2643899483,
|
||||
Phantom2 = 2645431192,
|
||||
Fbi2 = 2647026068,
|
||||
Armytrailer2 = 2657817814,
|
||||
Police2 = 2667966721,
|
||||
Voltic = 2672523198,
|
||||
Neo = 2674840994,
|
||||
Nightblade = 2688780135,
|
||||
Valkyrie = 2694714877,
|
||||
Blazer5 = 2704629607,
|
||||
Trailers2 = 2715434129,
|
||||
Feltzer3 = 2728226064,
|
||||
Clique = 2728360112,
|
||||
Tornado6 = 2736567667,
|
||||
Gresley = 2751205197,
|
||||
Policeold1 = 2758042359,
|
||||
Riata = 2762269779,
|
||||
Raiden = 2765724541,
|
||||
Alphaz1 = 2771347558,
|
||||
Manchez = 2771538552,
|
||||
Schafter3 = 2809443750,
|
||||
Brawler = 2815302597,
|
||||
Zr3803 = 2816263004,
|
||||
Stanier = 2817386317,
|
||||
Armytrailer = 2818520053,
|
||||
Ninef2 = 2833484545,
|
||||
Sanchez2 = 2841686334,
|
||||
Prairie = 2844316578,
|
||||
Bodhi2 = 2859047862,
|
||||
Khanjali = 2859440138,
|
||||
Infernus2 = 2889029532,
|
||||
Daemon2 = 2890830793,
|
||||
Zentorno = 2891838741,
|
||||
Pyro = 2908775872,
|
||||
Dominator5 = 2919906639,
|
||||
Deathbike3 = 2920466844,
|
||||
Kuruma = 2922118804,
|
||||
Chino2 = 2933279331,
|
||||
Vindicator = 2941886209,
|
||||
Trflat = 2942498482,
|
||||
Caracara2 = 2945871676,
|
||||
Burrito = 2948279460,
|
||||
Towtruck = 2971866336,
|
||||
Surfer2 = 2983726598,
|
||||
Cheetah = 2983812512,
|
||||
Jester = 2997294755,
|
||||
Nimbus = 2999939664,
|
||||
Dominator6 = 3001042683,
|
||||
Entityxf = 3003014393,
|
||||
Ingot = 3005245074,
|
||||
Faggio3 = 3005788552,
|
||||
Lazer = 3013282534,
|
||||
Blazer3 = 3025077634,
|
||||
Ellie = 3027423925,
|
||||
Flashgt = 3035832600,
|
||||
Trash2 = 3039269212,
|
||||
Schafter2 = 3039514899,
|
||||
Vigilante = 3052358707,
|
||||
Emperor3 = 3053254478,
|
||||
Dubsta3 = 3057713523,
|
||||
Tribike2 = 3061159916,
|
||||
Le7b = 3062131285,
|
||||
Adder = 3078201489,
|
||||
Shamal = 3080461301,
|
||||
Luxor2 = 3080673438,
|
||||
Tampa3 = 3084515313,
|
||||
Rebel = 3087195462,
|
||||
Armytanker = 3087536137,
|
||||
Blade = 3089165662,
|
||||
Riot = 3089277354,
|
||||
Zion2 = 3101863448,
|
||||
Sandking = 3105951696,
|
||||
Issi2 = 3117103977,
|
||||
Toros = 3126015148,
|
||||
Primo = 3144368207,
|
||||
Scarab = 3147997943,
|
||||
Fq2 = 3157435195,
|
||||
Taipan = 3160260734,
|
||||
Dilettante = 3164157193,
|
||||
Minivan2 = 3168702960,
|
||||
Zion = 3172678083,
|
||||
Jester2 = 3188613414,
|
||||
Zr3802 = 3188846534,
|
||||
Trailers4 = 3194418602,
|
||||
Rentalbus = 3196165219,
|
||||
Furoregt = 3205927392,
|
||||
Tampa2 = 3223586949,
|
||||
Submersible2 = 3228633070,
|
||||
Mule2 = 3244501995,
|
||||
Comet2 = 3249425686,
|
||||
Marquis = 3251507587,
|
||||
Banshee = 3253274834,
|
||||
Seashark = 3264692260,
|
||||
Buccaneer2 = 3281516360,
|
||||
Zombiea = 3285698347,
|
||||
Tailgater = 3286105550,
|
||||
Howard = 3287439187,
|
||||
Cutter = 3288047904,
|
||||
Visione = 3296789504,
|
||||
Cheburek = 3306466016,
|
||||
Dominator3 = 3308022675,
|
||||
Turismo2 = 3312836369,
|
||||
Rogue = 3319621991,
|
||||
Cablecar = 3334677549,
|
||||
Taxi = 3338918751,
|
||||
Tiptruck2 = 3347205726,
|
||||
Locust = 3353694737,
|
||||
Dominator2 = 3379262425,
|
||||
Pcj = 3385765638,
|
||||
Burrito2 = 3387490166,
|
||||
Dodo = 3393804037,
|
||||
Virgo2 = 3395457658,
|
||||
Ruffian = 3401388520,
|
||||
Bati2 = 3403504941,
|
||||
Schafter5 = 3406724313,
|
||||
Docktug = 3410276810,
|
||||
Nebula = 3412338231,
|
||||
Trailers = 3417488910,
|
||||
Ripley = 3448987385,
|
||||
Monster = 3449006043,
|
||||
Fixter = 3458454463,
|
||||
Btype2 = 3463132580,
|
||||
Dune4 = 3467805257,
|
||||
Vigero = 3469130167,
|
||||
Barracks = 3471458123,
|
||||
Speedo = 3484649228,
|
||||
Baller = 3486135912,
|
||||
Patriot = 3486509883,
|
||||
Cerberus = 3493417227,
|
||||
Cavalcade2 = 3505073125,
|
||||
Mixer = 3510150843,
|
||||
Freighttrailer = 3517691494,
|
||||
Omnis = 3517794615,
|
||||
Caddy3 = 3525819835,
|
||||
Fcr2 = 3537231886,
|
||||
Imperator3 = 3539435063,
|
||||
Mogul = 3545667823,
|
||||
Mesa2 = 3546958660,
|
||||
Schwarzer = 3548084598,
|
||||
Tanker = 3564062519,
|
||||
Seasparrow = 3568198617,
|
||||
Monster5 = 3579220348,
|
||||
Bus = 3581397346,
|
||||
Chernobog = 3602674979,
|
||||
Dominator4 = 3606777648,
|
||||
Emperor = 3609690755,
|
||||
Buccaneer = 3612755468,
|
||||
Zorrusso = 3612858749,
|
||||
Raptor = 3620039993,
|
||||
Ratloader = 3627815886,
|
||||
Krieger = 3630826055,
|
||||
Trophytruck2 = 3631668194,
|
||||
Cuban800 = 3650256867,
|
||||
Scramjet = 3656405053,
|
||||
Nemesis = 3660088182,
|
||||
Massacro2 = 3663206819,
|
||||
Jackal = 3670438162,
|
||||
Wolfsbane = 3676349299,
|
||||
Seashark2 = 3678636260,
|
||||
Blimp2 = 3681241380,
|
||||
Vortex = 3685342204,
|
||||
Cognoscenti2 = 3690124666,
|
||||
Btype3 = 3692679425,
|
||||
Sadler = 3695398481,
|
||||
Blista3 = 3703315515,
|
||||
F620 = 3703357000,
|
||||
Ratloader2 = 3705788919,
|
||||
Scarab3 = 3715219435,
|
||||
Zombieb = 3724934023,
|
||||
Elegy2 = 3728579874,
|
||||
Caddy2 = 3757070668,
|
||||
Oracle2 = 3783366066,
|
||||
Schlagen = 3787471536,
|
||||
Virgo = 3796912450,
|
||||
Predator = 3806844075,
|
||||
Italigtb2 = 3812247419,
|
||||
Paragon = 3847255899,
|
||||
Towtruck2 = 3852654278,
|
||||
Blazer4 = 3854198872,
|
||||
Monroe = 3861591579,
|
||||
Xls2 = 3862958888,
|
||||
Panto = 3863274624,
|
||||
Patriot2 = 3874056184,
|
||||
Revolter = 3884762073,
|
||||
Shotaro = 3889340782,
|
||||
Stalion2 = 3893323758,
|
||||
Tribike3 = 3894672200,
|
||||
Baletrailer = 3895125590,
|
||||
Dubsta2 = 3900892662,
|
||||
Seabreeze = 3902291871,
|
||||
Viseris = 3903371924,
|
||||
Felon = 3903372712,
|
||||
Penumbra = 3917501776,
|
||||
Tyrant = 3918533058,
|
||||
Hellion = 3932816511,
|
||||
Bifta = 3945366167,
|
||||
Blista = 3950024287,
|
||||
Swift = 3955379698,
|
||||
Italigto = 3963499524,
|
||||
Dukes2 = 3968823444,
|
||||
S80 = 3970348707,
|
||||
Autarch = 3981782132,
|
||||
Dune5 = 3982671785,
|
||||
Seashark3 = 3983945033,
|
||||
Minivan = 3984502180,
|
||||
Blimp3 = 3987008919,
|
||||
Brickade = 3989239879,
|
||||
Buffalo = 3990165190,
|
||||
Sultanrs = 3999278268,
|
||||
Rcbandito = 4008920556,
|
||||
Suntrap = 4012021193,
|
||||
Hakuchou2 = 4039289119,
|
||||
Diablous = 4055125828,
|
||||
Boxville2 = 4061868990,
|
||||
Ruiner = 4067225593,
|
||||
Jester3 = 4080061290,
|
||||
Stockade3 = 4080511798,
|
||||
Barrage = 4081974053,
|
||||
Jugular = 4086055493,
|
||||
Scorcher = 4108429845,
|
||||
Innovation = 4135840458,
|
||||
Blimp = 4143991942,
|
||||
Massacro = 4152024626,
|
||||
Vader = 4154065143,
|
||||
Kamacho = 4173521127,
|
||||
Journey = 4174679674,
|
||||
Pony = 4175309224,
|
||||
Limo2 = 4180339789,
|
||||
Bati = 4180675781,
|
||||
Felon2 = 4205676014,
|
||||
Savage = 4212341271,
|
||||
Freecrawler = 4240635011,
|
||||
Cargobob = 4244420235,
|
||||
Vamos = 4245851645,
|
||||
Blazer2 = 4246935337,
|
||||
Hunter = 4252008158,
|
||||
Policeb = 4260343491,
|
||||
Bombushka = 4262088844,
|
||||
Halftrack = 4262731174,
|
||||
Deathbike = 4267640610,
|
||||
Bison = 4278019151,
|
||||
Regina = 4280472072,
|
||||
Exemplar = 4289813342,
|
||||
Asbo = 0x42ACA95F,
|
||||
Kanjo = 0x18619B7E,
|
||||
Minitank = 0xB53C6C52,
|
||||
Yosemite2 = 0x64F49967,
|
||||
Rebla = 0x4F48FC4,
|
||||
Imorgon = 0xBC7C0A00,
|
||||
Vstr = 0x56CDEE7D,
|
||||
Formula = 0x1446590A,
|
||||
Forumla2 = 0x8B213907,
|
||||
}
|
||||
}
|
||||
18
ReallifeGamemode.Server.Types/VehicleSeat.cs
Normal file
18
ReallifeGamemode.Server.Types/VehicleSeat.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Types
|
||||
{
|
||||
public enum VehicleSeat
|
||||
{
|
||||
Driver,
|
||||
CoDriver,
|
||||
LeftPassenger,
|
||||
RightPassenger,
|
||||
ExtraSeat1,
|
||||
ExtraSeat2,
|
||||
ExtraSeat3,
|
||||
ExtraSeat4
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,11 @@ using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Wanted;
|
||||
using ReallifeGamemode.Server.DrivingSchool;
|
||||
using ReallifeGamemode.Server.WeaponDeal;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Core.RageMP;
|
||||
using ReallifeGamemode.Server.Core.Events;
|
||||
using System.Collections.Generic;
|
||||
using ReallifeGamemode.Server.Common;
|
||||
using ReallifeGamemode.Server.Job;
|
||||
|
||||
/**
|
||||
@@ -25,9 +30,16 @@ namespace ReallifeGamemode.Server
|
||||
|
||||
public static readonly CultureInfo SERVER_CULTURE = new CultureInfo("de-DE");
|
||||
|
||||
private EventHandler eventHandler;
|
||||
|
||||
[ServerEvent(Event.ResourceStart)]
|
||||
public void OnResourceStart()
|
||||
{
|
||||
IAPI apiInstance = new RageAPI();
|
||||
eventHandler = new EventHandler(apiInstance);
|
||||
|
||||
new Core.Main(apiInstance, eventHandler);
|
||||
|
||||
NAPI.Server.SetGlobalServerChat(false);
|
||||
|
||||
NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
|
||||
@@ -83,9 +95,13 @@ namespace ReallifeGamemode.Server
|
||||
Jail.JailTimer();
|
||||
Economy.PaydayTimer();
|
||||
WeaponDealManager.WeaponDealTimer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[RemoteEvent("CLIENT:Event")]
|
||||
public void OnClientEvent(Player player, string dataStr)
|
||||
{
|
||||
var data = dataStr.DeserializeJson<List<object>>();
|
||||
eventHandler.HandleEvent(new RagePlayer(player), data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<Configurations>Debug;Release;ServerBuild</Configurations>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
@@ -29,6 +29,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReallifeGamemode.Database\ReallifeGamemode.Database.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Common\ReallifeGamemode.Server.Common.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core.API\ReallifeGamemode.Server.Core.API.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core.Events\ReallifeGamemode.Server.Core.Events.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core.RageMP\ReallifeGamemode.Server.Core.RageMP.csproj" />
|
||||
<ProjectReference Include="..\ReallifeGamemode.Server.Core\ReallifeGamemode.Server.Core.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Bootstrapper">
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<Configurations>Debug;Release;ServerBuild</Configurations>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -24,6 +24,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.Services",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.DataService", "ReallifeGamemode.DataService\ReallifeGamemode.DataService.csproj", "{61157B05-135C-40C5-B694-5F27CE53B334}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.Server.Core", "ReallifeGamemode.Server.Core\ReallifeGamemode.Server.Core.csproj", "{AABE0834-13E9-429F-8309-E5C94D288FCF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.Server.Types", "ReallifeGamemode.Server.Types\ReallifeGamemode.Server.Types.csproj", "{A8FD9510-4E75-4668-A5AA-121AF15191EC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.Server.Common", "ReallifeGamemode.Server.Common\ReallifeGamemode.Server.Common.csproj", "{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.Server.Core.RageMP", "ReallifeGamemode.Server.Core.RageMP\ReallifeGamemode.Server.Core.RageMP.csproj", "{B34B85E7-CB90-43F6-8B65-492207B776B6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReallifeGamemode.Server.Core.Events", "ReallifeGamemode.Server.Core.Events\ReallifeGamemode.Server.Core.Events.csproj", "{1B0E8256-B764-45C0-817E-B382CD868324}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReallifeGamemode.Server.Core.API", "ReallifeGamemode.Server.Core.API\ReallifeGamemode.Server.Core.API.csproj", "{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReallifeGamemode.Server.Log", "ReallifeGamemode.Server.Log\ReallifeGamemode.Server.Log.csproj", "{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -94,6 +108,90 @@ Global
|
||||
{61157B05-135C-40C5-B694-5F27CE53B334}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{61157B05-135C-40C5-B694-5F27CE53B334}.ServerBuild|x64.ActiveCfg = Release|x64
|
||||
{61157B05-135C-40C5-B694-5F27CE53B334}.ServerBuild|x64.Build.0 = Release|x64
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.ServerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||
{AABE0834-13E9-429F-8309-E5C94D288FCF}.ServerBuild|x64.Build.0 = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.ServerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||
{A8FD9510-4E75-4668-A5AA-121AF15191EC}.ServerBuild|x64.Build.0 = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.ServerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||
{EBAA6BA3-DD62-4FE2-927A-7EA7C9CAD996}.ServerBuild|x64.Build.0 = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.ServerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||
{B34B85E7-CB90-43F6-8B65-492207B776B6}.ServerBuild|x64.Build.0 = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.ServerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||
{1B0E8256-B764-45C0-817E-B382CD868324}.ServerBuild|x64.Build.0 = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.ServerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||
{86A89ECA-87FC-4ED6-8D02-383B9FB7E5D1}.ServerBuild|x64.Build.0 = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.ServerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||
{69E56CDE-67B5-42BD-A772-83ABBFCE17E3}.ServerBuild|x64.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Reference in New Issue
Block a user