Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreiken committed Oct 28, 2016
1 parent 7df08cb commit 0cc540d
Show file tree
Hide file tree
Showing 10 changed files with 330 additions and 0 deletions.
196 changes: 196 additions & 0 deletions PLSTimedSpy.cs
@@ -0,0 +1,196 @@
using Rocket.Core.Plugins;
using Rocket.Unturned;
using Rocket.Unturned.Events;
using Rocket.Unturned.Player;
using Rocket.Core.Logging;
using Steamworks;
using SDG.Unturned;
using System.IO;
using System.Threading;
using System;
using System.Collections.Generic;
using Rocket.Unturned.Chat;
using System.Runtime.Serialization;

//Creado y Codificado por Dreiken. Steam /realdreiken/

namespace PLSTimedSpy
{
public class PLSTimedSpy : RocketPlugin<PLSTimedSpyConfiguration>
{
public string serverFolder;
public static PLSTimedSpy Instance;
public DateTime tiempo1;

void FixedUpdate()
{
if (this.Configuration.Instance.TimeSpy) TimeSpy();
}

protected override void Load()
{
Logger.LogWarning("PLSTimedSpy Loaded!");
Logger.LogWarning("Created by Dreiken");
Instance = this;
serverFolder = System.IO.Directory.GetParent(System.Environment.CurrentDirectory).ToString();
DirectoryExist("PleaseGamingFunctionalities");
DirectoryExist("KillSpy");
DirectoryExist("TimeSpy");
DirectoryExist("BackupSpy");
UnturnedPlayerEvents.OnPlayerDeath += OnPlayerDeath;
U.Events.OnPlayerConnected += OnPlayerConnected;

}

protected override void Unload()
{
Logger.LogWarning("PLSTimedSpy Unloaded!");
UnturnedPlayerEvents.OnPlayerDeath -= OnPlayerDeath;
U.Events.OnPlayerConnected -= OnPlayerConnected;
}

private void OnPlayerConnected(UnturnedPlayer player)
{
EspiadorInvi(player, true);
}

private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer)
{
UnturnedPlayer asesino = UnturnedPlayer.FromCSteamID(murderer);

if ((cause.ToString() == "BLEEDING") || (cause.ToString() == "ZOMBIE") || (cause.ToString() == "BONES") || (cause.ToString() == "FOOD")
|| (cause.ToString() == "INFECTION") || (cause.ToString() == "WATER") || (cause.ToString() == "SHRED") || ((cause.ToString() == "SUICIDE") || (cause.ToString() == "BREATH"))) return;

if (asesino == null) return;

else
{
if (this.Configuration.Instance.KillSpy)
{
EspiadorInvi(asesino, false);
}
}

}

void Spy(UnturnedPlayer player)
{
player.Player.sendScreenshot((CSteamID)0);
}

void MoveSpy(UnturnedPlayer player, string DirectoryName, int Times)
{
if (File.Exists(Path.GetFullPath(serverFolder + "/Spy/" + player.CSteamID.ToString() + ".jpg")))
File.Move(Path.GetFullPath(serverFolder + "/Spy/" + player.CSteamID.ToString() + ".jpg"), Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + CheckExist(player, DirectoryName, Times) + ".jpg"));
}

int CheckExist(UnturnedPlayer player, string DirectoryName, int Times)
{
DateTime[] creacion = new DateTime[(Times)];
for (int a = 0; a <= (Times - 1); a++)
{
if (File.Exists(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + a + ".jpg"))) ;
else
{
return a;
}
}
for (int a = 0; a <= (Times - 1); a++)
{
creacion[a] =
File.GetLastWriteTime(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + a + ".jpg"));
}
if (creacion[0].CompareTo(creacion[Times - 1]) < 0)
{
if (this.Configuration.Instance.BackupSpy == true)
{
File.Copy(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + 0 + ".jpg"),
Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + "BackupSpy/" + player.DisplayName.ToString() + "_" + DateTime.Now.ToString() + ".jpg"));
File.Delete(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + 0 + ".jpg"));
}

else File.Delete(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + 0 + ".jpg"));

return 0;
}
for (int a = 0; a <= (Times - 1); a++)
{
if (creacion[(a + 1)].CompareTo(creacion[a]) < 0)
{
if (this.Configuration.Instance.BackupSpy == true)
{
File.Copy(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + (a + 1) + ".jpg"),
Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + "BackupSpy/" + player.DisplayName.ToString() + "_" + DateTime.Now.ToString() + ".jpg"));
File.Delete(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + (a + 1) + ".jpg"));
}

else File.Delete(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName + "/" + player.DisplayName.ToString() + "_" + player.CSteamID.ToString() + "_" + (a + 1) + ".jpg"));

return (a + 1);
}
}
return 0;
}

private void TimeSpy()
{
if ((tiempo1.AddSeconds(this.Configuration.Instance.TimeSpyFrequency) - DateTime.Now).TotalSeconds < 0)
{
foreach (var steamplayer in Provider.Players)
{
EspiadorTiempo(UnturnedPlayer.FromPlayer(steamplayer.Player));
}
tiempo1 = DateTime.Now;
}
}

void DirectoryExist(string DirectoryName)
{
if (DirectoryName == "PleaseGamingFunctionalities")
{
if (System.IO.Directory.Exists(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/"))) return;
else System.IO.Directory.CreateDirectory(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/"));
}
else
{
if (System.IO.Directory.Exists(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName))) return;
else System.IO.Directory.CreateDirectory(Path.GetFullPath(serverFolder + "/PleaseGamingFunctionalities/" + DirectoryName));
}
}

public void EspiadorTiempo(UnturnedPlayer player)
{
new Thread(() =>
{
Spy(player);
Thread.Sleep(3500);
MoveSpy(player, "TimeSpy", this.Configuration.Instance.TimeSpyScreens);
})
{
IsBackground = true
}.Start();
}

public void EspiadorInvi(UnturnedPlayer player, bool connected)
{
new Thread(() =>
{
if (connected)
{
Thread.Sleep(6000);
Spy(player);
}
else
{
Spy(player);
Thread.Sleep(3500);
MoveSpy(player, "KillSpy", this.Configuration.Instance.KillSpyScreens);
}
})
{
IsBackground = true
}.Start();
}
}
}
73 changes: 73 additions & 0 deletions PLSTimedSpy.csproj
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BAA5B9A4-A30B-4186-85C2-82B827B19616}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PLSTimedSpy</RootNamespace>
<AssemblyName>PLSTimedSpy</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\Desktop\rocketmod\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\..\Desktop\Server\Updated Unturned Server\Unturned_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Rocket.API">
<HintPath>..\..\..\..\..\Desktop\rocketmod\Rocket.API.dll</HintPath>
</Reference>
<Reference Include="Rocket.Core">
<HintPath>..\..\..\..\..\Desktop\rocketmod\Rocket.Core.dll</HintPath>
</Reference>
<Reference Include="Rocket.Unturned">
<HintPath>..\..\..\..\..\Desktop\rocketmod\Rocket.Unturned.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\Desktop\Server\Updated Unturned Server\Unturned_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="PLSTimedSpyConfiguration.cs" />
<Compile Include="PLSTimedSpy.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
25 changes: 25 additions & 0 deletions PLSTimedSpyConfiguration.cs
@@ -0,0 +1,25 @@
using Rocket.API;

namespace PLSTimedSpy
{
public class PLSTimedSpyConfiguration : IRocketPluginConfiguration
{
public ushort TimeSpyFrequency, KillSpyScreens, TimeSpyScreens, PingVerificationTimeSeconds;
public bool BackupSpy, TimeSpy, KillSpy;

public PLSTimedSpyConfiguration()
{

}

public void LoadDefaults()
{
TimeSpyFrequency = 300;
TimeSpy = true;
KillSpy = true;
BackupSpy = true;
KillSpyScreens = 4;
TimeSpyScreens = 4;
}
}
}
36 changes: 36 additions & 0 deletions Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PLSTimedSpy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PLSTimedSpy")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("baa5b9a4-a30b-4186-85c2-82b827b19616")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Binary file added lib/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file added lib/Assembly-CSharp.dll
Binary file not shown.
Binary file added lib/Rocket.API.dll
Binary file not shown.
Binary file added lib/Rocket.Core.dll
Binary file not shown.
Binary file added lib/Rocket.Unturned.dll
Binary file not shown.
Binary file added lib/UnityEngine.dll
Binary file not shown.

0 comments on commit 0cc540d

Please sign in to comment.