Skip to content

Commit 9fbd36e

Browse files
committed
Heart and Home update
-Updated skills -Updated food consumed -Update item list
1 parent 63df059 commit 9fbd36e

40 files changed

+866
-32
lines changed

ValheimCharacterEditor/Form1.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ValheimCharacterEditor/Form1.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Windows.Forms;
33
using System.Linq;
4+
using System.Collections.Generic;
45

56
namespace ValheimCharacterEditor
67
{
3.21 KB
Loading
6.83 KB
Loading
Loading
Loading
3.06 KB
Loading
5.93 KB
Loading
5.05 KB
Loading
Loading
4.78 KB
Loading
5.75 KB
Loading
5.47 KB
Loading
4.68 KB
Loading
4.05 KB
Loading
4.2 KB
Loading
4.92 KB
Loading
4.84 KB
Loading
5.98 KB
Loading
6.56 KB
Loading
5.29 KB
Loading
Loading
Loading

ValheimCharacterEditor/Images/Tar.png

6.1 KB
Loading
8.51 KB
Loading
Loading
5.02 KB
Loading
4.16 KB
Loading
4.71 KB
Loading
2.53 KB
Loading
2.02 KB
Loading
2.14 KB
Loading
7.08 KB
Loading
4.66 KB
Loading
4.68 KB
Loading

ValheimCharacterEditor/Parser.cs

+28-8
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,24 @@ static public ValheimEngine.Character CharacterReadData(string path)
156156
character.Foods = new List<ValheimEngine.Character.Food>();
157157
for (var i = 0; i < numberOfConsumedFood; i++)
158158
{
159-
var food = new ValheimEngine.Character.Food
159+
ValheimEngine.Character.Food food;
160+
if (character.InventoryVersion < 25) //Pre-Heart and home
160161
{
161-
Name = byteAccess.ReadString(),
162-
HpLeft = byteAccess.ReadSingle(),
163-
StaminaLeft = byteAccess.ReadSingle()
164-
};
162+
food = new ValheimEngine.Character.Food
163+
{
164+
Name = byteAccess.ReadString(),
165+
HpLeft = byteAccess.ReadSingle(),
166+
StaminaLeft = byteAccess.ReadSingle()
167+
};
168+
}
169+
else //heart and home release
170+
{
171+
food = new ValheimEngine.Character.Food
172+
{
173+
Name = byteAccess.ReadString(),
174+
TimeEaten = byteAccess.ReadSingle()
175+
};
176+
}
165177
character.Foods.Add(food);
166178
}
167179

@@ -287,9 +299,17 @@ static public byte[] CharacterWriteData(ValheimEngine.Character character)
287299
byteAccess2.Write(character.Foods.Count);
288300
foreach (var food in character.Foods)
289301
{
290-
byteAccess2.Write(food.Name);
291-
byteAccess2.Write(food.HpLeft);
292-
byteAccess2.Write(food.StaminaLeft);
302+
if (character.InventoryVersion < 25)//pre-heart and home
303+
{
304+
byteAccess2.Write(food.Name);
305+
byteAccess2.Write(food.HpLeft);
306+
byteAccess2.Write(food.StaminaLeft);
307+
}
308+
else //Heart and home
309+
{
310+
byteAccess2.Write(food.Name);
311+
byteAccess2.Write(food.TimeEaten);
312+
}
293313
}
294314

295315
byteAccess2.Write(character.SkillsVersion);

0 commit comments

Comments
 (0)