Skip to content

Commit

Permalink
- Embedded Newtonsoft.Json in the dll
Browse files Browse the repository at this point in the history
- Added ReviveAll
- Improved GodMode
- Useful error message for UI Error
- Changed to .net standard 2.0
  • Loading branch information
CodeName-Anti committed Dec 27, 2021
1 parent ee2c63e commit 65797f9
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 132 deletions.
27 changes: 27 additions & 0 deletions stikosekutilities2/Cheats/Other/ReviveAll.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using stikosekutilities2.UI;

namespace stikosekutilities2.Cheats
{
[Cheat]
public class ReviveAll : BaseCheat
{
public ReviveAll() : base("Revive All", WindowID.Other)
{
}

protected override void RenderElements()
{
if(Button(Name))
{
foreach(PlayerManager manager in GameManager.players.Values)
{
if (manager == null || !manager.dead || manager.disconnected)
continue;

ClientSend.RevivePlayer(manager.id, -1, false);
}
}
}

}
}
20 changes: 20 additions & 0 deletions stikosekutilities2/ILRepack.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="ILRepacker" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">

<ItemGroup>
<InputAssemblies Include="@(ReferencePathWithRefAssemblies)" Condition="'%(filename)' == 'Newtonsoft.Json'" />
<InputAssemblies Include="$(TargetPath)"/>
</ItemGroup>

<!-- Change to your BepInEx Dependencies location-->
<ILRepack
LibraryPath="..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\BepInEx\core"
Parallel="true"
Internalize="true"
InputAssemblies="@(InputAssemblies)"
TargetKind="Dll"
OutputFile="$(TargetPath)"/>
</Target>
</Project>
3 changes: 0 additions & 3 deletions stikosekutilities2/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ private void Awake()
FormattedVersion = Utilities.FormatAssemblyVersion(true);
WelcomeScreen.draw = true;

// Download Newtosoft.Json
Utilities.DownloadJsonLibrary();

if (VersionChecker.UpdateAvailable)
{
// Cancel loading
Expand Down
23 changes: 23 additions & 0 deletions stikosekutilities2/Patches/PlayerStatusPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using HarmonyLib;

namespace stikosekutilities2.Patches
{
[HarmonyPatch(typeof(PlayerStatus))]
public static class PlayerStatusPatch
{
public static bool GodMode;

[HarmonyPatch("HandleDamage")]
[HarmonyPrefix]
public static bool HandleDamage(PlayerStatus __instance)
{
if(GodMode)
{
ClientSend.PlayerHp(__instance.maxHp, __instance.maxHp);
}

return !GodMode;
}

}
}
2 changes: 1 addition & 1 deletion stikosekutilities2/PluginConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class PluginConstants
public const string
Name = "stikosekutilities2",
GUID = "devpacket.stikosekutilities2",
Version = "0.1.0.0";
Version = "0.1.0.1";

// GitHub related
public const string
Expand Down
2 changes: 1 addition & 1 deletion stikosekutilities2/UI/LayoutHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private static GUIStyle

public static bool Toggle(string text, bool toggled)
{
GUIContent content = new("haha stikosekutilities go brrrrrrrrrr");
GUIContent content = new("This is an error, report it to one of the creators.");

Rect buttonRect = GUILayoutUtility.GetRect(content, GUI.skin.button, GUILayout.Height(40));

Expand Down
37 changes: 0 additions & 37 deletions stikosekutilities2/Utils/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,43 +71,6 @@ public static void DownloadFile(string fileName, string url)
client.DownloadFile(url, fileName);
}

/// <summary>
/// Downloads Newtonsoft Json.
/// </summary>
public static void DownloadJsonLibrary()
{
// Paths
string path = GetAssemblyLocation();
string dllLoadPath = Path.Combine(path, "Newtonsoft.Json.dll");

if (!File.Exists(dllLoadPath))
{
// Temp Paths
string tempPath = Path.Combine(Path.GetTempPath(), "CrabGame Cheat " + Guid.NewGuid().ToString());
string zipPath = Path.Combine(tempPath, "Unzipped");

string zip = Path.Combine(tempPath, "Json.zip");

// Create zipPath
Directory.CreateDirectory(zipPath);

// Download Newtonsoft.Json.
DownloadFile(zip,
"https://github.com/JamesNK/Newtonsoft.Json/releases/download/13.0.1/Json130r1.zip");

// Extract the zip.
ZipFile.ExtractToDirectory(zip, zipPath);

string dllFile = Path.Combine(zipPath, "Bin", "netstandard2.0", "Newtonsoft.Json.dll");

// Copy Newtonsoft.Json to plugins folder, to not download it every start.
File.Copy(dllFile, dllLoadPath);

// Load Newtonsoft.Json
Assembly.LoadFrom(dllLoadPath);
}
}

public static string GetAssemblyLocation()
{
return GetAssemblyLocation(Assembly.GetExecutingAssembly());
Expand Down
4 changes: 0 additions & 4 deletions stikosekutilities2/packages.config

This file was deleted.

113 changes: 27 additions & 86 deletions stikosekutilities2/stikosekutilities2.csproj
Original file line number Diff line number Diff line change
@@ -1,161 +1,102 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F2483597-C002-46D0-9C85-759BAF82E663}</ProjectGuid>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>stikosekutilities2</RootNamespace>
<AssemblyName>stikosekutilities2</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<Langversion>10.0</Langversion>
</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>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IsPublishable>true</IsPublishable>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\BepInEx\core\0Harmony.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\BepInEx\core\BepInEx.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="BepInEx.Harmony">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\BepInEx\core\BepInEx.Harmony.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="BepInEx.Preloader">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\BepInEx\core\BepInEx.Preloader.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="Facepunch.Steamworks.Win64">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
<Private>False</Private>
</Reference>
<Reference Include="System.Core">
<Reference Update="System">
<Private>False</Private>
</Reference>
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq">
<Reference Update="System.Core">
<Private>False</Private>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<Reference Update="System.Xml.Linq">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CSharp">
<Reference Update="System.Data">
<Private>False</Private>
</Reference>
<Reference Include="System.Data">
<Private>False</Private>
</Reference>
<Reference Include="System.Net.Http">
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<Reference Update="System.Xml">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="UnityEngine.InputModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.InputModule.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.JSONSerializeModule.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muck\Muck_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<Private>False</Private>
<CopyLocal>False</CopyLocal>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Cheats\Movement\AirJump.cs" />
<Compile Include="Cheats\Movement\OmegaJump.cs" />
<Compile Include="Cheats\Other\Achievements.cs" />
<Compile Include="Cheats\BaseCheat.cs" />
<Compile Include="Cheats\CheatAttribute.cs" />
<Compile Include="Cheats\Movement\ClickTP.cs" />
<Compile Include="Cheats\Player\GodMode.cs" />
<Compile Include="Cheats\Player\Hunger.cs" />
<Compile Include="Cheats\Combat\InstaKill.cs" />
<Compile Include="Cheats\Player\InstaMine.cs" />
<Compile Include="Cheats\Player\NoCoins.cs" />
<Compile Include="Cheats\Movement\Speed.cs" />
<Compile Include="Cheats\Movement\Fly.cs" />
<Compile Include="Cheats\Player\Stamina.cs" />
<Compile Include="Cheats\Movement\WaterFloat.cs" />
<Compile Include="Loader.cs" />
<Compile Include="Patches\HitableMobPatch.cs" />
<Compile Include="Patches\HitableResourcePatch.cs" />
<Compile Include="Patches\LootContainerInteractPatch.cs" />
<Compile Include="UI\GUIRenderer.cs" />
<Compile Include="UI\LayoutHelpers.cs" />
<Compile Include="UI\WindowManager.cs" />
<Compile Include="Utils\DrawingUtil.cs" />
<Compile Include="Utils\KeyCodeFormatter.cs" />
<Compile Include="Utils\RainbowColor.cs" />
<Compile Include="Utils\ReflectionExtensions.cs" />
<Compile Include="Utils\WelcomeScreen.cs" />
<Compile Include="Utils\Utilities.cs" />
<Compile Include="Utils\VersionChecker.cs" />
<Compile Include="PluginConstants.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\WindowID.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.18.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1">
<PrivateAssets></PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

0 comments on commit 65797f9

Please sign in to comment.