Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Update to new TLD, improved plaroid injection (no need to walk away)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttr committed Feb 19, 2023
1 parent c0b0ac0 commit 425a819
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 143 deletions.
20 changes: 0 additions & 20 deletions MapTweaks.cs

This file was deleted.

115 changes: 38 additions & 77 deletions MapTweaks.csproj
Original file line number Diff line number Diff line change
@@ -1,86 +1,47 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">
<!--This is an xml comment. Comments have no impact on compiling.-->

<PropertyGroup>
<!--This is the .NET version the mod will be compiled with. Don't change it.-->
<TargetFramework>net6.0</TargetFramework>

<!--This tells the compiler to use the latest C# version.-->
<LangVersion>Latest</LangVersion>

<!--This adds global usings for a few common System namespaces.-->
<ImplicitUsings>enable</ImplicitUsings>

<!--This enables nullable annotation and analysis. It's good coding form.-->
<Nullable>enable</Nullable>

<!--This tells the compiler to use assembly attributes instead of generating its own.-->
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

<!--PDB files give line numbers in stack traces (errors). This is useful for debugging. There are 3 options:-->
<!--full has a pdb file created beside the dll.-->
<!--embedded has the pdb data embedded within the dll. This is useful because bug reports will then have line numbers.-->
<!--none skips creation of pdb data.-->
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{74E07033-99B5-4A7F-AE4B-EAD9AEFEBDB8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapTweaks</RootNamespace>
<AssemblyName>MapTweaks</AssemblyName>
<TargetFrameworkVersion>v4.7.2</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>
<Prefer32Bit>false</Prefer32Bit>
</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>
<Prefer32Bit>false</Prefer32Bit>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>

<PropertyGroup />

<ItemGroup>
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\MelonLoader\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\Steam\SteamApps\common\TheLongDark\tld_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Il2Cppmscorlib, Version=3.7.1.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Il2CppSystem, Version=3.7.1.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="MelonLoader, Version=0.4.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\MelonLoader\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="ModSettings, Version=1.8.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\ModSettings.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="UnhollowerBaseLib, Version=0.4.9.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="UnhollowerRuntimeLib, Version=0.4.9.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\Steam\SteamApps\common\TheLongDark\tld_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<PackageReference Include="ds5678.Modding.TLD.Il2CppAssemblies.Windows" Version="2.6.0" />
</ItemGroup>

<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="src\MapTweaks.cs" />
<Compile Include="src\Patches.cs" />
<Compile Include="src\Settings.cs" />
<Reference Include="ModSettings">
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\ModSettings.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /y "$(ProjectDir)bin\Debug\MapTweaks.dll" "D:\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\"</PostBuildEvent>
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /y &quot;$(ProjectDir)bin\Debug\net6.0\MapTweaks.dll&quot; &quot;D:\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\&quot;" />
</Target>
<!-- 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">
Expand Down
38 changes: 7 additions & 31 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
using MelonLoader;
using System.Reflection;
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("MapTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MapTweaks")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//This is a C# comment. Comments have no impact on compilation.

// 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)]
[assembly: AssemblyTitle(MapTweaks.BuildInfo.ModName)]
[assembly: AssemblyCopyright($"Created by " + MapTweaks.BuildInfo.ModAuthor)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("510300d9-69d5-448c-9efc-4edec76f9bc9")]
[assembly: AssemblyVersion(MapTweaks.BuildInfo.ModVersion)]
[assembly: AssemblyFileVersion(MapTweaks.BuildInfo.ModVersion)]
[assembly: MelonInfo(typeof(MapTweaks.MapTweaks), MapTweaks.BuildInfo.ModName, MapTweaks.BuildInfo.ModVersion, MapTweaks.BuildInfo.ModAuthor)]

// 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")]
[assembly: MelonInfo(typeof(MapTweaks.MapTweaks), "MapTweaks", "2.3", "MikeyPdog, AlexTheRegent, ttr")]
//This tells MelonLoader that the mod is only for The Long Dark.
[assembly: MelonGame("Hinterland", "TheLongDark")]
21 changes: 13 additions & 8 deletions src/MapTweaks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@

namespace MapTweaks
{
internal class MapTweaks : MelonMod
public static class BuildInfo
{
internal const string ModName = "MapTweaks";
internal const string ModAuthor = "ttr, MikeyPdog, AlexTheRegent";
internal const string ModVersion = "2.4.0";
}
internal class MapTweaks : MelonMod
{

public override void OnApplicationStart()
{
Debug.Log($"[{Info.Name}] Version {Info.Version} loaded!");
Settings.OnLoad();
}
}
public override void OnInitializeMelon()
{
Settings.OnLoad();
LoggerInstance.Msg($"[{BuildInfo.ModName}] Version {BuildInfo.ModVersion} loaded!");
}
}
}


15 changes: 8 additions & 7 deletions src/Patches.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using MelonLoader;
using HarmonyLib;

using Il2Cpp;

namespace MapTweaks
{
Expand All @@ -17,20 +17,21 @@ public static void Prefix(ref float radius, ref bool shouldAllowVistaReveals)
MelonLogger.Msg("range: " + radius + " " + shouldAllowVistaReveals);
}
}
[HarmonyPatch(typeof(Panel_Map), "HasVistaLocationRequiredGearItem")]
public class panel_map_HasVistaLocationRequiredGearItem
[HarmonyPatch(typeof(VistaLocation), "HasRequiredGearItem")]
public class VistaLocation_HasRequiredGearItem
{
public static void Postfix(VistaLocation vistaLocation, bool __result)
public static void Postfix(VistaLocation __instance, ref bool __result)
{
if (Settings.options.assumePolaroids && !__result)
{
MelonLogger.Msg("Silent add: " + vistaLocation.m_RequiredGearItem.name);
GameManager.GetPlayerManagerComponent().AddItemToPlayerInventory(vistaLocation.m_RequiredGearItem);
MelonLogger.Msg("Silent add: " + __instance.m_RequiredGearItem.name);
GameManager.GetPlayerManagerComponent().AddItemToPlayerInventory(__instance.m_RequiredGearItem);
__result = true;
}
}
}
[HarmonyPatch(typeof(Panel_Map), "RevealOnPolaroidDiscovery")]
public class panel_map_RevealOnPolaroidDiscovery
public class Panel_Map_RevealOnPolaroidDiscovery
{
public static bool Prefix()
{
Expand Down

0 comments on commit 425a819

Please sign in to comment.