Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7234e83
initial commit
BejoIjo Nov 27, 2017
e6875de
fixed incorect time data source on arrest report view
BejoIjo Nov 27, 2017
1931075
retain the timezone to get persona DOB string to maintain compatibili…
BejoIjo Nov 28, 2017
9d477f1
added feature to andomy generate past traffic citation records
BejoIjo Dec 3, 2017
996cc38
- generated citation history based on citation counts
BejoIjo Dec 5, 2017
58b91f9
added more improvements for past arrest report generator
BejoIjo Dec 9, 2017
a591c27
fixed the vehicle duplicate entry from alpr+ and traffic stop
BejoIjo Dec 9, 2017
3cb2618
added flag to disable/enable random historical ArrestReports and Tra…
BejoIjo Dec 9, 2017
168ddc5
fixed the random history flag iin the ini file
BejoIjo Dec 9, 2017
1f7c3ea
fix bug on DOB validation and fill unknown vehicle info with N/A
BejoIjo Dec 12, 2017
403fdfb
fixed bug on citation and arrest datetime timezone conversion
BejoIjo Dec 12, 2017
79f4efe
fixed vehicle owner handling for stolen vehicle (driver name != owner…
BejoIjo Dec 18, 2017
32b04c2
fixed vehicle info never shows no insurance and no registration statu…
BejoIjo Dec 18, 2017
dd59bf3
fixed bug. showed valid when owner has no license
BejoIjo Dec 20, 2017
a732d22
added dispose to make sure memory freed properly
BejoIjo Dec 21, 2017
b78a44b
prevent crash due to traffic stop ped (diver) instance is being dispo…
BejoIjo Dec 22, 2017
67a2b52
refactored random history generator and liteDB
BejoIjo Dec 24, 2017
ffed5b0
fixed bug when create traffic citation shows blank fields
BejoIjo Dec 24, 2017
517a884
fix bug when search ped manually by typing name
BejoIjo Dec 27, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions ComputerPlus/BritishPolicingFunctions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
using System;
using Rage;
using LSPD_First_Response.Engine.Scripting.Entities;
using British_Policing_Script;
using British_Policing_Script.API;
using ComputerPlus.Extensions;
using LSPD_First_Response;
using ComputerPlus.Controllers.Models;

namespace ComputerPlus
{
internal static class BritishPolicingFunctions
{


internal static Persona GetBritishPersona(Ped ped)
{
return Functions.GetBritishPersona(ped);
}

internal static String GetPedPersonaFullName(Persona persona)
{
return (persona as BritishPersona).FullName;
}

internal static String GetPedPersonaForeName(Persona persona)
{
return (persona as BritishPersona).Forename;
}

internal static String GetPedPersonaSurName(Persona persona)
{
return (persona as BritishPersona).Surname;
}

internal static String GetPedPersonaDOBString(Persona persona)
{
return (persona as BritishPersona).BirthDay.ToLocalTimeString(Extensions.Gwen.TextBoxExtensions.DateOutputPart.DATE);
}

internal static DateTime GetPedPersonaBirthDay(Persona persona)
{
return (persona as BritishPersona).BirthDay;
}

internal static int GetPedPersonaTimesStopped(Persona persona)
{
return (persona as BritishPersona).TimesStopped;
}

internal static Gender GetPedPersonaGender(Persona persona)
{
return (persona as BritishPersona).Gender;
}

internal static bool GetPedPersonaIsWanted(Persona persona)
{
return (persona as BritishPersona).Wanted;
}

internal static bool GetPedPersonaIsAgent(Persona persona)
{
return (persona as BritishPersona).IsAgent;
}

internal static bool GetPedPersonaIsCop(Persona persona)
{
return (persona as BritishPersona).IsCop;
}

internal static String GetPedPersonaWantedReason(Persona persona)
{
return (persona as BritishPersona).WantedReason;
}

internal static String GetVehicleLicensePlate(System.Object rawPersona)
{
return (rawPersona as VehicleRecords).LicencePlate;
}

internal static bool IsVehicleRegistered(System.Object rawPersona)
{
return (rawPersona as VehicleRecords).IsTaxed;
}

internal static bool IsVehicleInsured(System.Object rawPersona)
{
return (rawPersona as VehicleRecords).Insured;
}

internal static bool DoesVehicleHaveMOT(System.Object rawPersona)
{
return (rawPersona as VehicleRecords).HasMOT;
}

internal static bool DoesVehicleHaveSORN(System.Object rawPersona)
{
return (rawPersona as VehicleRecords).HasSORN;
}

internal static bool IsPedInsuredToDriveVehicle(System.Object rawPedPersona, System.Object rawVehiclePersona)
{
var pedPersona = rawPedPersona as BritishPersona;
var vehiclePersona = rawVehiclePersona as VehicleRecords;
return pedPersona.IsInsuredToDriveVehicle(vehiclePersona);
}

internal static bool IsLicenseValid(Persona pedPersona)
{
var persona = pedPersona as BritishPersona;
switch (persona.LicenceStatus)
{
case BritishPersona.LicenceStatuses.Disqualified:
case BritishPersona.LicenceStatuses.Expired:
case BritishPersona.LicenceStatuses.Revoked: return false;
default: return true;
}
}

internal static String GetLicenseStateString(Persona pedPersona)
{
var persona = pedPersona as BritishPersona;
switch (persona.LicenceStatus)
{
case BritishPersona.LicenceStatuses.Disqualified: return "Disqualified";
case BritishPersona.LicenceStatuses.Expired: return "Expired";
case BritishPersona.LicenceStatuses.Revoked: return "Revoked";
default: return "Valid";
}
}

internal static VehiclePersona CreateVehiclePersona(Vehicle veh)
{
VehicleRecords records = Functions.GetVehicleRecords(veh);

VehiclePersona vehiclePersona = new VehiclePersona();
vehiclePersona.HasInsurance = records.Insured;
vehiclePersona.IsRegistered = null;
vehiclePersona.Color = records.CarColour;
vehiclePersona.Alert = new System.Text.RegularExpressions.Regex(@"~\w~").Replace(records.DetermineFlags(), String.Empty);
vehiclePersona.HasValidEmissions = records.HasMOT;
vehiclePersona.IsOffroadOnly = records.HasSORN;
vehiclePersona.IsTaxed = records.IsTaxed;
vehiclePersona.RawPersona = records;

return vehiclePersona;
}
}
}
72 changes: 18 additions & 54 deletions ComputerPlus/ComputerPlus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -61,67 +63,31 @@
<HintPath>Dependencies\British Policing Script.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CodeEngine.Framework.QueryBuilder">
<HintPath>Dependencies\CodeEngine.Framework.QueryBuilder.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Gwen, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Dependencies\Gwen.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="LiteDB, Version=4.0.0.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.4.0.0\lib\net40\LiteDB.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="LSPD First Response">
<HintPath>Dependencies\LSPD First Response.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="RagePluginHook">
<HintPath>Dependencies\RagePluginHook.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SQLite.Net, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>Dependencies\SQLite.Net.dll</HintPath>
<Private>True</Private>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="SQLite.Net.Async, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>Dependencies\SQLite.Net.Async.dll</HintPath>
<Private>True</Private>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="SQLite.Net.Platform.Generic, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>Dependencies\SQLite.Net.Platform.Generic.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLite.Net.Platform.Win32, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>Dependencies\SQLite.Net.Platform.Win32.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLiteNetExtensions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>Dependencies\SQLiteNetExtensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLiteNetExtensionsAsync, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>Dependencies\SQLiteNetExtensionsAsync.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>Dependencies\System.Data.SQLite.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Traffic Policer">
<HintPath>Dependencies\Traffic Policer.dll</HintPath>
Expand All @@ -136,6 +102,7 @@
<Compile Include="API\Functions.cs" />
<Compile Include="API\ICalloutData.cs" />
<Compile Include="API\MDTAPI.cs" />
<Compile Include="BritishPolicingFunctions.cs" />
<Compile Include="Controllers\ComputerReportsController.cs" />
<Compile Include="Controllers\Models\ALRP_Arguments.cs" />
<Compile Include="Controllers\Models\ComputerPlusEntity.cs" />
Expand Down Expand Up @@ -378,25 +345,22 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /Y "$(TargetDir)ComputerPlus.dll" "$(TargetDir)Packaged\Plugins\LSPDFR\"
xcopy /Y "$(TargetDir)ComputerPlus.pdb" "$(TargetDir)Packaged\Plugins\LSPDFR\"
xcopy /Y "$(ProjectDir)Resources\*.dll" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\"
xcopy /Y "$(ProjectDir)Resources\*.jpg" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\"
xcopy /Y "$(ProjectDir)Resources\*.xml" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\"
xcopy /Y "$(ProjectDir)Resources\Schemas\*.sql" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\Schemas\"
xcopy /Y "$(ProjectDir)Resources\Schemas\*.sql" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\Schemas\"
<PostBuildEvent>xcopy /Y "$(TargetDir)ComputerPlus.dll" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\"
xcopy /Y "$(TargetDir)ComputerPlus.pdb" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\"
xcopy /Y "$(ProjectDir)Resources\*.dll" "$(TargetDir)Packaged\GTA V Main Folder\"
xcopy /Y "$(ProjectDir)Resources\*.jpg" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\ComputerPlus\"
xcopy /Y "$(ProjectDir)Resources\*.xml" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\ComputerPlus\"
copy /Y "$(ProjectDir)..\readme.md" "$(TargetDir)Packaged\readme.txt"

xcopy /Y "$(ProjectDir)Resources\*.png" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\"
xcopy /Y "$(ProjectDir)Resources\icons\*.png" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\icons\"
xcopy /Y "$(ProjectDir)Resources\backgrounds\*.jpg" "$(TargetDir)Packaged\Plugins\LSPDFR\ComputerPlus\backgrounds\"

xcopy /Y "$(ProjectDir)Resources\ComputerPlus.ini" "$(TargetDir)Packaged\Plugins\LSPDFR\"
xcopy /Y "$(ProjectDir)Resources\*.png" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\ComputerPlus\"
xcopy /Y "$(ProjectDir)Resources\icons\*.png" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\ComputerPlus\icons\"
xcopy /Y "$(ProjectDir)Resources\backgrounds\*.jpg" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\ComputerPlus\backgrounds\"

xcopy /Y "$(ProjectDir)Resources\ComputerPlus.ini" "$(TargetDir)Packaged\GTA V Main Folder\Plugins\LSPDFR\"

xcopy /Y "$(TargetDir)ComputerPlus.dll" "F:\Rockstar Games\Plugins\LSPDFR"

xcopy /Y "$(TargetDir)ComputerPlus.pdb" "F:\Rockstar Games\Plugins\LSPDFR"</PostBuildEvent>
xcopy /Y "$(TargetDir)ComputerPlus.dll" "D:\Steam\steamapps\common\Grand Theft Auto V\plugins\LSPDFR"
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
Expand Down
8 changes: 8 additions & 0 deletions ComputerPlus/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal static class Configs
internal static Dictionary<uint,string> bgs = new Dictionary<uint,string>();
static string user, pass, unit;
static bool skip;
static bool randomHistoryRecords;
internal static int FontSize
{
get;
Expand Down Expand Up @@ -43,6 +44,7 @@ internal static void RunConfigCheck()
unit = ini_file.ReadString("SETTINGS", "UnitNumber");
FontSize = ini_file.ReadInt32("SETTINGS", "FontSize");
FontName = ini_file.ReadString("SETTINGS", "FontName");
randomHistoryRecords = ini_file.ReadBoolean("SETTINGS", "RandomHistoryRecords", true);

if (String.IsNullOrWhiteSpace(user))
user = "Officer";
Expand Down Expand Up @@ -113,6 +115,7 @@ internal static void CreateINIFile()
ini_file.Write("SETTINGS", "UnitNumber", "1-A-12");
ini_file.Write("SETTINGS", "FontSize", 16);
ini_file.Write("SETTINGS", "FontName", "Microsoft Sans Serif");
ini_file.Write("SETTINGS", "RandomHistoryRecords", "true");

ini_file.Write("KEYBINDINGS", "OpenComputerPlusKey", "None");
ini_file.Write("KEYBINDINGS", "OpenComputerPlusModifierKey", "None");
Expand Down Expand Up @@ -151,6 +154,11 @@ internal static bool SkipLogin
get { return skip; }
}

internal static bool RandomHistoryRecords
{
get { return randomHistoryRecords; }
}

internal static string UnitNumber
{
get { return unit; }
Expand Down
Loading