measurity / modtemplatevalheim Goto Github PK
View Code? Open in Web Editor NEWValheim template for quickly writing mods using BepInEx
License: MIT License
Valheim template for quickly writing mods using BepInEx
License: MIT License
i am developing a server mod.
I go to start my valheim only to find this project has installed bepinex into my local game.
i see readme says bepinex and moves mod to plugins folder.
but i figured that was in development environment. in the bin folder. i didn't realize this would be editing my game install.
[Warning: HarmonyX] UnpatchAll has been called with harmonyID=null - This will remove ALL HARMONY PATCHES. If you want to only unpatch patches created by this instance (1010101110.serversteaminfo), use UnpatchSelf() instead.
should we update Mod.cs to unpatchself?
Couldn't use the BepInEx 5.4.5 for current game version. Had to use this version:
private const string BepInExDownloadUrl =
"https://github.com/BepInEx/BepInEx/releases/download/v5.4.19/BepInEx_x64_5.4.19.0.zip";
And I also updated UnityDoorstop: (was not necessary)
private const string UnityDoorstopDownloadUrl =
"https://github.com/NeighTools/UnityDoorstop/releases/download/v3.4.0.0/Doorstop_x64_3.4.0.0.zip";
```
I'm a developer who isn't good at C #. I tried to check the behavior of this template to build a mod created based on this template, but it didn't work, so I found a first aid.
Perhaps this project has been abandoned, but I'll leave a guide for anyone who wants to use it for some reason.
Currently this Build Tool does not work. The reason is that the structure of "libraryfolders.vdf" is changed.
It used to be listed with numbers as keys (source), but now it's better structured.
current libraryfolders.vdf sample:
"libraryfolders"
{
"contentstatsid" "8073630155507702465"
"1"
{
"path" "G:\\SteamLibrary"
"label" ""
"contentid" "2269125834715082803"
"totalsize" "2000381014016"
"apps"
{
"550" "14905356071"
...
}
}
}
So, to get this to work, we need to look up the value in the Dictionary with the string "path" instead of the number.
ModTemplateValheim/BuildTool/Steam.cs
Lines 58 to 79 in cb7b2cf
var steamLibraryIndex = 0;
while (true)
{
steamLibraryIndex++;
--- if (!steamLibraryData.TryGetValue(steamLibraryIndex.ToString(), out var steamLibraryPath)) return null;
+++ if (!steamLibraryData.TryGetValue("path", out var steamLibraryPath)) return null;
var manifestFile = Path.Combine(steamLibraryPath, $"steamapps/appmanifest_{appId}.acf");
if (!File.Exists(manifestFile)) continue;
// Validate manifest is correct.
var game = GameDataFromAppManifest(manifestFile);
if (game.Id != appId) continue;
return game;
}
}
This works fine if there is only one path. If there are more than one, it probably won't work ... Write directly.
--- if (!steamLibraryData.TryGetValue(steamLibraryIndex.ToString(), out var steamLibraryPath)) return null;
+++ var steamLibraryPath = "G:\\\\SteamLibrary"; // oof
I am getting this error when trying to build
ModTemplateValheim.csproj(65,9): error :
ModTemplateValheim.csproj(65,9): error : Unhandled Exception: System.Exception: Steam game with id 892970 is not installed.
ModTemplateValheim.csproj(65,9): error : at BuildTool.Steam.FindGame(UInt32 steamAppId) in D:\PL\valheim-tools\ModTemplateValheim\BuildTool\Steam.cs:line 34
ModTemplateValheim.csproj(65,9): error : at BuildTool.Program.EnsureSteamGame(UInt32 steamAppId) in D:\PL\valheim-tools\ModTemplateValheim\BuildTool\Program.cs:line 161
ModTemplateValheim.csproj(65,9): error : at BuildTool.Program.<>c.<Main>b__9_2() in D:\PL\valheim-tools\ModTemplateValheim\BuildTool\Program.cs:line 34
ModTemplateValheim.csproj(65,9): error : at System.Threading.Tasks.Task`1.InnerInvoke()
ModTemplateValheim.csproj(65,9): error : at System.Threading.Tasks.Task.Execute()
ModTemplateValheim.csproj(65,9): error : --- End of stack trace from previous location where exception was thrown ---
ModTemplateValheim.csproj(65,9): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
ModTemplateValheim.csproj(65,9): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
ModTemplateValheim.csproj(65,9): error : at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
ModTemplateValheim.csproj(65,9): error : at BuildTool.Program.<Main>d__9.MoveNext() in D:\PL\valheim-tools\ModTemplateValheim\BuildTool\Program.cs:line 34
ModTemplateValheim.csproj(65,9): error : --- End of stack trace from previous location where exception was thrown ---
ModTemplateValheim.csproj(65,9): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
ModTemplateValheim.csproj(65,9): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
ModTemplateValheim.csproj(65,9): error : at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
ModTemplateValheim.csproj(65,9): error : at BuildTool.Program.<Main>(String[] args)
You can see I have Valheim installed below
My development enviroment
.NET SDK
Version: 5.0.103
Commit: 72dec52dbd
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.103\
.NET SDKs installed:
5.0.103 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
I am getting an error in this line of code
foreach (XmlElement elem in xDoc.DocumentElement.SelectSingleNode("/Project/PropertyGroup"))
System.NullReferenceException: 'Object reference not set to an instance of an object.'
System.Xml.XmlNode.SelectSingleNode(...) returned null.
Here is the game.props
file generated after fixing #2
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<GameAppId>892970</GameAppId>
<GameName>Valheim</GameName>
<GameFolderName>Valheim\</GameFolderName>
<GameDir>c:\program files (x86)\steam\steamapps\common\Valheim\</GameDir>
<GameManagedDir>c:\program files (x86)\steam\steamapps\common\Valheim\valheim_Data\Managed\</GameManagedDir>
</PropertyGroup>
</Project>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.