Skip to content

Commit 932ff0e

Browse files
committed
Fixed game compatibility, chat feature and improved item giver compatibility with other mods
1 parent 4608ae6 commit 932ff0e

File tree

7 files changed

+31
-9
lines changed

7 files changed

+31
-9
lines changed

ValheimTooler/Core/MiscHacks.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ private static void ChatMessage(Talker.Type type, string username, string messag
261261
}
262262
}
263263

264+
UserInfo fakePlayerSender = new UserInfo
265+
{
266+
Name = username,
267+
Gamertag = (string)ReflectionExtensions.CallStaticMethod<UserInfo>("GetLocalPlayerGamertag"),
268+
NetworkUserId = PrivilegeManager.GetNetworkUserId()
269+
};
270+
264271
if (playerSender)
265272
{
266273
if (type == Talker.Type.Shout)
@@ -271,7 +278,7 @@ private static void ChatMessage(Talker.Type type, string username, string messag
271278
{
272279
playerSender.GetHeadPoint(),
273280
2,
274-
username,
281+
fakePlayerSender,
275282
message,
276283
PrivilegeManager.GetNetworkUserId()
277284
});
@@ -285,7 +292,7 @@ private static void ChatMessage(Talker.Type type, string username, string messag
285292
nview.InvokeRPC(ZNetView.Everybody, "Say", new object[]
286293
{
287294
(int)type,
288-
username,
295+
fakePlayerSender,
289296
message,
290297
PrivilegeManager.GetNetworkUserId()
291298
});

ValheimTooler/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
3333
// en utilisant '*', comme indiqué ci-dessous :
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.7.0")]
36-
[assembly: AssemblyFileVersion("1.7.0")]
35+
[assembly: AssemblyVersion("1.8.0")]
36+
[assembly: AssemblyFileVersion("1.8.0")]

ValheimTooler/UI/SpriteManager.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public static Texture2D TextureFromSprite(Sprite sprite)
3939
(int)Math.Ceiling(sprite.textureRect.height));
4040
newText.SetPixels(newColors);
4141
newText.Apply();
42+
43+
if (newText.width > 200 || newText.height > 200)
44+
newText.Resize(60, 60);
45+
4246
return newText;
4347
}
4448

ValheimTooler/Utils/ReflectionExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,16 @@ public static object CallMethod(this object obj, string methodName, params objec
2929
}
3030
return null;
3131
}
32+
33+
public static object CallStaticMethod<T>(string methodName, params object[] args) where T: new()
34+
{
35+
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy;
36+
var mi = typeof(T).GetMethod(methodName, bindingFlags);
37+
if (mi != null)
38+
{
39+
return mi.Invoke(null, args);
40+
}
41+
return null;
42+
}
3243
}
3344
}

ValheimToolerLauncher/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
5252
// en utilisant '*', comme indiqué ci-dessous :
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.7.0")]
55-
[assembly: AssemblyFileVersion("1.7.0")]
54+
[assembly: AssemblyVersion("1.8.0")]
55+
[assembly: AssemblyFileVersion("1.8.0")]

ValheimToolerMod/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
3333
// en utilisant '*', comme indiqué ci-dessous :
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.7.0.0")]
36-
[assembly: AssemblyFileVersion("1.7.0.0")]
35+
[assembly: AssemblyVersion("1.8.0.0")]
36+
[assembly: AssemblyFileVersion("1.8.0.0")]

ValheimToolerMod/ValheimToolerMod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ValheimToolerMod : BaseUnityPlugin
1414
{
1515
const string PluginGUID = "com.github.Astropilot.ValheimTooler";
1616
const string PluginName = "ValheimTooler";
17-
const string PluginVersion = "1.7.0";
17+
const string PluginVersion = "1.8.0";
1818

1919
private Harmony _harmony;
2020

0 commit comments

Comments
 (0)