using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AGTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AGTweaks")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7cec53e7-0f64-4c10-b777-c75e51a2d518")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AGTweaks;
[BepInPlugin("elric.AGTweaks", "AG Tweaks", "1.0.6")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class AGTweaks : BaseUnityPlugin
{
[HarmonyPatch(typeof(EnvMan), "InitializeBiomeEnvSetup")]
private class Weather
{
private static void Postfix(BiomeEnvSetup biome)
{
foreach (EnvEntry environment in biome.m_environments)
{
if (environment.m_environment.Contains("Rain"))
{
environment.m_weight /= 2f;
}
if (environment.m_environment.Contains("Storm") & (biome.m_name != "Ocean"))
{
environment.m_weight /= 2f;
}
if (environment.m_environment == "Misty")
{
environment.m_weight /= 2f;
}
}
}
}
public const string PluginGUID = "elric.AGTweaks";
public const string PluginName = "AG Tweaks";
public const string PluginVersion = "1.0.6";
public static bool isModded = true;
public AssetBundle AGTAssets;
private static GameObject AGToken;
private static GameObject AG_Hammer;
private CustomStatusEffect HammerStam;
private CustomLocalization translate;
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("elric.AGTweaks").PatchAll();
PrefabManager.OnVanillaPrefabsAvailable += UpdateTrees;
PrefabManager.OnVanillaPrefabsAvailable += Bronze;
PrefabManager.OnVanillaPrefabsAvailable += MeatPlatter;
PrefabManager.OnVanillaPrefabsAvailable += Birds;
PrefabManager.OnVanillaPrefabsAvailable += Greydwarfs;
PrefabManager.OnVanillaPrefabsAvailable += Mistlands;
PrefabManager.OnVanillaPrefabsAvailable += PrizedHammer;
PrefabManager.OnVanillaPrefabsAvailable += EditStonecutter;
PrefabManager.OnVanillaPrefabsAvailable += MistlandsSkipPrevention;
LoadBundle();
Localization();
}
private void LoadBundle()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
try
{
AGTAssets = AssetUtils.LoadAssetBundleFromResources("agtweaks", Assembly.GetExecutingAssembly());
AGToken = AGTAssets.LoadAsset<GameObject>("st_silver");
AG_Hammer = AGTAssets.LoadAsset<GameObject>("AG_Hammer");
ItemManager.Instance.AddItem(new CustomItem(AGToken, true));
ItemManager.Instance.AddItem(new CustomItem(AG_Hammer, true));
SE_Stats val = AGTAssets.LoadAsset<SE_Stats>("AG_Hammer_Stam");
HammerStam = new CustomStatusEffect((StatusEffect)(object)val, true);
ItemManager.Instance.AddStatusEffect(HammerStam);
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while loading bundle: {arg}");
}
}
private void Localization()
{
translate = LocalizationManager.Instance.GetLocalization();
CustomLocalization obj = translate;
string text = "English";
obj.AddTranslation(ref text, new Dictionary<string, string>
{
{ "item_ag_hammer", "AG Prized Hammer" },
{ "item_ag_hammer_description", "You are awarded this hammer for build mastery!" },
{ "se_ag_hammer_stam_name", "Hammer Time!" },
{ "se_ag_hammer_stam_tooltip", "This hammer, when equipped, gives 200% stamina regen" },
{ "st_silver", "AG Silver Token" },
{ "st_silver_description", "A token awarded to players during events to unlock special items from Allegiant Games." }
});
}
private void UpdateTrees()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
TreeBase prefab = Cache.GetPrefab<TreeBase>("Birch1");
TreeBase prefab2 = Cache.GetPrefab<TreeBase>("Birch2");
TreeBase prefab3 = Cache.GetPrefab<TreeBase>("Oak1");
prefab.m_dropWhenDestroyed.m_dropChance = 0.65f;
prefab2.m_dropWhenDestroyed.m_dropChance = 0.65f;
prefab3.m_dropWhenDestroyed.m_dropChance = 0.65f;
DropData value = prefab.m_dropWhenDestroyed.m_drops[2];
value.m_weight = 1.5f;
prefab.m_dropWhenDestroyed.m_drops[2] = value;
value = prefab2.m_dropWhenDestroyed.m_drops[2];
value.m_weight = 1.5f;
prefab2.m_dropWhenDestroyed.m_drops[2] = value;
value = prefab3.m_dropWhenDestroyed.m_drops[1];
value.m_weight = 1.5f;
prefab3.m_dropWhenDestroyed.m_drops[1] = value;
DropData value2 = prefab.m_dropWhenDestroyed.m_drops[1];
value2.m_weight = 1.5f;
value2.m_stackMin = 2;
value2.m_stackMax = 4;
prefab.m_dropWhenDestroyed.m_drops[1] = value2;
value2 = prefab2.m_dropWhenDestroyed.m_drops[1];
value2.m_weight = 1.5f;
value2.m_stackMin = 2;
value2.m_stackMax = 4;
prefab2.m_dropWhenDestroyed.m_drops[1] = value2;
value2 = prefab3.m_dropWhenDestroyed.m_drops[2];
value2.m_weight = 1.5f;
value2.m_stackMin = 2;
value2.m_stackMax = 4;
prefab3.m_dropWhenDestroyed.m_drops[2] = value2;
DropData value3 = prefab3.m_dropWhenDestroyed.m_drops[0];
value3.m_weight = 0.5f;
prefab3.m_dropWhenDestroyed.m_drops[0] = value3;
DropData item = prefab.m_dropWhenDestroyed.m_drops[2];
item.m_weight = 0.3f;
item.m_stackMax = 1;
item.m_stackMin = 1;
item.m_item = Cache.GetPrefab<GameObject>("QueenBee");
prefab.m_dropWhenDestroyed.m_drops.Add(item);
item = prefab2.m_dropWhenDestroyed.m_drops[2];
item.m_weight = 0.3f;
item.m_stackMax = 1;
item.m_stackMin = 1;
item.m_item = Cache.GetPrefab<GameObject>("QueenBee");
prefab2.m_dropWhenDestroyed.m_drops.Add(item);
item = prefab3.m_dropWhenDestroyed.m_drops[2];
item.m_weight = 0.3f;
item.m_stackMax = 1;
item.m_stackMin = 1;
item.m_item = Cache.GetPrefab<GameObject>("QueenBee");
prefab3.m_dropWhenDestroyed.m_drops.Add(item);
}
private void Bronze()
{
Recipe prefab = Cache.GetPrefab<Recipe>("Recipe_Bronze5");
prefab.m_amount = 4;
prefab.m_resources[0].m_amount = 4;
prefab.m_resources[1].m_amount = 2;
Recipe prefab2 = Cache.GetPrefab<Recipe>("Recipe_Bronze");
prefab2.m_amount = 1;
prefab2.m_resources[0].m_amount = 1;
prefab2.m_resources[1].m_amount = 1;
}
private void MeatPlatter()
{
Cache.GetPrefab<Recipe>("Recipe_MeatPlatter").m_resources[2].m_resItem = Cache.GetPrefab<ItemDrop>("WolfMeat");
}
private void NewEitr()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
RecipeConfig val = new RecipeConfig();
val.CraftingStation = "piece_cauldron";
val.Item = "st_silver";
val.MinStationLevel = 5;
val.AddRequirement(new RequirementConfig("Sap", 1, 0, false));
val.AddRequirement(new RequirementConfig("Wisp", 2, 0, false));
ItemManager.Instance.AddRecipe(new CustomRecipe(val));
Cache.GetPrefab<Smelter>("eitrrefinery").m_fuelItem = Cache.GetPrefab<ItemDrop>("EnhancedSap_AGT");
}
private void PrizedHammer()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
RecipeConfig val = new RecipeConfig();
val.CraftingStation = "piece_workbench";
val.Item = "AG_Hammer";
val.MinStationLevel = 1;
val.AddRequirement(new RequirementConfig("Stone", 1, 1, false));
val.AddRequirement(new RequirementConfig("Wood", 2, 2, false));
val.AddRequirement(new RequirementConfig("st_silver", 1, 0, false));
ItemManager.Instance.AddRecipe(new CustomRecipe(val));
}
private void Birds()
{
DropOnDestroyed prefab = Cache.GetPrefab<DropOnDestroyed>("Seagal");
prefab.m_dropWhenDestroyed.m_dropMax = 2;
prefab.m_dropWhenDestroyed.m_dropMin = 1;
DropOnDestroyed prefab2 = Cache.GetPrefab<DropOnDestroyed>("Crow");
prefab2.m_dropWhenDestroyed.m_dropMax = 2;
prefab2.m_dropWhenDestroyed.m_dropMin = 1;
}
private void Greydwarfs()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
GameObject prefab = Cache.GetPrefab<GameObject>("RoundLog");
CharacterDrop prefab2 = Cache.GetPrefab<CharacterDrop>("Greydwarf_Shaman");
CharacterDrop prefab3 = Cache.GetPrefab<CharacterDrop>("Greydwarf");
CharacterDrop prefab4 = Cache.GetPrefab<CharacterDrop>("Greydwarf_Elite");
Drop val = prefab2.m_drops[4];
val.m_chance = 0.2f;
val.m_levelMultiplier = false;
prefab2.m_drops[4] = val;
Drop val2 = new Drop();
val2.m_chance = 0.2f;
val2.m_levelMultiplier = true;
val2.m_amountMin = 1;
val2.m_amountMax = 1;
val2.m_prefab = prefab;
prefab2.m_drops.Add(val2);
prefab3.m_drops.Add(val2);
prefab4.m_drops.Add(val2);
Drop val3 = prefab4.m_drops[4];
val3.m_chance = 0.2f;
val3.m_levelMultiplier = false;
prefab4.m_drops[4] = val3;
}
private void Mistlands()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
CharacterDrop prefab = Cache.GetPrefab<CharacterDrop>("Gjall");
GameObject prefab2 = Cache.GetPrefab<GameObject>("Softtissue");
Drop val = new Drop();
val.m_prefab = prefab2;
val.m_amountMax = 6;
val.m_amountMin = 2;
val.m_chance = 1f;
prefab.m_drops.Add(val);
}
private void EditStonecutter()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
Cache.GetPrefab<Piece>("piece_stonecutter").m_resources[1].m_resItem = Cache.GetPrefab<ItemDrop>("Bronze");
Cache.GetPrefab<Recipe>("Recipe_SharpeningStone").m_enabled = false;
RecipeConfig val = new RecipeConfig();
val.Name = "AlternateSharpeningStone";
val.CraftingStation = "piece_stonecutter";
val.Item = "SharpeningStone";
val.MinStationLevel = 1;
val.AddRequirement(new RequirementConfig("Stone", 5, 0, false));
val.AddRequirement(new RequirementConfig("IronNails", 2, 0, false));
ItemManager.Instance.AddRecipe(new CustomRecipe(val));
}
private void MistlandsSkipPrevention()
{
Cache.GetPrefab<Piece>("blackforge").m_craftingStation = Cache.GetPrefab<CraftingStation>("piece_artisanstation");
Cache.GetPrefab<Piece>("cauldron_ext5_mortarandpestle").m_craftingStation = Cache.GetPrefab<CraftingStation>("piece_artisanstation");
}
}