Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e0a640
commit f862b1b
Showing
13 changed files
with
814 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
x64/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# Roslyn cache directories | ||
*.ide/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
#NUNIT | ||
*.VisualState.xml | ||
TestResult.xml | ||
|
||
# Build Results of an ATL Project | ||
[Dd]ebugPS/ | ||
[Rr]eleasePS/ | ||
dlldata.c | ||
|
||
*_i.c | ||
*_p.c | ||
*_i.h | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
# Chutzpah Test files | ||
_Chutzpah* | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
|
||
# TFS 2012 Local Workspace | ||
$tf/ | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
*.DotSettings.user | ||
|
||
# JustCode is a .NET coding addin-in | ||
.JustCode | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
_NCrunch_* | ||
.*crunch*.local.xml | ||
|
||
# MightyMoose | ||
*.mm.* | ||
AutoTest.Net/ | ||
|
||
# Web workbench (sass) | ||
.sass-cache/ | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.[Pp]ublish.xml | ||
*.azurePubxml | ||
## TODO: Comment the next line if you want to checkin your | ||
## web deploy settings but do note that will include unencrypted | ||
## passwords | ||
#*.pubxml | ||
|
||
# NuGet Packages Directory | ||
packages/* | ||
## TODO: If the tool you use requires repositories.config | ||
## uncomment the next line | ||
#!packages/repositories.config | ||
|
||
# Enable "build/" folder in the NuGet Packages folder since | ||
# NuGet packages use it for MSBuild targets. | ||
# This line needs to be after the ignore of the build folder | ||
# (and the packages folder if the line above has been uncommented) | ||
!packages/build/ | ||
|
||
# Windows Azure Build Output | ||
csx/ | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Others | ||
sql/ | ||
*.Cache | ||
ClientBin/ | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.dbproj.schemaview | ||
*.pfx | ||
*.publishsettings | ||
node_modules/ | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file | ||
# to a newer Visual Studio version. Backup files are not needed, | ||
# because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
*.mdf | ||
*.ldf | ||
|
||
# Business Intelligence projects | ||
*.rdl.data | ||
*.bim.layout | ||
*.bim_*.settings | ||
|
||
# Microsoft Fakes | ||
FakesAssemblies/ | ||
|
||
# LightSwitch generated files | ||
GeneratedArtifacts/ | ||
_Pvt_Extensions/ | ||
ModelManifest.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using Rocket; | ||
using Rocket.Logging; | ||
using Rocket.RocketAPI; | ||
using SDG; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace unturned.ROCKS.Kits | ||
{ | ||
class CommandKit : Command | ||
{ | ||
public CommandKit() | ||
{ | ||
base.commandName = "kit"; | ||
base.commandHelp = "Gives you a kit"; | ||
base.commandInfo = base.commandName + " - " + base.commandHelp; | ||
} | ||
|
||
protected override void execute(SteamPlayerID caller, string command) | ||
{ | ||
if (!RocketCommand.IsPlayer(caller)) return; | ||
|
||
bool hasPermissions = RocketPermissionManager.GetPermissions(caller.CSteamID).Where(p => p.ToLower() == ("kit." + command.Trim().ToLower()) || p.ToLower() == "kit.*").FirstOrDefault() != null; | ||
|
||
if (!hasPermissions) | ||
{ | ||
RocketChatManager.Say(caller.CSteamID, "You don't have permissions to use that command"); | ||
return; | ||
} | ||
|
||
if (String.IsNullOrEmpty(command.Trim())) { | ||
RocketChatManager.Say(caller.CSteamID,"Invalid parameter"); | ||
return; | ||
} | ||
|
||
Kit kit = Kits.Configuration.Kits.Where(k => k.Name.ToLower() == command.Trim().ToLower()).FirstOrDefault(); | ||
if (kit == null) | ||
{ | ||
RocketChatManager.Say(caller.CSteamID, "Kit not found"); | ||
return; | ||
} | ||
else { | ||
Player player = PlayerTool.getPlayer(caller.CSteamID); | ||
KitsPlayerComponent kp = player.transform.GetComponent<KitsPlayerComponent>(); | ||
|
||
double gt = (DateTime.Now - kp.GlobalKitCooldown).TotalSeconds; | ||
if (gt < Kits.Configuration.GlobalCooldown) | ||
{ | ||
RocketChatManager.Say(caller.CSteamID, "You have to wait " + (Kits.Configuration.GlobalCooldown - gt) + " seconds to use this command again"); | ||
return; | ||
} | ||
|
||
DateTime kitCooldown = kp.SpecificKitCooldown.ContainsKey(kit.Name.ToLower()) ? kp.SpecificKitCooldown[kit.Name] : DateTime.MinValue; | ||
|
||
double kt = (DateTime.Now - kitCooldown).TotalSeconds; | ||
if (gt < kit.Cooldown) | ||
{ | ||
RocketChatManager.Say(caller.CSteamID, "You have to wait " + (kit.Cooldown - gt) + " seconds to get this kit again"); | ||
return; | ||
} | ||
|
||
foreach (KitItem item in kit.Items) | ||
{ | ||
if (!ItemTool.tryForceGiveItem(player, item.ItemId, item.Amount)) | ||
{ | ||
Logger.Log("Failed giving a item to " + caller.CharacterName + " (" + item.ItemId + "," + item.Amount + ")"); | ||
} | ||
} | ||
RocketChatManager.Say(caller.CSteamID, "You just received the kit " + kit.Name); | ||
kp.SpecificKitCooldown[kit.Name] = DateTime.Now; | ||
kp.GlobalKitCooldown = DateTime.Now; | ||
|
||
} | ||
|
||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Rocket; | ||
using Rocket.Logging; | ||
using Rocket.RocketAPI; | ||
using Rocket.RocketAPI.Events; | ||
using SDG; | ||
using Steamworks; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace unturned.ROCKS.Kits | ||
{ | ||
public class Kits : RocketPlugin<KitsConfiguration> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.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>{2D98D5E7-1928-4D09-881D-AA64A3AA0AB9}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>unturned.ROCKS.Kits</RootNamespace> | ||
<AssemblyName>Kits</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>false</DebugSymbols> | ||
<DebugType>none</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>..\..\..\Desktop\Unturned\Servers\test\Rocket\Plugins\</OutputPath> | ||
<DefineConstants> | ||
</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile> | ||
</DocumentationFile> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
</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, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>lib\Assembly-CSharp.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>lib\Assembly-CSharp-firstpass.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="RocketAPI, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>lib\RocketAPI.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>lib\UnityEngine.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="CommandKit.cs" /> | ||
<Compile Include="KitsConfiguration.cs" /> | ||
<Compile Include="Kits.cs" /> | ||
<Compile Include="KitsPlayerComponent.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="lib\Assembly-CSharp-firstpass.dll" /> | ||
<Content Include="lib\Assembly-CSharp.dll" /> | ||
<Content Include="lib\RocketAPI.dll" /> | ||
<Content Include="lib\UnityEngine.dll" /> | ||
</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2013 | ||
VisualStudioVersion = 12.0.31101.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kits", "Kits.csproj", "{2D98D5E7-1928-4D09-881D-AA64A3AA0AB9}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2D98D5E7-1928-4D09-881D-AA64A3AA0AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2D98D5E7-1928-4D09-881D-AA64A3AA0AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2D98D5E7-1928-4D09-881D-AA64A3AA0AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2D98D5E7-1928-4D09-881D-AA64A3AA0AB9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.