Skip to content

Commit c48078e

Browse files
committed
New version 1.7.0:
- Fixed configuration file for bepinex version - Fixed usage of skill "All" to apply to all skills - ESP: Performance improved, fixed deposits and added radius setting - Teleport: Teleport yourself of other player to a player or a minimap pin, or to coordinates - New features: Allow teleporting with restricted items, autopin of deposits, fast crafting - Some features improved like infinite stamina, 0 weight inventory
1 parent 695ef65 commit c48078e

28 files changed

+1047
-321
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ root = true
33
[*]
44
indent_style = space
55
indent_size = 2
6-
end_of_line = lf
6+
end_of_line = crlf
77
charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
@@ -146,4 +146,4 @@ indent_size = 2
146146
indent_size = 2
147147

148148
[*.cmd]
149-
indent_size = 2
149+
indent_size = 2

ValheimTooler/Core/ESP.cs

Lines changed: 148 additions & 69 deletions
Large diffs are not rendered by default.

ValheimTooler/Core/EntitiesItemsHacks.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,17 @@ private static void RemoveAllDrops()
176176
ItemDrop[] itemDrops = UnityEngine.Object.FindObjectsOfType<ItemDrop>();
177177
foreach (ItemDrop itemDrop in itemDrops)
178178
{
179-
ZNetView component = itemDrop.GetComponent<ZNetView>();
180-
if (component && component.IsValid() && component.IsOwner())
179+
Fish component = itemDrop.gameObject.GetComponent<Fish>();
180+
181+
if (!component || component.IsOutOfWater())
181182
{
182-
component.Destroy();
183+
ZNetView component2 = itemDrop.GetComponent<ZNetView>();
184+
if (component2 && component2.IsValid() && component2.IsOwner())
185+
{
186+
component2.Destroy();
187+
}
183188
}
189+
184190
}
185191
}
186192
}

ValheimTooler/Core/Extensions/PlayerExtensions.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using UnityEngine;
23
using ValheimTooler.Utils;
34

45
namespace ValheimTooler.Core.Extensions
@@ -127,16 +128,19 @@ public static void VTActiveGuardianPower(this Player player, string guardianPowe
127128
}
128129
}
129130

130-
public static void VTUpdateSkillLevel(this Player player, string skillName, int level)
131+
public static void VTUpdateSkillLevel(this Player player, Skills.SkillType skillType, int level)
131132
{
132133
if (player != null)
133134
{
134-
Skills.SkillType skillType = (Skills.SkillType)Enum.Parse(typeof(Skills.SkillType), skillName);
135-
Skills.Skill skill = (Skills.Skill)player.GetSkills().CallMethod("GetSkill", skillType);
135+
Skills.SkillDef skillDef = (Skills.SkillDef)player.GetSkills().CallMethod("GetSkillDef", skillType);
136136

137-
int offset = (int)Math.Ceiling(level - skill.m_level);
137+
if (skillDef != null)
138+
{
139+
Skills.Skill skill = (Skills.Skill)player.GetSkills().CallMethod("GetSkill", skillType);
138140

139-
player.GetSkills().CheatRaiseSkill(skillName.ToLower(), offset);
141+
skill.m_level = level;
142+
skill.m_level = Mathf.Clamp(skill.m_level, 0f, 100f);
143+
}
140144
}
141145
}
142146

ValheimTooler/Core/MiscHacks.cs

Lines changed: 149 additions & 96 deletions
Large diffs are not rendered by default.

ValheimTooler/Core/PlayerHacks.cs

Lines changed: 214 additions & 104 deletions
Large diffs are not rendered by default.

ValheimTooler/EntryPoint.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
using System.Collections.Generic;
21
using System.Linq;
32
using System.Reflection;
4-
using RapidGUI;
53
using UnityEngine;
64
using ValheimTooler.Core;
7-
using ValheimTooler.Core.Extensions;
85
using ValheimTooler.UI;
96
using ValheimTooler.Utils;
107

@@ -18,11 +15,6 @@ public class EntryPoint : MonoBehaviour
1815
private bool _showMainWindow = true;
1916
private bool _wasMainWindowShowed = false;
2017
public static bool s_showItemGiver = false;
21-
public static bool s_showPlayerESP = false;
22-
public static bool s_showMonsterESP = false;
23-
public static bool s_showDroppedESP = false;
24-
public static bool s_showDepositESP = false;
25-
public static bool s_showPickableESP = false;
2618

2719
private WindowToolbar _windowToolbar = WindowToolbar.PLAYER;
2820
private readonly string[] _toolbarChoices = {

ValheimTooler/Loader.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1+
using HarmonyLib;
12
using RapidGUI;
23
using UnityEngine;
3-
using ValheimTooler.Utils;
44

55
namespace ValheimTooler
66
{
77
class Loader
88
{
99
public static void Init()
1010
{
11-
Loader.s_entryPoint = new GameObject();
12-
Loader.s_entryPoint.AddComponent<EntryPoint>();
13-
Loader.s_entryPoint.AddComponent<RapidGUIBehaviour>();
14-
Object.DontDestroyOnLoad(Loader.s_entryPoint);
11+
if (Loader.s_entryPoint == null)
12+
{
13+
RunPatches();
14+
Loader.s_entryPoint = new GameObject();
15+
Loader.s_entryPoint.AddComponent<EntryPoint>();
16+
Loader.s_entryPoint.AddComponent<RapidGUIBehaviour>();
17+
Object.DontDestroyOnLoad(Loader.s_entryPoint);
18+
}
19+
}
20+
21+
private static void RunPatches()
22+
{
23+
s_harmony.PatchAll();
1524
}
1625

1726
public static void Unload()
@@ -21,9 +30,12 @@ public static void Unload()
2130
private static void _Unload()
2231
{
2332
GameObject.Destroy(Loader.s_entryPoint);
33+
34+
s_harmony.UnpatchSelf();
2435
}
2536

26-
private static GameObject s_entryPoint;
37+
private static GameObject s_entryPoint = null;
38+
private static readonly Harmony s_harmony = new Harmony("ValheimTooler");
2739
}
2840

2941
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using UnityEngine;
2+
using ValheimTooler.Core;
3+
using ValheimTooler.Utils;
4+
5+
namespace ValheimTooler.Models.Mono
6+
{
7+
class PinnedObject : MonoBehaviour
8+
{
9+
public Minimap.PinData pin;
10+
11+
public void Init(string aName)
12+
{
13+
pin = Minimap.instance.AddPin(base.transform.position, Minimap.PinType.Icon3, aName, ConfigManager.instance.s_permanentPins, false);
14+
ZLog.Log(string.Format("Tracking: {0} at {1} {2} {3}", new object[]
15+
{
16+
aName,
17+
base.transform.position.x,
18+
base.transform.position.y,
19+
base.transform.position.z
20+
}));
21+
}
22+
23+
private void OnDestroy()
24+
{
25+
bool flag = pin != null && Minimap.instance != null && !ConfigManager.instance.s_permanentPins;
26+
if (flag)
27+
{
28+
Minimap.instance.RemovePin(pin);
29+
ZLog.Log(string.Format("Removing: {0} at {1} {2} {3}", new object[]
30+
{
31+
pin.m_name,
32+
base.transform.position.x,
33+
base.transform.position.y,
34+
base.transform.position.z
35+
}));
36+
}
37+
}
38+
}
39+
}

ValheimTooler/Models/TPTarget.cs

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
using System;
2+
using UnityEngine;
3+
4+
namespace ValheimTooler.Models
5+
{
6+
public class TPTarget
7+
{
8+
public readonly TargetType targetType;
9+
public readonly ZNet.PlayerInfo playerNet;
10+
public readonly Player player;
11+
public readonly ZNetPeer peer;
12+
public readonly Minimap.PinData minimapPin;
13+
14+
public string Name
15+
{
16+
get
17+
{
18+
switch (targetType)
19+
{
20+
case TargetType.PlayerNet:
21+
return playerNet.m_name;
22+
case TargetType.Player:
23+
return player.GetPlayerName();
24+
case TargetType.Peer:
25+
return peer.m_playerName;
26+
case TargetType.MapPin:
27+
return $"{minimapPin.m_name} ({minimapPin.m_type})";
28+
}
29+
return "";
30+
}
31+
}
32+
33+
public Vector3? Position
34+
{
35+
get
36+
{
37+
switch (targetType)
38+
{
39+
case TargetType.PlayerNet:
40+
if (playerNet.m_publicPosition)
41+
{
42+
return playerNet.m_position;
43+
}
44+
return null;
45+
case TargetType.Player:
46+
return player.transform.position;
47+
case TargetType.Peer:
48+
return null;
49+
case TargetType.MapPin:
50+
Vector3 pin_pos = minimapPin.m_pos;
51+
52+
pin_pos.y = Mathf.Clamp(pin_pos.y, ZoneSystem.instance.m_waterLevel, ZoneSystem.instance.m_waterLevel);
53+
54+
return pin_pos;
55+
}
56+
return null;
57+
}
58+
}
59+
60+
public TPTarget(TargetType targetType, object target)
61+
{
62+
this.targetType = targetType;
63+
64+
switch (targetType)
65+
{
66+
case TargetType.PlayerNet:
67+
playerNet = (ZNet.PlayerInfo)target;
68+
break;
69+
case TargetType.Player:
70+
player = (Player)target;
71+
break;
72+
case TargetType.Peer:
73+
peer = (ZNetPeer)target;
74+
break;
75+
case TargetType.MapPin:
76+
minimapPin = (Minimap.PinData)target;
77+
break;
78+
}
79+
}
80+
81+
public override string ToString()
82+
{
83+
switch (targetType)
84+
{
85+
case TargetType.PlayerNet:
86+
return $"Player {playerNet.m_name}";
87+
case TargetType.Player:
88+
return $"Player {player.GetPlayerName()}";
89+
case TargetType.Peer:
90+
return $"Player {peer.m_playerName}";
91+
case TargetType.MapPin:
92+
return $"Map pin: {minimapPin.m_name} ({minimapPin.m_type})";
93+
}
94+
return "Unknow";
95+
}
96+
97+
public enum TargetType
98+
{
99+
PlayerNet,
100+
Player,
101+
Peer,
102+
MapPin
103+
}
104+
}
105+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using HarmonyLib;
2+
using ValheimTooler.Core;
3+
4+
namespace ValheimTooler.Patches
5+
{
6+
[HarmonyPatch(typeof(Inventory), "IsTeleportable")]
7+
class AlwaysTeleportAllow
8+
{
9+
private static bool Prefix(ref bool __result)
10+
{
11+
if (PlayerHacks.s_bypassRestrictedTeleportable)
12+
{
13+
__result = true;
14+
return false;
15+
}
16+
return true;
17+
}
18+
}
19+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Linq;
3+
using HarmonyLib;
4+
using ValheimTooler.Core;
5+
using ValheimTooler.Models.Mono;
6+
7+
namespace ValheimTooler.Patches
8+
{
9+
[HarmonyPatch(typeof(Destructible), "Start")]
10+
class AutoPinResources
11+
{
12+
private static Random s_random = new Random();
13+
private const string Chars = "0123456789";
14+
private static void Postfix(ref Destructible __instance)
15+
{
16+
if (!MiscHacks.s_enableAutopinMap)
17+
return;
18+
HoverText component = __instance.GetComponent<HoverText>();
19+
if (component)
20+
{
21+
if (__instance.gameObject.GetComponent<PinnedObject>() != null)
22+
return;
23+
24+
string text = component.m_text.ToLower();
25+
26+
if (!text.Contains("deposit"))
27+
return;
28+
29+
string random_nounce = new string(Enumerable.Repeat(Chars, 5).Select(s => s[s_random.Next(s.Length)]).ToArray());
30+
string name = component.GetHoverName() + " [VT" + random_nounce + "]";
31+
32+
__instance.gameObject.AddComponent<PinnedObject>().Init(name);
33+
ZLog.Log($"Pin candidate: {name}");
34+
}
35+
}
36+
}
37+
}

ValheimTooler/Patches/EdgeMapKill.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using HarmonyLib;
3+
using ValheimTooler.Core.Extensions;
4+
5+
namespace ValheimTooler.Patches
6+
{
7+
[HarmonyPatch(typeof(Player), "EdgeOfWorldKill", new Type[]
8+
{
9+
typeof(float)
10+
})]
11+
class EdgeMapKill
12+
{
13+
private static bool Prefix()
14+
{
15+
if (Player.m_localPlayer != null && Player.m_localPlayer.VTInGodMode())
16+
{
17+
return false;
18+
}
19+
return true;
20+
}
21+
}
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using HarmonyLib;
3+
using ValheimTooler.Core;
4+
5+
namespace ValheimTooler.Patches
6+
{
7+
[HarmonyPatch(typeof(Player), "UseStamina", new Type[]
8+
{
9+
typeof(float)
10+
})]
11+
class InfiniteStamina
12+
{
13+
private static void Prefix(ref float v)
14+
{
15+
if (PlayerHacks.s_isInfiniteStaminaMe)
16+
{
17+
v = 0f;
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)