bugfix 06/10/26 + bone ship
This commit is contained in:
parent
7a863b07a6
commit
553303d0fd
27 changed files with 3206 additions and 226 deletions
|
|
@ -1,74 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public static class TrolFoodDebug
|
||||
{
|
||||
[HarmonyPatch(typeof(Player), "Update")]
|
||||
[HarmonyPostfix]
|
||||
public static void Update_Postfix(Player __instance)
|
||||
{
|
||||
if (__instance != Player.m_localPlayer) return;
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.F8))
|
||||
{
|
||||
Jotunn.Logger.LogInfo("=== F8 TROL FOOD DEBUG ===");
|
||||
Jotunn.Logger.LogInfo($"IsTrol: {TrolRace.IsTrol()}");
|
||||
|
||||
var foods = Traverse.Create(__instance).Field("m_foods").GetValue<System.Collections.Generic.List<Player.Food>>();
|
||||
Jotunn.Logger.LogInfo($"Native m_foods Count: {foods?.Count ?? 0}");
|
||||
if (foods != null)
|
||||
{
|
||||
for (int i = 0; i < foods.Count; i++)
|
||||
{
|
||||
var f = foods[i];
|
||||
Jotunn.Logger.LogInfo($" [{i}] {f.m_item?.m_shared?.m_name} | Time: {f.m_time} / {f.m_item?.m_shared?.m_foodBurnTime}");
|
||||
}
|
||||
}
|
||||
|
||||
if (TrolFoodManager.ExtraFoods.TryGetValue(__instance, out Player.Food extraFood))
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"ExtraFoods Dictionary has entry:");
|
||||
Jotunn.Logger.LogInfo($" Name: {extraFood?.m_item?.m_shared?.m_name}");
|
||||
Jotunn.Logger.LogInfo($" Time: {extraFood?.m_time} / {extraFood?.m_item?.m_shared?.m_foodBurnTime}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"ExtraFoods Dictionary is EMPTY for this player.");
|
||||
}
|
||||
|
||||
if (__instance.m_customData.TryGetValue("TrolFood_Prefab", out string prefab))
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"m_customData TrolFood_Prefab: {prefab}");
|
||||
}
|
||||
if (__instance.m_customData.TryGetValue("TrolFood_Time", out string time))
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"m_customData TrolFood_Time: {time}");
|
||||
}
|
||||
Jotunn.Logger.LogInfo("==========================");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Humanoid), "ConsumeItem")]
|
||||
[HarmonyPrefix]
|
||||
public static void ConsumeItem_Prefix(Humanoid __instance, Inventory inventory, ItemDrop.ItemData item)
|
||||
{
|
||||
if (__instance == Player.m_localPlayer && item != null && item.m_shared.m_name == "$item_bukeperry")
|
||||
{
|
||||
Jotunn.Logger.LogInfo("=== BUKEPERRY CONSUMED ===");
|
||||
Jotunn.Logger.LogInfo($"IsTrol: {TrolRace.IsTrol()}");
|
||||
if (TrolFoodManager.ExtraFoods.ContainsKey((Player)__instance))
|
||||
{
|
||||
Jotunn.Logger.LogInfo("ExtraFoods HAS entry. Will it clear?");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jotunn.Logger.LogInfo("ExtraFoods DOES NOT HAVE entry before clear.");
|
||||
}
|
||||
Jotunn.Logger.LogInfo("==========================");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public static class TrolFoodDebugUI
|
||||
{
|
||||
[HarmonyPatch(typeof(Player), "Update")]
|
||||
[HarmonyPostfix]
|
||||
public static void Update_Postfix(Player __instance)
|
||||
{
|
||||
if (__instance != Player.m_localPlayer) return;
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.F8))
|
||||
{
|
||||
Jotunn.Logger.LogInfo("=== F8 TROL FOOD UI DEBUG ===");
|
||||
|
||||
Transform healthPanel = Hud.instance?.transform.Find("hudroot/healthpanel");
|
||||
if (healthPanel != null)
|
||||
{
|
||||
Transform food3 = healthPanel.Find("TrolExtraFoodSlot");
|
||||
if (food3 != null)
|
||||
{
|
||||
Transform timeT = food3.Find("time");
|
||||
Jotunn.Logger.LogInfo($"Found TrolExtraFoodSlot! time transform found: {timeT != null}");
|
||||
if (timeT != null)
|
||||
{
|
||||
Component[] comps = timeT.GetComponents<Component>();
|
||||
Jotunn.Logger.LogInfo("Components on 'time' object:");
|
||||
foreach(var c in comps) {
|
||||
Jotunn.Logger.LogInfo(" - " + c.GetType().FullName);
|
||||
}
|
||||
|
||||
Text timeText = timeT.GetComponent<Text>();
|
||||
Jotunn.Logger.LogInfo($"UnityEngine.UI.Text component: {timeText != null}");
|
||||
if (timeText != null) Jotunn.Logger.LogInfo($"Text value: '{timeText.text}'");
|
||||
|
||||
var tmpComp = timeT.GetComponent("TMPro.TMP_Text");
|
||||
Jotunn.Logger.LogInfo($"TMPro.TMP_Text component: {tmpComp != null}");
|
||||
if (tmpComp != null) {
|
||||
var prop = tmpComp.GetType().GetProperty("text");
|
||||
if (prop != null) {
|
||||
Jotunn.Logger.LogInfo($"TMP value: '{prop.GetValue(tmpComp, null)}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Jotunn.Logger.LogInfo("TrolExtraFoodSlot NOT FOUND! (Did Awake_Postfix run?)");
|
||||
}
|
||||
}
|
||||
|
||||
if (TrolFoodManager.ExtraFoods.TryGetValue(__instance, out Player.Food extraFood) && extraFood != null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"ExtraFoods Dictionary:");
|
||||
Jotunn.Logger.LogInfo($" Name: {extraFood.m_item?.m_shared?.m_name}");
|
||||
Jotunn.Logger.LogInfo($" Time: {extraFood.m_time} / {extraFood.m_item?.m_shared?.m_foodBurnTime}");
|
||||
}
|
||||
|
||||
Jotunn.Logger.LogInfo("=============================");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue