using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Managers;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AllInOneMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AllInOneMod")]
[assembly: AssemblyTitle("AllInOneMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Kladbm.AllInOneMod;
[BepInPlugin("Kladbm.AllInOneMod", "AllInOneMod", "1.2.2")]
public class AllInOnePlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(BaseAI), "Awake")]
public static class Patch_BaseAI_Awake
{
private static void Postfix(BaseAI __instance)
{
if ((Object)(object)__instance == (Object)null)
{
return;
}
string text = ((Object)__instance).name.Replace("(Clone)", "");
float num = 1.5f;
float num2 = 1.25f;
float num3 = num;
string[] source = new string[10] { "GoblinShaman", "GoblinShaman_Hildir", "GoblinShaman_Hildir_nochest", "GreydwarfMage_TW", "SkeletonMage_TW", "FenringMage_TW", "GoblinMage_TW", "CorruptedDvergerMage_TW", "GDAncientShaman_TW", "GDAncientShaman_rootspawn_TW" };
string[] source2 = new string[6] { "Draugr", "Draugr_Elite", "Draugr_Ranged", "Blob", "BlobElite", "Leech" };
string[] source3 = new string[8] { "Goblin", "Goblin_Gem", "GoblinArcher", "GoblinBrute", "GoblinBrute_Hildir", "GoblinBruteBros", "GoblinBruteBros_nochest", "GoblinKing" };
switch (text)
{
case "Ulv":
case "Fenring":
case "Wolf":
case "Fenring_Cultist":
num2 *= 1.5f;
num3 *= 3f;
break;
case "Bat":
case "Volture":
case "Dragon":
num2 *= 1.75f;
num3 *= 1.75f;
break;
case "Deathsquito":
num2 *= 1.1f;
num3 *= 1.1f;
break;
case "Serpent":
case "Shark_TW":
num2 *= 4f;
num3 *= 2f;
break;
case "Fox_TW":
num2 *= 1.25f;
num3 *= 1.25f;
break;
case "Deer":
case "RottingElk_TW":
num2 *= 1f;
num3 *= 2f;
break;
case "Prowler_TW":
num2 *= 1f;
num3 *= 2f;
break;
case "Tick":
num2 *= 1.25f;
num3 *= 1.25f;
break;
case "Wraith":
case "HelWraith_TW":
num2 *= 1.5f;
num3 *= 1f;
break;
default:
if (source.Contains(text))
{
num2 = 1.5f;
num3 = 1.5f;
}
if (source2.Contains(text))
{
num2 = 0.9f;
num3 = 0.9f;
}
if (source3.Contains(text))
{
num2 = 1.1f;
num3 = 1.1f;
}
break;
}
float viewRange = __instance.m_viewRange;
float hearRange = __instance.m_hearRange;
__instance.m_viewRange *= num2;
__instance.m_hearRange *= num3;
_logger.LogInfo((object)("[" + text + "] Awareness boost: " + $"View {viewRange} → {__instance.m_viewRange} (x{num2:0.00}), " + $"Hear {hearRange} → {__instance.m_hearRange} (x{num3:0.00})"));
}
}
[HarmonyPatch(typeof(Skills), "OnDeath")]
private static class NoCraftingSkillLossPatch
{
private static Skill craftingSkill;
private static Skill fishingSkill;
private static readonly FieldInfo skillDataField = typeof(Skills).GetField("m_skillData", BindingFlags.Instance | BindingFlags.NonPublic);
private static void Prefix(Skills __instance)
{
Dictionary<SkillType, Skill> dictionary = (Dictionary<SkillType, Skill>)skillDataField.GetValue(__instance);
dictionary.TryGetValue((SkillType)107, out craftingSkill);
if (craftingSkill != null)
{
_logger.LogInfo((object)$"[AllInOneMod] Saving Crafting skill level: {craftingSkill.m_level:0.00}");
dictionary.Remove((SkillType)107);
_logger.LogInfo((object)"[AllInOneMod] Removed Crafting skill from death penalty");
}
dictionary.TryGetValue((SkillType)104, out fishingSkill);
if (fishingSkill != null)
{
_logger.LogInfo((object)$"[AllInOneMod] Saving Fishing skill level: {fishingSkill.m_level:0.00}");
dictionary.Remove((SkillType)104);
_logger.LogInfo((object)"[AllInOneMod] Removed Fishing skill from death penalty");
}
}
private static void Finalizer(Skills __instance)
{
Dictionary<SkillType, Skill> dictionary = (Dictionary<SkillType, Skill>)skillDataField.GetValue(__instance);
if (craftingSkill != null)
{
dictionary.Add((SkillType)107, craftingSkill);
_logger.LogInfo((object)$"[AllInOneMod] Restored Crafting skill level: {craftingSkill.m_level:0.00}");
}
if (fishingSkill != null)
{
dictionary.Add((SkillType)104, fishingSkill);
_logger.LogInfo((object)$"[AllInOneMod] Restored Fishing skill level: {fishingSkill.m_level:0.00}");
}
}
}
private const string ModName = "AllInOneMod";
private const string ModVersion = "1.2.2";
private const string Author = "Kladbm";
private const string ModGUID = "Kladbm.AllInOneMod";
private readonly Harmony _harmony = new Harmony("Kladbm.AllInOneMod");
private static ManualLogSource _logger;
private void Awake()
{
_logger = ((BaseUnityPlugin)this).Logger;
_logger.LogInfo((object)"AllInOneMod initializing...");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
ItemManager.OnItemsRegistered += OnItemsRegistered;
_logger.LogInfo((object)"All patches applied successfully.");
}
private void OnItemsRegistered()
{
ObjectDB instance = ObjectDB.instance;
if ((Object)(object)instance == (Object)null)
{
_logger.LogInfo((object)"[AllInOneMod] ObjectDB.instance is null in OnItemsRegistered!");
return;
}
PatchLightSourceFuel();
PatchCart();
PatchCrossbowStamina(instance);
PatchBowStamina(instance);
PatchKnifeWrench(instance);
PatchHoneyFood(instance);
PatchSpellslingerArmor(instance);
PatchArmoryModArmor(instance);
PatchThrowAxes(instance);
PatchFood(instance);
PatchShield(instance);
_logger.LogInfo((object)"[AllInOneMod] Items patched in OnItemsRegistered!");
}
private static void PatchCart()
{
string text = "Cart";
GameObject val = null;
PieceTable[] array = Resources.FindObjectsOfTypeAll<PieceTable>();
for (int i = 0; i < array.Length; i++)
{
foreach (GameObject piece in array[i].m_pieces)
{
if (!((Object)(object)piece == (Object)null) && !(((Object)piece).name != text))
{
val = piece;
break;
}
}
if ((Object)(object)val != (Object)null)
{
break;
}
}
if ((Object)(object)val == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found."));
return;
}
Vagon component = val.GetComponent<Vagon>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] Vagon not found on " + text + "."));
return;
}
WearNTear component2 = val.GetComponent<WearNTear>();
if ((Object)(object)component2 == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] WearNTear not found on " + text + "."));
return;
}
float itemWeightMassFactor = component.m_itemWeightMassFactor;
float health = component2.m_health;
component.m_itemWeightMassFactor *= 0.8f;
component2.m_health *= 2f;
_logger.LogInfo((object)("[AllInOneMod] " + text + " updated: " + $"ItemWeightMassFactor {itemWeightMassFactor} -> {component.m_itemWeightMassFactor}, " + $"Health {health} -> {component2.m_health}"));
}
private static void PatchLightSourceFuel()
{
string[] source = new string[12]
{
"fire_pit", "fire_pit_iron", "bonfire", "hearth", "piece_groundtorch", "piece_groundtorch_wood", "piece_groundtorch_green", "piece_groundtorch_blue", "piece_brazierfloor01", "piece_brazierfloor02",
"piece_walltorch", "piece_brazierceiling01"
};
PieceTable[] array = Resources.FindObjectsOfTypeAll<PieceTable>();
for (int i = 0; i < array.Length; i++)
{
foreach (GameObject piece in array[i].m_pieces)
{
if (!((Object)(object)piece == (Object)null) && source.Contains(((Object)piece).name))
{
Fireplace component = piece.GetComponent<Fireplace>();
if (!((Object)(object)component == (Object)null))
{
float maxFuel = component.m_maxFuel;
float secPerFuel = component.m_secPerFuel;
component.m_maxFuel = (float)Math.Ceiling(component.m_maxFuel * 1.5f / 2f) * 2f;
component.m_secPerFuel = (float)(Math.Ceiling(component.m_secPerFuel * 1.2f / 2f / 60f) * 2.0 * 60.0);
_logger.LogInfo((object)("[AllInOneMod] " + ((Object)piece).name + " updated: " + $"MaxFuel {maxFuel} -> {component.m_maxFuel}, " + $"SecPerFuel {secPerFuel} -> {component.m_secPerFuel}"));
}
}
}
}
}
private static void PatchBowStamina(ObjectDB db)
{
string[] array = new string[14]
{
"Bow", "BowFineWood", "BowHuntsman", "BowDraugrFang", "BowSpineSnap", "BowAshlands", "BowAshlandsBlood", "BowAshlandsStorm", "BowAshlandsRoot", "BowTrollBone_TW",
"BowBlackmetal_TW", "GreatbowModer_TW", "GreatbowBlackmetal_TW", "GreatbowDvergr_TW"
};
foreach (string text in array)
{
GameObject itemPrefab = db.GetItemPrefab(text);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
float drawStaminaDrain = shared.m_attack.m_drawStaminaDrain;
shared.m_attack.m_drawStaminaDrain = (float)Math.Ceiling(shared.m_attack.m_drawStaminaDrain * 1.1f);
_logger.LogInfo((object)$"[AllInOneMod] {text} updated: DrawStaminaDrain {drawStaminaDrain} -> {shared.m_attack.m_drawStaminaDrain}");
}
}
private static void PatchCrossbowStamina(ObjectDB db)
{
string[] array = new string[12]
{
"CrossbowArbalest", "CrossbowRipper", "CrossbowRipperBlood", "CrossbowRipperLightning", "CrossbowRipperNature", "CrossbowWood_TW", "CrossbowEikthyr_TW", "CrossbowBronze_TW", "CrossbowChitin_TW", "CrossbowIron_TW",
"CrossbowSilver_TW", "CrossbowBlackmetal_TW"
};
foreach (string text in array)
{
GameObject itemPrefab = db.GetItemPrefab(text);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
float reloadStaminaDrain = shared.m_attack.m_reloadStaminaDrain;
float reloadTime = shared.m_attack.m_reloadTime;
shared.m_attack.m_reloadStaminaDrain = (float)Math.Ceiling(shared.m_attack.m_reloadStaminaDrain * 1.1f);
shared.m_attack.m_reloadTime = 3f;
_logger.LogInfo((object)("[AllInOneMod] " + text + " updated: " + $"ReloadStaminaDrain {reloadStaminaDrain} -> {shared.m_attack.m_reloadStaminaDrain}, " + $"ReloadTime {reloadTime} -> {shared.m_attack.m_reloadTime}"));
}
}
private static void PatchHoneyFood(ObjectDB db)
{
string[] array = new string[23]
{
"HoneyCookedMeat", "HoneyCookedDeer", "HoneyCookedNeck", "HoneyTeriyakiSalmon", "HoneySausages", "HoneySerpentMeat", "HoneyMushroomSoup", "HoneyTeriyakiSalmonWrap", "HoneyCookedWolf", "OdinsDelight",
"HoneyYellowStewLesser", "HoneyBread", "HoneyCookedLox", "HoneyDessertPie", "HoneyCookedHare", "HoneyCookedSeeker", "HoneyMushroomStew", "HoneyYellowStew", "HoneyHarePie", "HoneyCookedVoltureMeat",
"HoneyCookedAsksvin", "SurtrsDelight", "KonungrOmelette"
};
foreach (string text in array)
{
GameObject itemPrefab = db.GetItemPrefab(text);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
float foodBurnTime = shared.m_foodBurnTime;
shared.m_foodBurnTime = Mathf.Round((Mathf.Round(shared.m_foodBurnTime / 60f) * 0.85f - 1f) / 2f + 1f) * 60f * 2f;
_logger.LogInfo((object)$"[AllInOneMod] {text} updated: BurnTime {foodBurnTime} -> {shared.m_foodBurnTime}");
}
}
private static void PatchKnifeWrench(ObjectDB db)
{
GameObject itemPrefab = db.GetItemPrefab("KnifeWrench_TW");
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)"[AllInOneMod] KnifeWrench_TW prefab not found.");
return;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)"[AllInOneMod] ItemDrop component not found on KnifeWrench_TW.");
return;
}
component.m_itemData.m_shared.m_damages.m_blunt = 24f;
component.m_itemData.m_shared.m_damages.m_pierce = 18f;
_logger.LogInfo((object)"[AllInOneMod] KnifeWrench_TW damage set: blunt = 24, pierce = 18");
}
private static void PatchSpellslingerArmor(ObjectDB db)
{
string[] array = new string[15]
{
"HelmetSpellslinger_BlackForest_TW", "ArmorSpellSlingerChest_BlackForest_TW", "ArmorSpellslingerLegs_BlackForest_TW", "HelmetSpellslinger_Swamp_TW", "ArmorSpellSlingerChest_Swamp_TW", "ArmorSpellslingerLegs_Swamp_TW", "HelmetSpellslinger_Mountain_TW", "ArmorSpellSlingerChest_Mountain_TW", "ArmorSpellslingerLegs_Mountain_TW", "HelmetSpellslinger_Plains_TW",
"ArmorSpellSlingerChest_Plains_TW", "ArmorSpellslingerLegs_Plains_TW", "HelmetSpellslinger_Mistlands_TW", "ArmorSpellSlingerChest_Mistlands_TW", "ArmorSpellslingerLegs_Mistlands_TW"
};
foreach (string text in array)
{
GameObject itemPrefab = db.GetItemPrefab(text);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
float armor = shared.m_armor;
float armorPerLevel = shared.m_armorPerLevel;
shared.m_armor += 2f;
shared.m_armorPerLevel += 1f;
_logger.LogInfo((object)("[AllInOneMod] " + text + " armor updated: " + $"m_armor {armor} -> {shared.m_armor}, " + $"m_armorPerLevel {armorPerLevel} -> {shared.m_armorPerLevel}"));
}
}
private static void PatchArmoryModArmor(ObjectDB db)
{
string[] array = new string[15]
{
"HelmetRazorback_TW", "ArmorRazorbackChest_TW", "ArmorRazorbackLegs_TW", "HelmetHunterCarapace_TW", "ArmorHunterChestCarapace_TW", "ArmorHunterLegsCarapace_TW", "HelmetRogueCarapace_TW", "ArmorRogueCarapaceChest_TW", "ArmorRogueCarapaceLegs_TW", "HelmetVigorousCarapace_TW",
"ArmorVigorousCarapaceChest_TW", "ArmorVigorousCarapaceLegs_TW", "HelmetFenrirCarapace_TW", "ArmorFenrirCarapaceChest_TW", "ArmorFenrirCarapaceLegs_TW"
};
foreach (string text in array)
{
GameObject itemPrefab = db.GetItemPrefab(text);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
float armorPerLevel = shared.m_armorPerLevel;
shared.m_armorPerLevel += 2f;
_logger.LogInfo((object)("[AllInOneMod] " + text + " armor updated: " + $"m_armorPerLevel {armorPerLevel} -> {shared.m_armorPerLevel}"));
}
}
private static void PatchThrowAxes(ObjectDB db)
{
string[] array = new string[6] { "ThrowAxeFlint_TW", "ThrowAxeBronze_TW", "ThrowAxeIron_TW", "ThrowAxeSilver_TW", "ThrowAxeBlackmetal_TW", "ThrowAxeDvergr_TW" };
foreach (string text in array)
{
GameObject itemPrefab = db.GetItemPrefab(text);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
shared.m_damages.m_slash = Mathf.Round(shared.m_damages.m_slash * 1.1f / 2f) * 2f;
shared.m_damages.m_chop = Mathf.Round(shared.m_damages.m_chop * 1.1f / 2f) * 2f;
shared.m_attack.m_attackStamina = Mathf.Round(shared.m_attack.m_attackStamina * 0.9f / 2f) * 2f;
shared.m_secondaryAttack.m_attackStamina = Mathf.Round(shared.m_secondaryAttack.m_attackStamina * 0.9f / 2f) * 2f;
_logger.LogInfo((object)("[AllInOneMod] " + text + " updated: +10% slash & chop (rounded to even), -10% stamina costs (rounded to even)"));
}
}
private static void PatchShield(ObjectDB db)
{
foreach (KeyValuePair<string, Dictionary<string, object>> item in new Dictionary<string, Dictionary<string, object>>
{
{
"ShieldSerpentscale",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.2f },
{ "m_blockPower", 66f }
}
},
{
"ShieldBlackmetalTower",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 114f }
}
},
{
"ShieldBoneTower",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 35f }
}
},
{
"ShieldFlametalTower",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 154f }
}
},
{
"ShieldIronTower",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 57f }
}
},
{
"ShieldWoodTower",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 11f }
}
},
{
"ShieldBronzeTower_TW",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 37f }
}
},
{
"ShieldChitinTower_TW",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 47f }
}
},
{
"ShieldCarapaceTower_TW",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_movementModifier", -0.25f },
{ "m_blockPower", 136f }
}
},
{
"ShieldBronzeBuckler",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_blockPower", 15f }
}
},
{
"ShieldCarapaceBuckler",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_blockPower", 71f }
}
},
{
"ShieldIronBuckler",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_blockPower", 26f }
}
},
{
"ShieldChitinBuckler_TW",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_blockPower", 20f }
}
},
{
"ShieldSilverBuckler_TW",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_blockPower", 36f }
}
},
{
"ShieldBlackmetalBuckler_TW",
new Dictionary<string, object>
{
{ "m_maxQuality", 4 },
{ "m_blockPower", 54f }
}
},
{
"ShieldBanded",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
},
{
"ShieldBlackmetal",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
},
{
"ShieldCarapace",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
},
{
"ShieldFlametal",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
},
{
"ShieldSilver",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
},
{
"ShieldWood",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
},
{
"ShieldBronzeBanded_TW",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
},
{
"ShieldChitin_TW",
new Dictionary<string, object> { { "m_maxQuality", 4 } }
}
})
{
string key = item.Key;
Dictionary<string, object> value = item.Value;
GameObject itemPrefab = db.GetItemPrefab(key);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + key + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + key + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
foreach (KeyValuePair<string, object> item2 in value)
{
string key2 = item2.Key;
object value2 = item2.Value;
FieldInfo field = ((object)shared).GetType().GetField(key2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
object value3 = field.GetValue(shared);
field.SetValue(shared, value2);
_logger.LogInfo((object)$"[AllInOneMod] {key}.{key2} updated: {value3} -> {value2}");
}
else
{
_logger.LogInfo((object)("[AllInOneMod] " + key + "." + key2 + " not found on ItemDrop.m_shared"));
}
}
}
}
private static void PatchFood(ObjectDB db)
{
foreach (KeyValuePair<string, Dictionary<string, object>> item in new Dictionary<string, Dictionary<string, object>>
{
{
"FeastAshlands",
new Dictionary<string, object>
{
{ "m_food", 85f },
{ "m_foodStamina", 85f },
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 7f }
}
},
{
"FeastMistlands",
new Dictionary<string, object>
{
{ "m_food", 75f },
{ "m_foodStamina", 75f },
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 6f }
}
},
{
"FeastPlains",
new Dictionary<string, object>
{
{ "m_food", 65f },
{ "m_foodStamina", 65f },
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 5f }
}
},
{
"FeastMountains",
new Dictionary<string, object>
{
{ "m_food", 55f },
{ "m_foodStamina", 55f },
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 4f }
}
},
{
"FeastOceans",
new Dictionary<string, object>
{
{ "m_food", 50f },
{ "m_foodStamina", 50f },
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 4f }
}
},
{
"FeastSwamps",
new Dictionary<string, object>
{
{ "m_food", 45f },
{ "m_foodStamina", 45f },
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 4f }
}
},
{
"FeastBlackforest",
new Dictionary<string, object>
{
{ "m_food", 40f },
{ "m_foodStamina", 40f },
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 4f }
}
},
{
"FeastMeadows",
new Dictionary<string, object>
{
{ "m_foodBurnTime", 2400f },
{ "m_foodRegen", 3f }
}
},
{
"QueensJam",
new Dictionary<string, object>
{
{ "m_foodBurnTime", 1500f },
{ "m_foodRegen", 1f }
}
},
{
"FishCooked",
new Dictionary<string, object>
{
{ "m_food", 50f },
{ "m_foodStamina", 12f }
}
},
{
"DeerStew",
new Dictionary<string, object>
{
{ "m_food", 43f },
{ "m_foodStamina", 18f }
}
},
{
"MinceMeatSauce",
new Dictionary<string, object>
{
{ "m_food", 42f },
{ "m_foodStamina", 15f }
}
},
{
"ShocklateSmoothie",
new Dictionary<string, object>
{
{ "m_food", 13f },
{ "m_foodStamina", 57f },
{ "m_foodBurnTime", 1020f },
{ "m_foodRegen", 0f }
}
},
{
"Sausages",
new Dictionary<string, object>
{
{ "m_food", 57f },
{ "m_foodStamina", 15f },
{ "m_foodBurnTime", 1620f }
}
},
{
"BlackSoup",
new Dictionary<string, object> { { "m_foodStamina", 23f } }
},
{
"SerpentMeatCooked",
new Dictionary<string, object> { { "m_foodStamina", 13f } }
},
{
"SerpentStew",
new Dictionary<string, object>
{
{ "m_food", 83f },
{ "m_foodStamina", 19f }
}
},
{
"OnionSoup",
new Dictionary<string, object> { { "m_foodBurnTime", 1380f } }
},
{
"Eyescream",
new Dictionary<string, object>
{
{ "m_food", 17f },
{ "m_foodStamina", 67f },
{ "m_foodBurnTime", 1380f }
}
},
{
"FishWraps",
new Dictionary<string, object> { { "m_foodBurnTime", 1620f } }
},
{
"BloodPudding",
new Dictionary<string, object> { { "m_food", 21f } }
},
{
"MeatPlatter",
new Dictionary<string, object>
{
{ "m_food", 83f },
{ "m_foodStamina", 21f }
}
},
{
"FishAndBread",
new Dictionary<string, object>
{
{ "m_food", 27f },
{ "m_foodStamina", 93f },
{ "m_foodBurnTime", 1620f }
}
},
{
"CookedFoxMeat_TW",
new Dictionary<string, object> { { "m_foodStamina", 27f } }
},
{
"MixedGrill_TW",
new Dictionary<string, object>
{
{ "m_food", 61f },
{ "m_foodStamina", 30f }
}
},
{
"CookedSharkMeat_TW",
new Dictionary<string, object>
{
{ "m_food", 34f },
{ "m_foodBurnTime", 1500f }
}
},
{
"SeekerAspic",
new Dictionary<string, object>
{
{ "m_food", 70f },
{ "m_foodStamina", 41f },
{ "m_foodEitr", 23f }
}
},
{
"MagicallyStuffedShroom",
new Dictionary<string, object>
{
{ "m_food", 45f },
{ "m_foodStamina", 27f },
{ "m_foodEitr", 56f }
}
},
{
"YggdrasilPorridge",
new Dictionary<string, object>
{
{ "m_food", 27f },
{ "m_foodStamina", 17f },
{ "m_foodEitr", 85f }
}
},
{
"BoarJerky",
new Dictionary<string, object>
{
{ "m_food", 26f },
{ "m_foodStamina", 26f },
{ "m_foodBurnTime", 1500f }
}
},
{
"WolfJerky",
new Dictionary<string, object>
{
{ "m_food", 38f },
{ "m_foodStamina", 38f },
{ "m_foodBurnTime", 1500f }
}
},
{
"FoxJerky_TW",
new Dictionary<string, object>
{
{ "m_food", 28f },
{ "m_foodStamina", 28f },
{ "m_foodBurnTime", 1500f }
}
},
{
"BearJerky_TW",
new Dictionary<string, object>
{
{ "m_food", 34f },
{ "m_foodStamina", 34f },
{ "m_foodBurnTime", 1500f }
}
},
{
"HoneyNeckJerky",
new Dictionary<string, object>
{
{ "m_food", 20f },
{ "m_foodStamina", 20f },
{ "m_foodBurnTime", 1500f }
}
},
{
"HoneyDeerJerky",
new Dictionary<string, object>
{
{ "m_food", 27f },
{ "m_foodStamina", 27f },
{ "m_foodBurnTime", 1500f }
}
},
{
"HoneyLoxJerky",
new Dictionary<string, object>
{
{ "m_food", 41f },
{ "m_foodStamina", 41f },
{ "m_foodBurnTime", 1500f }
}
},
{
"Mistharesupreme",
new Dictionary<string, object> { { "m_foodBurnTime", 1800f } }
}
})
{
string key = item.Key;
Dictionary<string, object> value = item.Value;
GameObject itemPrefab = db.GetItemPrefab(key);
if ((Object)(object)itemPrefab == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] " + key + " prefab not found."));
continue;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
_logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + key + "."));
continue;
}
SharedData shared = component.m_itemData.m_shared;
foreach (KeyValuePair<string, object> item2 in value)
{
string key2 = item2.Key;
object value2 = item2.Value;
FieldInfo field = ((object)shared).GetType().GetField(key2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
object value3 = field.GetValue(shared);
field.SetValue(shared, value2);
_logger.LogInfo((object)$"[AllInOneMod] {key}.{key2} updated: {value3} -> {value2}");
}
else
{
_logger.LogInfo((object)("[AllInOneMod] " + key + "." + key2 + " not found on ItemDrop.m_shared"));
}
}
}
}
}