using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using ATS_API;
using ATS_API.Ascension;
using ATS_API.Biomes;
using ATS_API.Buildings;
using ATS_API.Difficulties;
using ATS_API.Effects;
using ATS_API.Goods;
using ATS_API.Helpers;
using ATS_API.Localization;
using ATS_API.MetaRewards;
using ATS_API.NaturalResource;
using ATS_API.Needs;
using ATS_API.Races;
using ATS_API.Recipes.Builders;
using ATS_API.SaveLoading;
using BepInEx;
using BepInEx.Logging;
using Eremite.Buildings;
using Eremite.Model;
using Eremite.Model.Effects;
using Eremite.Model.Effects.Hooked;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("API_ExampleMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod used as an example of how to use all of it methods")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyInformationalVersion("3.1.0+ba3aa9422065c524a7c2c5fe480245bad020c807")]
[assembly: AssemblyProduct("API_ExampleMod")]
[assembly: AssemblyTitle("API_ExampleMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ExampleMod
{
[HarmonyPatch]
[BepInPlugin("API_ExampleMod", "API_ExampleMod", "3.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private HouseBuildingBuilder axolotlHouse;
public HookedEffectBuilder ModdingToolsBuilder;
public HookedEffectBuilder DiamondHunterBuilder;
public static string PluginDirectory;
public static Plugin Instance;
public static ManualLogSource Log;
private Harmony harmony;
public static AssetBundle ExampleModAssetBundle;
public static AssetBundle TinyHearthAssetBundle;
private Hotkey showPopupHotkey;
private GoodsBuilder diamonds;
private GoodsBuilder lpg;
private GoodsBuilder kiwiFruit;
private GoodsBuilder burger;
private GoodsBuilder fries;
private GoodsBuilder cola;
private void CreateBiomes()
{
CreateExampleBiome();
}
private void CreateExampleBiome()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Expected O, but got Unknown
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Expected O, but got Unknown
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Expected O, but got Unknown
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Expected O, but got Unknown
BiomeBuilder val = new BiomeBuilder("API_ExampleMod", "Sand Biome");
val.SetDisplayName("Dry Lands", (SystemLanguage)10);
val.SetDescription("New land the Queen has discovered and wishes to claim as part of her new kingdom. Newcomers are rare, storms are rare but harsh when hit.", (SystemLanguage)10);
val.SetTownName("Desert Town", (SystemLanguage)10);
val.SetTownDescription("The Queen's new town in the Dry Lands.", (SystemLanguage)10);
val.SetIcon("desertTownIcon.png");
val.SetSeasonDuration((SeasonTypes)4, 30);
val.SetSeasonDuration((SeasonTypes)3, 240);
val.SetSeasonDuration((SeasonTypes)2, 120);
val.SetDeclinedSeasonalRewardsReward((GoodsTypes)65, 1);
val.SetNewcomerInterval(300);
val.SetNewcomerAmountOfGoods(1, 4);
val.AddNewcomerRace((RaceTypes)1, 50f);
val.AddNewcomerRace((RaceTypes)4, 50f);
val.AddNewcomerRace((RaceTypes)2, 50f);
val.AddNewcomerRace((RaceTypes)3, 25f);
val.AddNewcomerRace((RaceTypes)5, 100f);
val.AddNewcomerRace((RaceTypes)6, 50f);
val.SetTraderForceArrivalCost(1f, 2.5f);
val.SetTraderForceArrivalReputationPrompt("Send for trader to arrive", (SystemLanguage)10);
val.SetTraderVillagerKilledByTraderText("dehydrated in the desert", (SystemLanguage)10);
val.SetWorldMapTexture("dessertWorldMapTerrain.png");
val.AddEffect(((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).EffectType);
MaskedTerrain val2 = val.CreateTerrain<MaskedTerrain>();
val2.SetWaterTexture("desertWorldWater.png");
val2.SetTerrainBaseTexture("terrainBase.png", 100, 100);
val2.SetTerrainOverlayTexture("terrainOverlay.png", 100, 100);
val2.SetTerrainCliffTexture("terrainCliff.png", 100, 100);
val2.SetTerrainOverlayTexture("terrainBlend.png", 100, 100);
val.SetSoilText((SoilGrade)1);
val.AddNaturalResource((NaturalResourceTypes)6, 0.2f, 0.3f, 0f, 10);
NaturalResourceBuilder val3 = val.NewNaturalResource("DryTree", 0.2f, 0.3f, 0f, 10);
val3.SetDisplayName("Dry Tree", (SystemLanguage)10);
val3.SetDescription("A tree that grows in the Dry Lands.", (SystemLanguage)10);
val3.SetCharges(1);
val3.SetProduction((GoodsTypes)43, 1);
val3.AddExtraProduction((GoodsTypes)23, 1, 0.25f);
val3.AddExtraProduction((GoodsTypes)5, 1, 0.01f);
NaturalResourcePrefabBuilder val4 = new NaturalResourcePrefabBuilder("API_ExampleMod", "DryTree1");
val4.SetPrefabTemplate((NaturalResourcePrefabs)15);
val4.SetTexture("DryTreeTexture1.png");
val3.AddPrefab(val4);
NaturalResourcePrefabBuilder val5 = new NaturalResourcePrefabBuilder("API_ExampleMod", "DryTree2");
val5.SetPrefabTemplate((NaturalResourcePrefabs)15);
val5.SetTexture("DryTreeTexture2.png");
val3.AddPrefab(val5);
NaturalResourcePrefabBuilder val6 = new NaturalResourcePrefabBuilder("API_ExampleMod", "DryTree3");
val6.SetPrefabTemplate((NaturalResourcePrefabs)16);
val6.SetTexture("DryTreeTexture1.png");
val3.AddPrefab(val6);
NaturalResourcePrefabBuilder val7 = new NaturalResourcePrefabBuilder("API_ExampleMod", "DryTree4");
val7.SetPrefabTemplate((NaturalResourcePrefabs)16);
val7.SetTexture("DryTreeTexture2.png");
val3.AddPrefab(val7);
}
private void CreateBuildings()
{
CreateWorkshop();
CreateSkyScraperHouse();
CreateAxolotlHouse();
}
private void CreateSkyScraperHouse()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
HouseBuildingBuilder val = new HouseBuildingBuilder("API_ExampleMod", "SkyScraper", "TestBuildingIcon.png", 9);
((BuildingBuilder<HouseModel>)(object)val).SetDefaultVisualIcon("TestBuildingDisplayIcon.png");
((BuildingBuilder<HouseModel>)(object)val).SetDisplayName("SkyScraper", (SystemLanguage)10);
((BuildingBuilder<HouseModel>)(object)val).SetDescription("A tall building to house many people that need to be close to their work. Has to be built near a Hearth. Can house 9 residents.", (SystemLanguage)10);
((BuildingBuilder<HouseModel>)(object)val).SetLabel("Housing", (SystemLanguage)10);
val.SetAllHousingRaces();
val.AddServedNeeds((NeedTypes[])(object)new NeedTypes[1] { (NeedTypes)1 });
((BuildingBuilder<HouseModel>)(object)val).AddRequiredGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((8, (GoodsTypes)33)) });
}
private void CreateAxolotlHouse()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
axolotlHouse = new HouseBuildingBuilder("API_ExampleMod", "AxolotlHouse", "TestBuildingIcon.png", 2);
((BuildingBuilder<HouseModel>)(object)axolotlHouse).SetDefaultVisualIcon("AxolotlHouseDisplayIcon.png");
((BuildingBuilder<HouseModel>)(object)axolotlHouse).SetDisplayName("Axolotl House", (SystemLanguage)10);
((BuildingBuilder<HouseModel>)(object)axolotlHouse).SetDescription("Building specifically made for Axolotls. Has to be built near a Hearth. Can house 2 residents.", (SystemLanguage)10);
((BuildingBuilder<HouseModel>)(object)axolotlHouse).SetLabel("Housing", (SystemLanguage)10);
axolotlHouse.AddServedNeeds((NeedTypes[])(object)new NeedTypes[1] { (NeedTypes)1 });
((BuildingBuilder<HouseModel>)(object)axolotlHouse).AddRequiredGoods((NameToAmount[])(object)new NameToAmount[2]
{
NameToAmount.op_Implicit((2, (GoodsTypes)30)),
NameToAmount.op_Implicit((2, (GoodsTypes)42))
});
}
private void CreateWorkshop()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
WorkshopBuildingBuilder val = new WorkshopBuildingBuilder("API_ExampleMod", "BurgerJoint", "BurgerJoint.png");
((BuildingBuilder<WorkshopModel>)(object)val).SetCustomModel(ExampleModAssetBundle.LoadAsset<GameObject>("BorgorKing"));
((BuildingBuilder<WorkshopModel>)(object)val).SetDisplayName("Borgor King", (SystemLanguage)10);
((BuildingBuilder<WorkshopModel>)(object)val).SetDescription("The best Borgors in town!", (SystemLanguage)10);
((BuildingBuilder<WorkshopModel>)(object)val).SetLabel("Fast Food", (SystemLanguage)10);
((BuildingBuilder<WorkshopModel>)(object)val).SetMoveCost(1, (GoodsTypes)64);
val.SetProfession((ProfessionTypes)19);
((BuildingBuilder<WorkshopModel>)(object)val).SetCategory((BuildingCategoriesTypes)8);
((BuildingBuilder<WorkshopModel>)(object)val).AddTags((BuildingTagTypes[])(object)new BuildingTagTypes[1] { (BuildingTagTypes)2 });
((BuildingBuilder<WorkshopModel>)(object)val).AddRequiredGoods((NameToAmount[])(object)new NameToAmount[2]
{
NameToAmount.op_Implicit((10, (GoodsTypes)33, 10)),
NameToAmount.op_Implicit((3, (GoodsTypes)31))
});
val.AddWorkPlaceWithAllRaces();
val.AddWorkPlaceWithAllRaces();
val.AddWorkPlaceWithAllRaces();
val.AddWorkPlaceWithAllRaces();
WorkshopRecipeBuilder val2 = val.CreateRecipe(burger.Name, 2, 126, (Grade)2);
((RecipeBuilder<WorkshopRecipeModel>)(object)val2).AddTags((TagTypes[])(object)new TagTypes[1] { (TagTypes)34 });
val2.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[3]
{
NameToAmount.op_Implicit((2, (GoodsTypes)12)),
NameToAmount.op_Implicit((1, (GoodsTypes)17)),
NameToAmount.op_Implicit((4, (GoodsTypes)23))
});
val2.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[3]
{
NameToAmount.op_Implicit((1, (GoodsTypes)27)),
NameToAmount.op_Implicit((1, (GoodsTypes)25)),
NameToAmount.op_Implicit((2, (GoodsTypes)19))
});
val2.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[3]
{
NameToAmount.op_Implicit((5, (GoodsTypes)70)),
NameToAmount.op_Implicit((5, (GoodsTypes)71)),
NameToAmount.op_Implicit((5, (GoodsTypes)72))
});
WorkshopRecipeBuilder val3 = val.CreateRecipe(fries.Name, 10, 60, (Grade)2);
((RecipeBuilder<WorkshopRecipeModel>)(object)val3).AddTags((TagTypes[])(object)new TagTypes[1] { (TagTypes)34 });
val3.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((1, (GoodsTypes)58)) });
WorkshopRecipeBuilder val4 = val.CreateRecipe(cola.Name, 1, 30, (Grade)2);
((RecipeBuilder<WorkshopRecipeModel>)(object)val4).AddTags((TagTypes[])(object)new TagTypes[1] { (TagTypes)34 });
val4.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((1, (GoodsTypes)71)) });
val4.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((1, (GoodsTypes)72)) });
}
private void CreateCornerstones()
{
CreateModdingToolsCornerstone();
CreateGoodsRawProductionCornerstone();
CreateGoodEveryYearProductionCornerstone();
}
private void CreateModdingToolsCornerstone()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
ModdingToolsBuilder = new HookedEffectBuilder("API_ExampleMod", "Modding Tools", "ModdingTools.png");
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetPositive(true);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetRarity((EffectRarity)3);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetObtainedAsCornerstone(100);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetAvailableInAllBiomesAndSeasons();
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetDrawLimit(1);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetLabel("API", (SystemLanguage)10);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetDisplayName("Modding Tools", (SystemLanguage)10);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetDescription("Modders have assembled new tools that bring in new talent. Every {0} new Villagers gain +{1} Global Resolve.", (SystemLanguage)10);
ModdingToolsBuilder.SetDescriptionArgs(new(SourceType, TextArgType, int)[2]
{
((SourceType)0, (TextArgType)0, 0),
((SourceType)2, (TextArgType)0, 0)
});
ModdingToolsBuilder.SetPreviewDescription("+{0} Global Resolve", (SystemLanguage)10);
ModdingToolsBuilder.SetPreviewDescriptionArgs(new(HookedStateTextSource, int)[1] { ((HookedStateTextSource)80, 0) });
ModdingToolsBuilder.AddHook((HookLogic)(object)HookFactory.AfterXNewVillagers(8, true));
ModdingToolsBuilder.AddHookedEffect((EffectModel)(object)EffectFactory.AddHookedEffect_IncreaseResolve((IEffectBuilder)(object)ModdingToolsBuilder, 1, (ResolveEffectType)3));
GlobalResolveEffectEffectModel val = (GlobalResolveEffectEffectModel)((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).EffectModel.hookedEffects[((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).EffectModel.hookedEffects.Length - 1];
EffectManager.AddPreviouslyNamedEffect("API_ExampleMod_UniteResolve_resolve_effect_model", ((Object)val.effect).name);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetDisplayName("模组工具", (SystemLanguage)40);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetDescription("模组制作者已经组装了新的工具,吸引了新的人才。每 {0} 个新村民获得 +{1} 全局决心。", (SystemLanguage)40);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetDisplayName("Outils de modding", (SystemLanguage)14);
((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).SetDescription("Les moddeurs ont assemblé de nouveaux outils qui attirent de nouveaux talents. Chaque {0} nouveaux villageois gagnent +{1} de résolution globale.", (SystemLanguage)14);
}
private void CreateGoodsRawProductionCornerstone()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
GoodsProductionEffectBuilder val = new GoodsProductionEffectBuilder("API_ExampleMod", "Omega Sewing Technique");
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetLabel("API", (SystemLanguage)10);
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetPositive(true);
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetRarity((EffectRarity)5);
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetObtainedAsCornerstone(100);
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetAvailableInAllBiomesAndSeasons();
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetDisplayName("Omega Sewing Technique", (SystemLanguage)10);
val.SetGoodsPerYield(10, (GoodsTypes)49);
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetTradingBuyValue(300);
}
private void CreateGoodEveryYearProductionCornerstone()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
DiamondHunterBuilder = new HookedEffectBuilder("API_ExampleMod", "diamondHunter", "DiamondHunter.png");
((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).SetPositive(true);
((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).SetRarity((EffectRarity)3);
((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).SetObtainedAsCornerstone(100);
((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).SetAvailableInAllBiomesAndSeasons();
((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).SetLabel("API", (SystemLanguage)10);
((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).SetDisplayName("Diamond Hunter", (SystemLanguage)10);
((EffectBuilder<HookedEffectModel>)(object)DiamondHunterBuilder).SetDescription("You hire an obsessed miner that has a serious problem for hunting for diamonds. At the beginning of every {0} season gain +{1} {2}s", (SystemLanguage)10);
DiamondHunterBuilder.SetDescriptionArgs(new(SourceType, TextArgType, int)[3]
{
((SourceType)0, (TextArgType)0, 0),
((SourceType)2, (TextArgType)0, 0),
((SourceType)2, (TextArgType)2, 0)
});
DiamondHunterBuilder.AddHook((HookLogic)(object)HookFactory.OnNewSeason((SeasonTypes)2, 1, false));
GoodsEffectBuilder val = new GoodsEffectBuilder("API_ExampleMod", "Diamonds");
((EffectBuilder<GoodsEffectModel>)(object)val).SetDisplayName("Diamonds", (SystemLanguage)10);
((EffectBuilder<GoodsEffectModel>)(object)val).SetDescription("A shiny gem that is used for crafting and trading.", (SystemLanguage)10);
val.SetGood(1, diamonds.Name);
DiamondHunterBuilder.AddHookedEffect((EffectModel)(object)((EffectBuilder<GoodsEffectModel>)(object)val).EffectModel);
}
private void Awake()
{
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
harmony = Harmony.CreateAndPatchAll(typeof(Plugin).Assembly, "API_ExampleMod");
PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
ModdedSaveManager.ListenForLoadedSaveData("API_ExampleMod", (Action<ModSaveData, SaveFileState>)PostLoadedSaveData);
CreateGoods();
CreateCornerstones();
CreateTrader();
CreateDifficulty();
if (AssetBundleHelper.TryLoadAssetBundleFromFile("ats_examplemod", ref ExampleModAssetBundle))
{
CreateBuildings();
CreateRaces();
}
CreateEmbarkRewards();
if (AssetBundleHelper.TryLoadAssetBundleFromFile("tinyhearth", ref TinyHearthAssetBundle))
{
CreateDecorations();
}
CreateBiomes();
Log.LogInfo((object)"API_ExampleMod v3.1.0 Plugin loaded");
}
private void Start()
{
LocaText header = LocalizationManager.ToLocaText("API_ExampleMod", "showExamplePopup", "Header", "Hello!", (SystemLanguage)10);
LocaText description = LocalizationManager.ToLocaText("API_ExampleMod", "showExamplePopup", "Description", "This is an example popup", (SystemLanguage)10);
LocaText disableHotkey = LocalizationManager.ToLocaText("API_ExampleMod", "showExamplePopup", "DisableButton", "Disable Hotkey", (SystemLanguage)10);
showPopupHotkey = Hotkeys.New("API_ExampleMod", "showExamplePopup", "Show Popup", new List<KeyCode>(1) { (KeyCode)266 }, (Action)delegate
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
Log.LogInfo((object)"Showing popup");
GenericPopupTask.Show("API_ExampleMod", header, description, Array.Empty<object>()).WaitForDecision((ButtonInfo[])(object)new ButtonInfo[2]
{
new ButtonInfo
{
Key = LocalizationManager.ToLocaText(Keys.Continue_Key),
Type = (ButtonTypes)0,
OnPressed = delegate
{
Log.LogInfo((object)"Okay button pressed");
}
},
new ButtonInfo
{
Key = disableHotkey,
Type = (ButtonTypes)1,
OnPressed = delegate
{
Instance.showPopupHotkey.action.Disable();
}
}
});
}, (Action)null);
}
private void PostLoadedSaveData(ModSaveData saveData, SaveFileState saveState)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
if ((int)saveState == 0)
{
Log.LogInfo((object)"New save file created for API_ExampleMod");
saveData.General.SetValue("TotalLoads", (object)0);
}
else
{
int num = saveData.General.GetValueAsObject<int>("TotalLoads", 0) + 1;
saveData.General.SetValue("TotalLoads", (object)num);
Log.LogInfo((object)string.Format("Loaded save file for {0} {1} times", "API_ExampleMod", num));
}
}
private void CreateDecorations()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
DecorationBuildingBuilder val = new DecorationBuildingBuilder("API_ExampleMod", "TinyHearth", "TinyHearth.png", (DecorationTierTypes)1);
((BuildingBuilder<DecorationModel>)(object)val).SetDefaultVisualIcon("TinyHearthDisplay.png");
((BuildingBuilder<DecorationModel>)(object)val).SetDisplayName("Tiny Hearth", (SystemLanguage)10);
((BuildingBuilder<DecorationModel>)(object)val).SetLabel("Decorations", (SystemLanguage)10);
((BuildingBuilder<DecorationModel>)(object)val).AddRequiredGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((9, (GoodsTypes)33)) });
val.SetDecorationScore(4);
((BuildingBuilder<DecorationModel>)(object)val).SetCustomModel(TinyHearthAssetBundle.LoadAsset<GameObject>("TinyHearth"));
DecorationBuildingBuilder val2 = new DecorationBuildingBuilder("API_ExampleMod", "HumanMaleDead", "HumanMaleDead.png", (DecorationTierTypes)3);
((BuildingBuilder<DecorationModel>)(object)val2).SetDefaultVisualIcon("HumanMaleDeadDisplay.png");
((BuildingBuilder<DecorationModel>)(object)val2).SetDisplayName("Dead Human Male", (SystemLanguage)10);
((BuildingBuilder<DecorationModel>)(object)val2).SetLabel("Decorations", (SystemLanguage)10);
((BuildingBuilder<DecorationModel>)(object)val2).AddRequiredGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((5, (GoodsTypes)24)) });
val2.SetDecorationScore(1);
((BuildingBuilder<DecorationModel>)(object)val2).SetFootPrint(1, 1, (FieldType)50);
((BuildingBuilder<DecorationModel>)(object)val2).SetCustomModel(TinyHearthAssetBundle.LoadAsset<GameObject>("HumanMaleDead"));
}
private void CreateDifficulty()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
DifficultyBuilder val = new DifficultyBuilder("API_ExampleMod", "Faster Corruption");
val.SetPrestigeLevel(21, true);
val.CopyModifiersFromPreviousDifficulties(true);
NewAscensionModifierModel val2 = val.AddModifier((EffectTypes)1475, true, false, true);
val2.SetShortDescription("Corruption in the Ancient Hearth grows 50% quicker.", (SystemLanguage)10);
}
private void CreateEmbarkRewards()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
EmbarkGoodMetaRewardBuilder val = new EmbarkGoodMetaRewardBuilder("API_ExampleMod", "Ancient Tablet Embark Reward");
val.SetGood((GoodsTypes)65, 5);
val.SetCostRange(3, 6);
EmbarkEffectMetaRewardBuilder val2 = new EmbarkEffectMetaRewardBuilder("API_ExampleMod", "3 ale per minute Embark Reward");
val2.SetEffect((EffectTypes)1112);
val2.SetCostRange(3, 5);
EmbarkGoodMetaRewardBuilder val3 = new EmbarkGoodMetaRewardBuilder("API_ExampleMod", "LPG Embark Reward");
val3.SetGood(lpg.NewGood.id, 20);
val3.SetCostRange(4, 5);
EmbarkEffectMetaRewardBuilder val4 = new EmbarkEffectMetaRewardBuilder("API_ExampleMod", "Modding Tools Embark Reward");
val4.SetEffect(((EffectBuilder<HookedEffectModel>)(object)ModdingToolsBuilder).EffectType);
val4.SetCostRange(6, 9);
}
private void CreateGoods()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Expected O, but got Unknown
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Expected O, but got Unknown
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Expected O, but got Unknown
diamonds = new GoodsBuilder("API_ExampleMod", "Diamonds", "Diamonds.png");
diamonds.SetDisplayName("Diamonds", (SystemLanguage)10);
diamonds.SetDisplayName("钻石", (SystemLanguage)6);
diamonds.SetDescription("Shiny and worth a lot of money. but not strong enough to be used as Armor.", (SystemLanguage)10);
diamonds.SetDescription("闪闪发亮,值很多钱。但强度不足以用作盔甲.", (SystemLanguage)6);
diamonds.SetCategory("Trade Goods");
diamonds.SetTraderSellValue(40f);
diamonds.CanBeSoldToPlayer(3, 35f, 100);
diamonds.CanBeSoldToAllTraders();
diamonds.AddRelicKeepRewardChance(10, 4);
diamonds.AddRelicKeepRewardChance(5, 2);
lpg = new GoodsBuilder("API_ExampleMod", "LPG", "LPG.png");
lpg.SetDisplayName("LPG", (SystemLanguage)10);
lpg.SetDisplayName("液化石油ガス", (SystemLanguage)22);
lpg.SetDescription("A clean and efficient fuel.", (SystemLanguage)10);
lpg.SetDescription("クリーンで効率的な燃料。", (SystemLanguage)22);
lpg.SetCategory("Fuel");
lpg.SetTraderSellValue(17f);
lpg.CanBeSoldToPlayer(10, 29f, 100);
lpg.CanBeSoldToAllTraders();
lpg.SetFuel(200f);
kiwiFruit = new GoodsBuilder("API_ExampleMod", "Kiwi Fruit", "KiwiFruit.png");
kiwiFruit.SetDisplayName("Kiwi Fruit", (SystemLanguage)10);
kiwiFruit.SetDisplayName("Киви", (SystemLanguage)30);
kiwiFruit.SetDescription("Sour and sweet fruit that's great for a snack. Eat with a spoon.", (SystemLanguage)10);
kiwiFruit.SetDescription("Кислые и сладкие фрукты, которые отлично подходят для перекуса. Ешьте ложкой.", (SystemLanguage)10);
kiwiFruit.SetCategory("Food");
kiwiFruit.SetTraderSellValue(2.5f);
kiwiFruit.CanBeSoldToPlayer(30, 5f, 100);
kiwiFruit.CanBeSoldToAllTraders();
kiwiFruit.AddRelicKeepRewardChance(10, 4);
kiwiFruit.AddRelicKeepRewardChance(5, 2);
kiwiFruit.SetEatable(1f);
burger = new GoodsBuilder("API_ExampleMod", "Borgor", "Burger.png");
burger.SetDisplayName("Borgor", (SystemLanguage)10);
burger.SetDescription("Juicy and delicious.", (SystemLanguage)10);
burger.SetCategory("Food");
burger.SetTraderSellValue(2.5f);
burger.CanBeSoldToPlayer(30, 5f, 100);
burger.CanBeSoldToAllTraders();
burger.SetEatable(3f);
fries = new GoodsBuilder("API_ExampleMod", "Fries", "Fries.png");
fries.SetDisplayName("Fries", (SystemLanguage)10);
fries.SetDescription("Hot and Crispy.", (SystemLanguage)10);
fries.SetCategory("Food");
fries.SetTraderSellValue(0.5f);
fries.CanBeSoldToPlayer(100, 1f, 100);
fries.CanBeSoldToAllTraders();
fries.SetEatable(1f);
cola = new GoodsBuilder("API_ExampleMod", "Cola", "Cola.png");
cola.SetDisplayName("Cola", (SystemLanguage)10);
cola.SetDescription("Refreshing and bubbly.", (SystemLanguage)10);
cola.SetCategory("Food");
cola.SetTraderSellValue(0.5f);
cola.CanBeSoldToPlayer(100, 1f, 100);
cola.CanBeSoldToAllTraders();
cola.SetEatable(2f);
}
private void CreateRaces()
{
CreateAxolotl();
}
private void CreateAxolotl()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
RaceBuilder val = new RaceBuilder("API_ExampleMod", "Axolotl");
val.SetDisplayName("Axolotl", (SystemLanguage)10);
val.SetPluralDisplayName("Axolotls", (SystemLanguage)10);
val.SetDescription("Axolotls are a type of salamander that fully metamorphosed into land-dwelling creatures.", (SystemLanguage)10);
val.SetIcon("Axolotl.png");
val.SetRoundIcon("AxolotlRound.png");
val.SetWideIcon("AxolotlWide.png");
val.AddCharacteristic((BuildingTagTypes)14, (VillagerPerkTypes)61);
val.AddCharacteristic((BuildingTagTypes)3, (VillagerPerkTypes)36);
val.AddGlobalCharacteristic(((BuildingBuilder<HouseModel>)(object)axolotlHouse).NewData.Tag, (EffectTypes)1304);
CustomRaceNeed val2 = RaceNeedFactory.HousingNeed("API_ExampleMod", val.NewRaceData.ID, ((BuildingBuilder<HouseModel>)(object)axolotlHouse).NewData.ID, "Axolotl Housing", "The axolotl is lentic, meaning it inhabits still-water lakes. Axolotl Houses are required to fulfill this need.", ((BuildingBuilder<HouseModel>)(object)axolotlHouse).Model.icon, 3, (SystemLanguage)10);
val.AddNeed((NeedTypes)1);
val.AddNeed(val2.ID);
val.AddNeed((NeedTypes)3);
CustomRaceNeed val3 = RaceNeedFactory.ComplexFoodNeed("API_ExampleMod", burger.NewGood.id, 7);
val.AddNeed(val3.ID);
axolotlHouse.AddHousingRace(val.NewRaceData.ID);
axolotlHouse.AddServedNeed(val2.ID);
}
private void CreateTrader()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
TraderBuilder val = new TraderBuilder("API_ExampleMod", "Wild Bill", "TraderIcon.png", "TraderIconSmall.png");
val.SetDisplayName("Wild Bill", (SystemLanguage)10);
val.SetDescription("He sells common western goods, and a small number of basic blueprints and perks. Trade carefully!", (SystemLanguage)10);
val.SetDialogue("Howdy, partner! I'm Wild Bill, the best trader in the west. I've got everything you need, and more!", (SystemLanguage)10);
val.SetAssaultData(3, 5, 0.5f, 0.4f, true);
val.SetAmountOfGoods(15, 20);
val.AddDefaultMerchandise();
val.AddDefaultDesiredGoods();
val.AddGuaranteedOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((40, (GoodsTypes)64)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((2, (GoodsTypes)65, 50)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((100, (GoodsTypes)43, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((5, diamonds.Name, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((20, lpg.Name, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, kiwiFruit.Name, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((40, (GoodsTypes)24, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((30, (GoodsTypes)19, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)42, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)36, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((40, (GoodsTypes)45, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)25, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)39, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)8, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)5, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)67, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)69, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)21, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)46, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)44, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)11, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)47, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)55, 100)) });
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "API_ExampleMod";
public const string PLUGIN_NAME = "API_ExampleMod";
public const string PLUGIN_VERSION = "3.1.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}