Skip to content

Commit cf3e30c

Browse files
committed
Add project files.
1 parent 04b4a94 commit cf3e30c

14 files changed

+401
-0
lines changed

BreakAndEnter.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Rocket.Core.Logging;
2+
using Rocket.Core.Plugins;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using Rocket.API.Collections;
8+
9+
namespace ExtraConcentratedJuice.BreakAndEnter
10+
{
11+
public class BreakAndEnter : RocketPlugin
12+
{
13+
public static BreakAndEnter instance;
14+
15+
protected override void Load() => instance = this;
16+
17+
public override TranslationList DefaultTranslations =>
18+
new TranslationList
19+
{
20+
{ "no_object", "No object was found in your line of sight." },
21+
{ "structure_removed", "Structure removed successfully." },
22+
{ "barricade_removed", "Barricade removed successfully." },
23+
{ "invalid_destroy", "The object that you are looking at is not a barricade nor a structure." },
24+
{ "invalid_door", "The object that you are looking at is not a door." },
25+
{ "door_toggle", "Door {0}." },
26+
{ "storage_open", "Opened storage." },
27+
{ "invalid_storage", "The object that you are looking at is not a storage unit." }
28+
};
29+
}
30+
}

BreakAndEnter.csproj

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{315C09F9-9709-4CF9-AD2B-AED6C198CA68}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>ExtraConcentratedJuice</RootNamespace>
11+
<AssemblyName>BreakAndEnter</AssemblyName>
12+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<TargetFrameworkProfile />
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
35+
<SpecificVersion>False</SpecificVersion>
36+
<HintPath>Libraries\Assembly-CSharp.dll</HintPath>
37+
</Reference>
38+
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
39+
<SpecificVersion>False</SpecificVersion>
40+
<HintPath>Libraries\Assembly-CSharp-firstpass.dll</HintPath>
41+
</Reference>
42+
<Reference Include="Rocket.API, Version=2.6.4.0, Culture=neutral, processorArchitecture=MSIL">
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>Libraries\Rocket.API.dll</HintPath>
45+
</Reference>
46+
<Reference Include="Rocket.Core, Version=2.4.8.0, Culture=neutral, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>Libraries\Rocket.Core.dll</HintPath>
49+
</Reference>
50+
<Reference Include="Rocket.Unturned, Version=4.9.3.0, Culture=neutral, processorArchitecture=MSIL">
51+
<SpecificVersion>False</SpecificVersion>
52+
<HintPath>Libraries\Rocket.Unturned.dll</HintPath>
53+
</Reference>
54+
<Reference Include="System" />
55+
<Reference Include="System.Core" />
56+
<Reference Include="System.Xml.Linq" />
57+
<Reference Include="System.Data.DataSetExtensions" />
58+
<Reference Include="System.Data" />
59+
<Reference Include="System.Xml" />
60+
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
61+
<SpecificVersion>False</SpecificVersion>
62+
<HintPath>Libraries\UnityEngine.dll</HintPath>
63+
</Reference>
64+
</ItemGroup>
65+
<ItemGroup>
66+
<Compile Include="CommandDestroy.cs" />
67+
<Compile Include="CommandStorage.cs" />
68+
<Compile Include="CommandDoor.cs" />
69+
<Compile Include="BreakAndEnter.cs" />
70+
<Compile Include="Properties\AssemblyInfo.cs" />
71+
<Compile Include="Util.cs" />
72+
</ItemGroup>
73+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
74+
</Project>

BreakAndEnter.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26730.16
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BreakAndEnter", "BreakAndEnter.csproj", "{315C09F9-9709-4CF9-AD2B-AED6C198CA68}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{315C09F9-9709-4CF9-AD2B-AED6C198CA68}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {FD01AEB5-2C6B-4383-B451-DC19884E77F2}
24+
EndGlobalSection
25+
EndGlobal

CommandDestroy.cs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
using Rocket.API;
2+
using Rocket.Unturned.Chat;
3+
using Rocket.Unturned.Player;
4+
using SDG.Framework.Utilities;
5+
using SDG.Unturned;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Reflection;
9+
using UnityEngine;
10+
11+
namespace ExtraConcentratedJuice.BreakAndEnter
12+
{
13+
public class CommandDestroy : IRocketCommand
14+
{
15+
#region Properties
16+
public AllowedCaller AllowedCaller => AllowedCaller.Player;
17+
18+
public string Name => "destroy";
19+
20+
public string Help => "Destroys the barricade or structure that you are looking at.";
21+
22+
public string Syntax => "/destroy";
23+
24+
public List<string> Aliases => new List<string>();
25+
26+
public List<string> Permissions => new List<string> { "breakandenter.destroy" };
27+
#endregion
28+
29+
public void Execute(IRocketPlayer caller, string[] args)
30+
{
31+
Player player = ((UnturnedPlayer)caller).Player;
32+
PlayerLook look = player.look;
33+
34+
if (PhysicsUtility.raycast(new Ray(look.aim.position, look.aim.forward), out RaycastHit hit, Mathf.Infinity, RayMasks.BARRICADE | RayMasks.STRUCTURE))
35+
{
36+
Interactable2SalvageBarricade barri = hit.transform.GetComponent<Interactable2SalvageBarricade>();
37+
Interactable2SalvageStructure struc = hit.transform.GetComponent<Interactable2SalvageStructure>();
38+
39+
if (barri != null)
40+
{
41+
BarricadeManager.tryGetInfo(barri.root, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion region);
42+
43+
region.barricades.RemoveAt(index);
44+
45+
BarricadeManager manager = (BarricadeManager)typeof(BarricadeManager).GetField("manager", BindingFlags.NonPublic |
46+
BindingFlags.Static).GetValue(null);
47+
48+
manager.channel.send("tellTakeBarricade", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
49+
{
50+
x,
51+
y,
52+
plant,
53+
index
54+
});
55+
56+
UnturnedChat.Say(caller, Util.Translate("barricade_removed"));
57+
}
58+
else if (struc != null)
59+
{
60+
StructureManager.tryGetInfo(struc.transform, out byte x, out byte y, out ushort index, out StructureRegion region);
61+
62+
region.structures.RemoveAt(index);
63+
64+
StructureManager manager = (StructureManager)typeof(StructureManager).GetField("manager", BindingFlags.NonPublic |
65+
BindingFlags.Static).GetValue(null);
66+
67+
manager.channel.send("tellTakeStructure", ESteamCall.ALL, x, y, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
68+
{
69+
x,
70+
y,
71+
index,
72+
(region.drops[index].model.position - player.transform.position).normalized * 100f
73+
});
74+
75+
UnturnedChat.Say(caller, Util.Translate("structure_removed"));
76+
}
77+
else
78+
{
79+
UnturnedChat.Say(caller, Util.Translate("invalid_destroy"));
80+
}
81+
}
82+
else
83+
{
84+
UnturnedChat.Say(caller, Util.Translate("no_object"));
85+
}
86+
}
87+
}
88+
}

CommandDoor.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using Rocket.API;
2+
using Rocket.Core.Logging;
3+
using Rocket.Unturned.Chat;
4+
using Rocket.Unturned.Effects;
5+
using Rocket.Unturned.Player;
6+
using SDG.Framework.Utilities;
7+
using SDG.Unturned;
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Linq;
11+
using System.Reflection;
12+
using UnityEngine;
13+
14+
namespace ExtraConcentratedJuice.BreakAndEnter
15+
{
16+
public class CommandDoor : IRocketCommand
17+
{
18+
#region Properties
19+
public AllowedCaller AllowedCaller => AllowedCaller.Player;
20+
21+
public string Name => "door";
22+
23+
public string Help => "Forces the door that you are looking at to open or close.";
24+
25+
public string Syntax => "/door";
26+
27+
public List<string> Aliases => new List<string>();
28+
29+
public List<string> Permissions => new List<string> { "breakandenter.door" };
30+
#endregion
31+
32+
public void Execute(IRocketPlayer caller, string[] args)
33+
{
34+
PlayerLook look = ((UnturnedPlayer)caller).Player.look;
35+
36+
if (PhysicsUtility.raycast(new Ray(look.aim.position, look.aim.forward), out RaycastHit hit, Mathf.Infinity, RayMasks.BARRICADE))
37+
{
38+
InteractableDoorHinge hinge = hit.transform.GetComponent<InteractableDoorHinge>();
39+
40+
if (hinge != null)
41+
{
42+
InteractableDoor door = hinge.door;
43+
bool open = !door.isOpen;
44+
45+
BarricadeManager.tryGetInfo(door.transform, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion region);
46+
47+
BarricadeManager manager = (BarricadeManager)typeof(BarricadeManager).GetField("manager", BindingFlags.NonPublic |
48+
BindingFlags.Static).GetValue(null);
49+
50+
door.updateToggle(open);
51+
52+
manager.channel.send("tellToggleDoor", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
53+
{
54+
x,
55+
y,
56+
plant,
57+
index,
58+
open
59+
});
60+
61+
UnturnedChat.Say(caller, Util.Translate("door_toggle", open ? "opened" : "closed"));
62+
}
63+
else
64+
{
65+
UnturnedChat.Say(caller, Util.Translate("invalid_door"));
66+
}
67+
}
68+
else
69+
{
70+
UnturnedChat.Say(caller, Util.Translate("no_object"));
71+
}
72+
}
73+
}
74+
}

CommandStorage.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using Rocket.API;
2+
using Rocket.Unturned.Chat;
3+
using Rocket.Unturned.Player;
4+
using SDG.Framework.Utilities;
5+
using SDG.Unturned;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Reflection;
9+
using UnityEngine;
10+
11+
namespace ExtraConcentratedJuice.BreakAndEnter
12+
{
13+
public class CommandStorage : IRocketCommand
14+
{
15+
#region Properties
16+
public AllowedCaller AllowedCaller => AllowedCaller.Player;
17+
18+
public string Name => "storage";
19+
20+
public string Help => "Lets you view the contents of the storage unit that you are looking at.";
21+
22+
public string Syntax => "/storage";
23+
24+
public List<string> Aliases => new List<string>();
25+
26+
public List<string> Permissions => new List<string> { "breakandenter.storage" };
27+
#endregion
28+
29+
public void Execute(IRocketPlayer caller, string[] args)
30+
{
31+
Player player = ((UnturnedPlayer)caller).Player;
32+
PlayerLook look = player.look;
33+
34+
if (PhysicsUtility.raycast(new Ray(look.aim.position, look.aim.forward), out RaycastHit hit, Mathf.Infinity, RayMasks.BARRICADE))
35+
{
36+
InteractableStorage storage = hit.transform.GetComponent<InteractableStorage>();
37+
38+
if (storage != null)
39+
{
40+
storage.isOpen = true;
41+
storage.opener = player;
42+
player.inventory.isStoring = true;
43+
player.inventory.isStorageTrunk = false;
44+
player.inventory.storage = storage;
45+
player.inventory.updateItems(PlayerInventory.STORAGE, storage.items);
46+
player.inventory.sendStorage();
47+
48+
UnturnedChat.Say(caller, Util.Translate("storage_open"));
49+
}
50+
else
51+
{
52+
UnturnedChat.Say(caller, Util.Translate("invalid_storage"));
53+
}
54+
}
55+
else
56+
{
57+
UnturnedChat.Say(caller, Util.Translate("no_object"));
58+
}
59+
}
60+
}
61+
}
399 KB
Binary file not shown.

Libraries/Assembly-CSharp.dll

3.2 MB
Binary file not shown.

Libraries/Rocket.API.dll

16.5 KB
Binary file not shown.

Libraries/Rocket.Core.dll

74 KB
Binary file not shown.

0 commit comments

Comments
 (0)