Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ExtraJuiceMan committed Mar 22, 2018
1 parent 04b4a94 commit cf3e30c
Show file tree
Hide file tree
Showing 14 changed files with 401 additions and 0 deletions.
30 changes: 30 additions & 0 deletions BreakAndEnter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Rocket.Core.Logging;
using Rocket.Core.Plugins;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rocket.API.Collections;

namespace ExtraConcentratedJuice.BreakAndEnter
{
public class BreakAndEnter : RocketPlugin
{
public static BreakAndEnter instance;

protected override void Load() => instance = this;

public override TranslationList DefaultTranslations =>
new TranslationList
{
{ "no_object", "No object was found in your line of sight." },
{ "structure_removed", "Structure removed successfully." },
{ "barricade_removed", "Barricade removed successfully." },
{ "invalid_destroy", "The object that you are looking at is not a barricade nor a structure." },
{ "invalid_door", "The object that you are looking at is not a door." },
{ "door_toggle", "Door {0}." },
{ "storage_open", "Opened storage." },
{ "invalid_storage", "The object that you are looking at is not a storage unit." }
};
}
}
74 changes: 74 additions & 0 deletions BreakAndEnter.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{315C09F9-9709-4CF9-AD2B-AED6C198CA68}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExtraConcentratedJuice</RootNamespace>
<AssemblyName>BreakAndEnter</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</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, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Rocket.API, Version=2.6.4.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\Rocket.API.dll</HintPath>
</Reference>
<Reference Include="Rocket.Core, Version=2.4.8.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\Rocket.Core.dll</HintPath>
</Reference>
<Reference Include="Rocket.Unturned, Version=4.9.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\Rocket.Unturned.dll</HintPath>
</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>Libraries\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CommandDestroy.cs" />
<Compile Include="CommandStorage.cs" />
<Compile Include="CommandDoor.cs" />
<Compile Include="BreakAndEnter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Util.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
25 changes: 25 additions & 0 deletions BreakAndEnter.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BreakAndEnter", "BreakAndEnter.csproj", "{315C09F9-9709-4CF9-AD2B-AED6C198CA68}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Debug|Any CPU.Build.0 = Debug|Any CPU
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Release|Any CPU.ActiveCfg = Release|Any CPU
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FD01AEB5-2C6B-4383-B451-DC19884E77F2}
EndGlobalSection
EndGlobal
88 changes: 88 additions & 0 deletions CommandDestroy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using SDG.Framework.Utilities;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;

namespace ExtraConcentratedJuice.BreakAndEnter
{
public class CommandDestroy : IRocketCommand
{
#region Properties
public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "destroy";

public string Help => "Destroys the barricade or structure that you are looking at.";

public string Syntax => "/destroy";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "breakandenter.destroy" };
#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
Player player = ((UnturnedPlayer)caller).Player;
PlayerLook look = player.look;

if (PhysicsUtility.raycast(new Ray(look.aim.position, look.aim.forward), out RaycastHit hit, Mathf.Infinity, RayMasks.BARRICADE | RayMasks.STRUCTURE))
{
Interactable2SalvageBarricade barri = hit.transform.GetComponent<Interactable2SalvageBarricade>();
Interactable2SalvageStructure struc = hit.transform.GetComponent<Interactable2SalvageStructure>();

if (barri != null)
{
BarricadeManager.tryGetInfo(barri.root, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion region);

region.barricades.RemoveAt(index);

BarricadeManager manager = (BarricadeManager)typeof(BarricadeManager).GetField("manager", BindingFlags.NonPublic |
BindingFlags.Static).GetValue(null);

manager.channel.send("tellTakeBarricade", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
{
x,
y,
plant,
index
});

UnturnedChat.Say(caller, Util.Translate("barricade_removed"));
}
else if (struc != null)
{
StructureManager.tryGetInfo(struc.transform, out byte x, out byte y, out ushort index, out StructureRegion region);

region.structures.RemoveAt(index);

StructureManager manager = (StructureManager)typeof(StructureManager).GetField("manager", BindingFlags.NonPublic |
BindingFlags.Static).GetValue(null);

manager.channel.send("tellTakeStructure", ESteamCall.ALL, x, y, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
{
x,
y,
index,
(region.drops[index].model.position - player.transform.position).normalized * 100f
});

UnturnedChat.Say(caller, Util.Translate("structure_removed"));
}
else
{
UnturnedChat.Say(caller, Util.Translate("invalid_destroy"));
}
}
else
{
UnturnedChat.Say(caller, Util.Translate("no_object"));
}
}
}
}
74 changes: 74 additions & 0 deletions CommandDoor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using Rocket.API;
using Rocket.Core.Logging;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Effects;
using Rocket.Unturned.Player;
using SDG.Framework.Utilities;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;

namespace ExtraConcentratedJuice.BreakAndEnter
{
public class CommandDoor : IRocketCommand
{
#region Properties
public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "door";

public string Help => "Forces the door that you are looking at to open or close.";

public string Syntax => "/door";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "breakandenter.door" };
#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
PlayerLook look = ((UnturnedPlayer)caller).Player.look;

if (PhysicsUtility.raycast(new Ray(look.aim.position, look.aim.forward), out RaycastHit hit, Mathf.Infinity, RayMasks.BARRICADE))
{
InteractableDoorHinge hinge = hit.transform.GetComponent<InteractableDoorHinge>();

if (hinge != null)
{
InteractableDoor door = hinge.door;
bool open = !door.isOpen;

BarricadeManager.tryGetInfo(door.transform, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion region);

BarricadeManager manager = (BarricadeManager)typeof(BarricadeManager).GetField("manager", BindingFlags.NonPublic |
BindingFlags.Static).GetValue(null);

door.updateToggle(open);

manager.channel.send("tellToggleDoor", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
{
x,
y,
plant,
index,
open
});

UnturnedChat.Say(caller, Util.Translate("door_toggle", open ? "opened" : "closed"));
}
else
{
UnturnedChat.Say(caller, Util.Translate("invalid_door"));
}
}
else
{
UnturnedChat.Say(caller, Util.Translate("no_object"));
}
}
}
}
61 changes: 61 additions & 0 deletions CommandStorage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using SDG.Framework.Utilities;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;

namespace ExtraConcentratedJuice.BreakAndEnter
{
public class CommandStorage : IRocketCommand
{
#region Properties
public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "storage";

public string Help => "Lets you view the contents of the storage unit that you are looking at.";

public string Syntax => "/storage";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "breakandenter.storage" };
#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
Player player = ((UnturnedPlayer)caller).Player;
PlayerLook look = player.look;

if (PhysicsUtility.raycast(new Ray(look.aim.position, look.aim.forward), out RaycastHit hit, Mathf.Infinity, RayMasks.BARRICADE))
{
InteractableStorage storage = hit.transform.GetComponent<InteractableStorage>();

if (storage != null)
{
storage.isOpen = true;
storage.opener = player;
player.inventory.isStoring = true;
player.inventory.isStorageTrunk = false;
player.inventory.storage = storage;
player.inventory.updateItems(PlayerInventory.STORAGE, storage.items);
player.inventory.sendStorage();

UnturnedChat.Say(caller, Util.Translate("storage_open"));
}
else
{
UnturnedChat.Say(caller, Util.Translate("invalid_storage"));
}
}
else
{
UnturnedChat.Say(caller, Util.Translate("no_object"));
}
}
}
}
Binary file added Libraries/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file added Libraries/Assembly-CSharp.dll
Binary file not shown.
Binary file added Libraries/Rocket.API.dll
Binary file not shown.
Binary file added Libraries/Rocket.Core.dll
Binary file not shown.
Binary file added Libraries/Rocket.Unturned.dll
Binary file not shown.
Binary file added Libraries/UnityEngine.dll
Binary file not shown.
36 changes: 36 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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("BreakAndEnter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("BreakAndEnter")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2017")]
[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("315c09f9-9709-4cf9-ad2b-aed6c198ca68")]

// 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")]
Loading

0 comments on commit cf3e30c

Please sign in to comment.