Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MillzyDev committed Nov 16, 2023
1 parent e2cd07e commit 2621840
Show file tree
Hide file tree
Showing 14 changed files with 365 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .idea/.idea.ArenaFix/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/.idea.ArenaFix/.idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.ArenaFix/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.ArenaFix/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.ArenaFix/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions ArenaFix.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArenaFix", "ArenaFix\ArenaFix.csproj", "{D44131C8-BFF0-4CA1-A2F1-DBE378CD6E4E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D44131C8-BFF0-4CA1-A2F1-DBE378CD6E4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D44131C8-BFF0-4CA1-A2F1-DBE378CD6E4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D44131C8-BFF0-4CA1-A2F1-DBE378CD6E4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D44131C8-BFF0-4CA1-A2F1-DBE378CD6E4E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
99 changes: 99 additions & 0 deletions ArenaFix/ArenaFix.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.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>{D44131C8-BFF0-4CA1-A2F1-DBE378CD6E4E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ArenaFix</RootNamespace>
<AssemblyName>ArenaFix</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<LangVersion>11</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<Reference Include="0Harmony">
<HintPath>$(GameDir)\MelonLoader\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>$(GameDir)\MelonLoader\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>$(GameDir)\MelonLoader\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>$(GameDir)\MelonLoader\Managed\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem">
<HintPath>$(GameDir)\MelonLoader\Managed\Il2CppSystem.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>$(GameDir)\MelonLoader\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="SLZ.Marrow">
<HintPath>$(GameDir)\MelonLoader\Managed\SLZ.Marrow.dll</HintPath>
</Reference>
<Reference Include="UnhollowerBaseLib">
<HintPath>$(GameDir)\MelonLoader\Managed\UnhollowerBaseLib.dll</HintPath>
</Reference>
<Reference Include="UnhollowerRuntimeLib">
<HintPath>$(GameDir)\MelonLoader\Managed\UnhollowerRuntimeLib.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(GameDir)\MelonLoader\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(GameDir)\MelonLoader\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
<Compile Include="HarmonyPatches\Arena_GameController_NPC_Registration.cs" />
<Compile Include="HarmonyPatches\Arena_GameController_Start.cs" />
<Compile Include="Mod.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<None Include="ArenaFix.csproj.user" />
</ItemGroup>

<Import Project="$(SolutionDir)\Mod.props" />

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

<Import Project="$(SolutionDir)\Mod.targets" />
</Project>
23 changes: 23 additions & 0 deletions ArenaFix/HarmonyPatches/Arena_GameController_NPC_Registration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using HarmonyLib;
using SLZ.Bonelab;
using SLZ.Data;

namespace ArenaFix.HarmonyPatches
{
[HarmonyPatch(typeof(Arena_GameController))]
[HarmonyPatch(nameof(Arena_GameController.NPC_Registration))]
// ReSharper disable once InconsistentNaming
public static class Arena_GameController_NPC_Registration
{
[HarmonyPrefix]
// ReSharper disable once UnusedMember.Local
private static void Prefix(NPC_Data data)
{
// Spawns sometimes get stuck and are unable to enter the arena, the game kills them after 2
// minutes anyway if they dont enter the arena, this just reduces that timer.
EnemyProfile profile = data.enemyProfile;
if (profile.enemyTitle != "OMNI PROJECTOR HAZMAT") // Omni projectors hang about up top sometimes
profile.entranceTimeVal = 45f; // Original is 120f, which is way too long imo
}
}
}
27 changes: 27 additions & 0 deletions ArenaFix/HarmonyPatches/Arena_GameController_Start.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using HarmonyLib;
using SLZ.AI;
using SLZ.Bonelab;

namespace ArenaFix.HarmonyPatches
{
[HarmonyPatch(typeof(Arena_GameController))]
[HarmonyPatch(nameof(Arena_GameController.Start))]
// ReSharper disable once InconsistentNaming
public static class Arena_GameController_Start
{
[HarmonyPostfix]
// ReSharper disable once InconsistentNaming
// ReSharper disable once UnusedMember.Local
private static void Postfix(Arena_GameController __instance)
{
// If an NPC gets thrown out of the arena, it just kinda sits there
GenGameControl_Trigger arenaBounds = __instance.NPCEntranceTrigger;
arenaBounds.OnNPC_ProxyExit += (Action<TriggerRefProxy>)(triggerRefProxy =>
{
// if an npc leaves the arena and doesnt get back in, then kill it
triggerRefProxy._aiManager.StartArenaEntranceTimer(45f);
});
}
}
}
8 changes: 8 additions & 0 deletions ArenaFix/Mod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using MelonLoader;

namespace ArenaFix
{
public class Mod : MelonMod
{
}
}
26 changes: 26 additions & 0 deletions ArenaFix/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using ArenaFix;
using MelonLoader;
using BuildInfo = ArenaFix.BuildInfo;

[assembly: AssemblyTitle(BuildInfo.Name)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null!)]
[assembly: AssemblyProduct(BuildInfo.Name)]
[assembly: AssemblyCopyright("Copyright (c) 2023 Frederick (Millzy) Mills")]
[assembly: AssemblyTrademark(null)]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion(BuildInfo.Version + ".*")]
[assembly: AssemblyFileVersion(BuildInfo.Version)]
[assembly: NeutralResourcesLanguage("en")]

[assembly: MelonInfo(typeof(Mod), BuildInfo.Name, BuildInfo.Version, BuildInfo.Author)]

[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonID(BuildInfo.Id)]

[assembly: VerifyLoaderVersion("0.5.7")]
14 changes: 14 additions & 0 deletions Mod.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<ModName>$(RootNamespace)</ModName>
<ModAuthor>Millzy</ModAuthor>
<ModVersion>0.1.0</ModVersion>
<ModDescription>Some minor fixes to prevent softlocks in Fantasy Arena.</ModDescription>
<ModId>dev.millzy.$(ModName)</ModId>
<ModWebsiteUrl>https://github.com/MillzyDev/BonelabRandomizer</ModWebsiteUrl>
</PropertyGroup>

<ItemGroup>
<ModDependencies Include="LavaGang-MelonLoader-0.5.7" />
</ItemGroup>
</Project>
84 changes: 84 additions & 0 deletions Mod.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<Project>
<Target Name="BuildInfo" BeforeTargets="BeforeCompile">
<PropertyGroup>
<BuildInfo><![CDATA[
namespace $(RootNamespace)
{
internal static class BuildInfo
{
public const string Name = "$(ModName)"%3B
public const string Author = "$(ModAuthor)"%3B
public const string Version = "$(ModVersion)"%3B
public const string Description = "$(ModDescription)"%3B
public const string Id = "$(ModId)"%3B
}
}
]]></BuildInfo>

<BuildInfoFilePath>$(IntermediateOutputPath)BuildInfo.g.cs</BuildInfoFilePath>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(BuildInfoFilePath)" />
<FileWrites Include="$(BuildInfoFilePath)" />
</ItemGroup>

<WriteLinesToFile File="$(BuildInfoFilePath)"
Lines="$(BuildInfo)"
WriteOnlyWhenDifferent="true"
Overwrite="true" />

<Message Text="Generated BuildInfo.cs."
Importance="high" />
</Target>

<Target Name="AutoInstall" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(OutputPath)\$(AssemblyName).dll;$(OutputPath)\$(AssemblyName).pdb"
DestinationFolder="$(GameDir)\Mods" />

<Copy SourceFiles="$(OutputPath)\$(AssemblyName).xml"
DestinationFolder="$(GameDir)\Mods"
Condition="Exists('$(OutputPath)\$(AssemblyName).xml')" />

<Message Text="Finished copying files to $(GameDir)\Mods\"
Importance="high" />
</Target>

<Target Name="ThunderstorePackage"
AfterTargets="PostBuildEvent"
Condition="'$(Configuration)' == 'Release'">

<ItemGroup>
<ThunderStoreFiles Include="$(SolutionDir)\README.md;$(SolutionDir)\icon.png" />
<ThunderStoreFiles Include="$(SolutionDir)\CHANGELOG.md" Condition="Exists('$(SolutionDir)\CHANGELOG.md')" />
</ItemGroup>

<MakeDir Directories="$(OutputDir)\StagingArea\" />

<Exec Command="powershell $(SolutionDir)\generate-manifest.ps1 -modName '$(ModName)' -modVersion '$(ModVersion)' -modWebsiteUrl '$(ModWebsiteUrl)' -modDescription '$(ModDescription)' -dependencies '@(ModDependencies, '%27,%27')' -outPath '$(OutputPath)\StagingArea'" />

<Message Text="Generated manifest.json"
Importance="high" />

<Copy SourceFiles="@(ThunderStoreFiles)"
DestinationFolder="$(OutputPath)\StagingArea\" />

<Message Text="Finised copying Thunderstore recognised files."
Importance="high" />

<Copy SourceFiles="$(OutputPath)\$(AssemblyName).dll"
DestinationFolder="$(OutputPath)\StagingArea\Mods\" />

<Message Text="Finished staging mod files."
Importance="high" />

<MakeDir Directories="$(OutputPath)\Thunderstore" />

<ZipDirectory DestinationFile="$(OutputPath)\Thunderstore\$(AssemblyName).zip"
SourceDirectory="$(OutputPath)\StagingArea\" />

<Message Text="Created thunderstore package ($(AssemblyName).zip) at $(OutputPath)\Thunderstore\"
Importance="high" />

</Target>
</Project>
30 changes: 30 additions & 0 deletions generate-manifest.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Param(
[Parameter(Mandatory=$true)]
[String] $modName="",

[Parameter(Mandatory=$true)]
[String] $modVersion="",

[Parameter(Mandatory=$true)]
[String] $modWebsiteUrl="",

[Parameter(Mandatory=$true)]
[String] $modDescription="",

[Parameter(Mandatory=$false)]
[String[]] $dependencies=@(),

[Parameter(Mandatory=$true)]
[String] $outPath=""
)

$manifest = @{
"name" = $modName
"version_number" = $modVersion
"website_url" = $modWebsiteUrl
"description" = $modDescription
"dependencies" = $dependencies
}

$json = $manifest | ConvertTo-Json
$json | Set-Content -Path "$outPath/manifest.json" -Force

0 comments on commit 2621840

Please sign in to comment.