diff --git a/DoPrebuild.props b/DoPrebuild.props
new file mode 100644
index 0000000..016ea0c
--- /dev/null
+++ b/DoPrebuild.props
@@ -0,0 +1,6 @@
+
+
+
+ true
+
+
\ No newline at end of file
diff --git a/QuickPing/Patches/Localization.cs b/QuickPing/Patches/Localization.cs
index dcfc851..9224a84 100644
--- a/QuickPing/Patches/Localization.cs
+++ b/QuickPing/Patches/Localization.cs
@@ -68,7 +68,6 @@ public static string Localize(Location location)
res = Localization.instance.Localize("$location_mountaincave");
break;
#endregion
-
#region Mistlands
case "Mistlands_DvergrTownEntrance":
case "Mistlands_DvergrTownEntrance1":
diff --git a/QuickPing/Patches/Minimap.cs b/QuickPing/Patches/Minimap.cs
index 33f328c..77cff40 100644
--- a/QuickPing/Patches/Minimap.cs
+++ b/QuickPing/Patches/Minimap.cs
@@ -16,8 +16,6 @@ namespace QuickPing.Patches
///
internal static class Minimap_Patch
{
-
-
private static GameObject panel;
private static GameObject nameInput;
private static GameObject toggleSaveName;
@@ -33,7 +31,6 @@ internal static class Minimap_Patch
///
public static Minimap.PinType IsPinable(string strID)
{
-
string baseLocalization = Localization_Patch.GetBaseTranslation(strID);
Dictionary> pinables = new()
{
@@ -70,7 +67,8 @@ public static Minimap.PinType IsPinable(string strID)
"$piece_deposit_silver",
"$piece_deposit_silvervein",
"$piece_deposit_tin",
- "$piece_mudpile"
+ "$piece_mudpile",
+ "$piece_giant_brain"
}
},
@@ -89,6 +87,7 @@ public static Minimap.PinType IsPinable(string strID)
"$item_mushroomblue",
"$item_thistle",
"$item_jotunpuffs",
+ "$item_ancientroot",
// fix #58 conflicts with PlantEverything
"$peRaspberryBushName",
"$peBlueberryBushName",
@@ -98,7 +97,7 @@ public static Minimap.PinType IsPinable(string strID)
"$pePickableBlueMushroomName",
"$pePickableThistleName",
"$pePickableDandelionName",
-
+ "$pePickableJotunpuffsName",
}
},
@@ -125,6 +124,7 @@ public static Minimap.PinType IsPinable(string strID)
return pinType;
}
}
+
return Minimap.PinType.None;
}
@@ -132,18 +132,21 @@ public static Minimap.PinType IsPinable(string strID)
/// Force rename pin
///
///
- internal static void RenamePin(HoverObject obj) => AddPin(obj.Hover, obj.Destructible, obj.Name, obj.center, rename: true);
+ internal static void RenamePin(HoverObject obj) =>
+ AddPin(obj.Hover, obj.Destructible, obj.Name, obj.center, rename: true);
///
/// Add correct pin to map if Settings.
///
///
public static void AddPin(HoverObject obj) => AddPin(obj.Hover, obj.Destructible, obj.Name, obj.center);
+
///
/// Add correct pin to map if Settings and bypass filters.
///
///
- public static void ForceAddPin(HoverObject obj) => AddPin(obj.Hover, obj.Destructible, obj.Name, obj.center, true);
+ public static void ForceAddPin(HoverObject obj) =>
+ AddPin(obj.Hover, obj.Destructible, obj.Name, obj.center, true);
///
/// Add correct pin to map if Settings.
@@ -153,9 +156,14 @@ public static Minimap.PinType IsPinable(string strID)
/// Display Name of hover object
/// Pinged position (last raycast point or hover center)
/// Bypass filters
- public static void AddPin(GameObject hover, IDestructible idestructible, string strID, Vector3 pos, bool force = false, bool rename = false)
+ public static void AddPin(GameObject hover, IDestructible idestructible, string strID, Vector3 pos,
+ bool force = false, bool rename = false)
{
- if (!Settings.AddPin.Value && !force) { return; }
+ if (!Settings.AddPin.Value && !force)
+ {
+ return;
+ }
+
bool pinned = false;
Minimap.PinData pinData = new Minimap.PinData
@@ -180,15 +188,17 @@ public static void AddPin(GameObject hover, IDestructible idestructible, string
}
pinData.m_pos = pos;
- pinData = Minimap.instance.AddPin(pinData.m_pos, pinData.m_type, pinData.m_name, true, false, 0L);
+ pinData = Minimap.instance.AddPin(pinData.m_pos, pinData.m_type, pinData.m_name, true, false,
+ 0L);
pinned = true;
- QuickPingPlugin.Log.LogInfo($"Add Portal Pin : Name:{pinData.m_name} x:{pinData.m_pos.x}, y:{pinData.m_pos.y}, Type:{pinData.m_type}");
+ QuickPingPlugin.Log.LogInfo(
+ $"Add Portal Pin : Name:{pinData.m_name} x:{pinData.m_pos.x}, y:{pinData.m_pos.y}, Type:{pinData.m_type}");
}
+
break;
default:
if (closestPin == null || rename)
{
-
pinData.m_name ??= Localization.instance.Localize(strID);
// check for customnames
@@ -201,12 +211,15 @@ public static void AddPin(GameObject hover, IDestructible idestructible, string
{
pinData.m_name = Settings.DefaultPingText;
}
+
if (pinData.m_type == Minimap.PinType.None && force)
{
pinData.m_type = Settings.DefaultPinType.Value;
- pinData = Minimap.instance.AddPin(pinData.m_pos, pinData.m_type, pinData.m_name, true, false, 0L);
+ pinData = Minimap.instance.AddPin(pinData.m_pos, pinData.m_type, pinData.m_name, true,
+ false, 0L);
pinned = true;
- QuickPingPlugin.Log.LogInfo($"Add Pin : Name:{pinData.m_name} x:{pinData.m_pos.x}, y:{pinData.m_pos.y}, Type:{pinData.m_type}");
+ QuickPingPlugin.Log.LogInfo(
+ $"Add Pin : Name:{pinData.m_name} x:{pinData.m_pos.x}, y:{pinData.m_pos.y}, Type:{pinData.m_type}");
break;
}
@@ -214,12 +227,15 @@ public static void AddPin(GameObject hover, IDestructible idestructible, string
{
if (closestPin == null)
{
- pinData = Minimap.instance.AddPin(pinData.m_pos, pinData.m_type, pinData.m_name, true, false, 0L);
+ pinData = Minimap.instance.AddPin(pinData.m_pos, pinData.m_type, pinData.m_name, true,
+ false, 0L);
pinned = true;
}
else if (rename)
pinData = closestPin;
- QuickPingPlugin.Log.LogInfo($"Add Pin : Name:{pinData.m_name} x:{pinData.m_pos.x}, y:{pinData.m_pos.y}, Type:{pinData.m_type}");
+
+ QuickPingPlugin.Log.LogInfo(
+ $"Add Pin : Name:{pinData.m_name} x:{pinData.m_pos.x}, y:{pinData.m_pos.y}, Type:{pinData.m_type}");
//Check if Settings.AskForName.Value is true, and if CustomNames contains its name.
//if true ask for user input before adding pin
@@ -232,23 +248,28 @@ public static void AddPin(GameObject hover, IDestructible idestructible, string
}
}
}
+
break;
}
if (idestructible != null && pinned)
{
- FieldInfo fieldInfo = idestructible.GetType().GetField("m_nview", BindingFlags.Instance | BindingFlags.NonPublic);
+ FieldInfo fieldInfo = idestructible.GetType()
+ .GetField("m_nview", BindingFlags.Instance | BindingFlags.NonPublic);
if (fieldInfo == null)
{
- QuickPingPlugin.Log.LogWarning($"Unable to link destructible {idestructible} to pin: {pinData.m_name}. (Is it a god?)");
+ QuickPingPlugin.Log.LogWarning(
+ $"Unable to link destructible {idestructible} to pin: {pinData.m_name}. (Is it a god?)");
return;
}
+
ZNetView netView = fieldInfo.GetValue(idestructible) as ZNetView;
ZDOID uid = netView.GetZDO().m_uid;
if (uid == null)
{
QuickPingPlugin.Log.LogError($"Try adding {idestructible} but {netView} uid is null");
}
+
if (!DataManager.PinnedObjects.ContainsKey(uid))
{
DataManager.PinnedObjects[uid] = pinData;
@@ -264,6 +285,7 @@ public static void UpdateNameInput()
{
Minimap.instance.m_wasFocused = false;
}
+
if (Minimap.instance.m_namePin != null)
{
panel.SetActive(true);
@@ -275,6 +297,7 @@ public static void UpdateNameInput()
{
EventSystem.current.SetSelectedGameObject(nameInput);
}
+
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
{
ValidateNameInput(inputField, toggleSave.isOn);
@@ -283,6 +306,7 @@ public static void UpdateNameInput()
{
CancelNameInput();
}
+
Minimap.instance.m_wasFocused = true;
}
else //end
@@ -329,9 +353,8 @@ private static void ValidateNameInput(InputField inputField, bool save)
QuickPingPlugin.Log.LogInfo($"Save name {Minimap.instance.m_namePin.m_name} for {originalText}");
SaveName(Minimap.instance.m_namePin.m_name, originalText);
}
- Minimap.instance.m_namePin = null;
-
+ Minimap.instance.m_namePin = null;
}
///
/// Save the name of a pinned object and update PinnedObjects list with new value
@@ -427,7 +450,7 @@ private static void InitNameInput()
parent: panel.transform,
width: 20f,
height: 20f
- );
+ );
Text saveNameText = toggleSaveName.transform.Find("Label").GetComponent();
saveNameText.color = Color.white;
@@ -448,8 +471,8 @@ private static void InitNameInput()
//saveAllText.text = "Update all pins.";
//saveAllText.enabled = true;
//toggleSaveAll.GetComponent().interactable = false;
-
}
+
#endregion
private static string GetPortalTag(Hoverable hoverable)
@@ -460,9 +483,6 @@ private static string GetPortalTag(Hoverable hoverable)
}
-
-
-
#region Patches
[HarmonyPatch(typeof(Minimap))]
@@ -482,26 +502,21 @@ public static bool RemovePin(Minimap __instance, Minimap.PinData pin)
if (p.Value.Compare(pin))
{
pin = __instance.GetClosestPin(p.Value.m_pos, Settings.ClosestPinRange.Value);
- DataManager.PinnedObjects.Remove(DataManager.PinnedObjects.FirstOrDefault((x) => x.Value.Compare(p.Value)).Key);
+ DataManager.PinnedObjects.Remove(DataManager.PinnedObjects
+ .FirstOrDefault((x) => x.Value.Compare(p.Value)).Key);
break;
}
-
}
+
if ((bool)pin.m_uiElement)
{
__instance.DestroyPinMarker(pin);
}
+
__instance.m_pins.Remove(pin);
return false;
}
-
-
-
-
#endregion
-
}
-
-
-}
+}
\ No newline at end of file
diff --git a/QuickPing/Patches/Player.cs b/QuickPing/Patches/Player.cs
index cae9cb9..12f4442 100644
--- a/QuickPing/Patches/Player.cs
+++ b/QuickPing/Patches/Player.cs
@@ -76,17 +76,13 @@ private static void Player_Update(Player __instance)
#endregion
private static string GetHoverName(string pingText, GameObject hover, HoverType type)
{
- Hoverable hoverable;
- Character hoverCreature;
- Piece piece;
- Location location;
switch (type)
{
case HoverType.GameObject:
//pingText = Settings.pingText;
break;
case HoverType.Hoverable:
- hover.TryGetComponent(out hoverable);
+ hover.TryGetComponent(out Hoverable hoverable);
pingText = !hoverable.GetHoverName().StartsWith("$")
? Localization_Patch.GetBaseTranslation(hoverable.GetHoverName())
: hoverable.GetHoverName();
@@ -107,15 +103,15 @@ private static string GetHoverName(string pingText, GameObject hover, HoverType
pingText = hover.GetComponentInParent().m_name;
break;
case HoverType.Piece:
- piece = hover.GetComponent();
+ var piece = hover.GetComponent();
pingText = piece.m_name;
break;
case HoverType.Location:
- location = hover.GetComponent();
+ var location = hover.GetComponent();
pingText = Localization_Patch.Localize(location);
break;
case HoverType.Character:
- hoverCreature = hover.GetComponent();
+ var hoverCreature = hover.GetComponent();
pingText = hoverCreature.m_name;
break;
diff --git a/QuickPing/QuickPing.csproj b/QuickPing/QuickPing.csproj
index da55be3..c037a28 100644
--- a/QuickPing/QuickPing.csproj
+++ b/QuickPing/QuickPing.csproj
@@ -97,9 +97,6 @@
2022.3.12
-
- 0.217.38
-
5.12.0
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -109,6 +106,35 @@
2.18.0
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_googleanalytics-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_guiutils-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_lux-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_postprocessing-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_simplemeshcombine-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_steamworks-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_sunshafts-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_utils-publicized.dll
+
+
+ ..\..\Digitalroot.Valheim.References\src\Digitalroot.Valheim.References\lib\assembly_valheim-publicized.dll
+
+
@@ -141,7 +167,7 @@
-
+