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.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.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("2.2.0.0")]
[assembly: AssemblyInformationalVersion("2.2.0+be14708c85606c6fab6ab841267cc008bdd50823")]
[assembly: AssemblyProduct("API_ExampleMod")]
[assembly: AssemblyTitle("API_ExampleMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.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", "2.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private HouseBuildingBuilder axolotlHouse;
public HookedEffectBuilder ModdingToolsBuilder;
public static string PluginDirectory;
public static Plugin Instance;
public static ManualLogSource Log;
private Harmony harmony;
public static AssetBundle AssetBundle;
private Hotkey showPopupHotkey;
private GoodsBuilder diamonds;
private GoodsBuilder lpg;
private GoodsBuilder kiwiFruit;
private GoodsBuilder burger;
private GoodsBuilder fries;
private GoodsBuilder cola;
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)32)) });
}
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)29)),
NameToAmount.op_Implicit((2, (GoodsTypes)41))
});
}
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(AssetBundle.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)63);
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)32, 10)),
NameToAmount.op_Implicit((3, (GoodsTypes)30))
});
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)32 });
val2.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[3]
{
NameToAmount.op_Implicit((2, (GoodsTypes)11)),
NameToAmount.op_Implicit((1, (GoodsTypes)16)),
NameToAmount.op_Implicit((4, (GoodsTypes)22))
});
val2.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[3]
{
NameToAmount.op_Implicit((1, (GoodsTypes)26)),
NameToAmount.op_Implicit((1, (GoodsTypes)24)),
NameToAmount.op_Implicit((2, (GoodsTypes)18))
});
val2.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[3]
{
NameToAmount.op_Implicit((5, (GoodsTypes)68)),
NameToAmount.op_Implicit((5, (GoodsTypes)69)),
NameToAmount.op_Implicit((5, (GoodsTypes)70))
});
WorkshopRecipeBuilder val3 = val.CreateRecipe(fries.Name, 10, 60, (Grade)2);
((RecipeBuilder<WorkshopRecipeModel>)(object)val3).AddTags((TagTypes[])(object)new TagTypes[1] { (TagTypes)32 });
val3.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((1, (GoodsTypes)57)) });
WorkshopRecipeBuilder val4 = val.CreateRecipe(cola.Name, 1, 30, (Grade)2);
((RecipeBuilder<WorkshopRecipeModel>)(object)val4).AddTags((TagTypes[])(object)new TagTypes[1] { (TagTypes)32 });
val4.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((1, (GoodsTypes)69)) });
val4.AddRequiredIngredients((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((1, (GoodsTypes)70)) });
}
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)48);
((EffectBuilder<GoodsRawProductionEffectModel>)(object)val).SetTradingBuyValue(300);
}
private void CreateGoodEveryYearProductionCornerstone()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Expected O, but got Unknown
HookedEffectBuilder val = new HookedEffectBuilder("API_ExampleMod", "diamondHunter", "DiamondHunter.png");
((EffectBuilder<HookedEffectModel>)(object)val).SetPositive(true);
((EffectBuilder<HookedEffectModel>)(object)val).SetRarity((EffectRarity)3);
((EffectBuilder<HookedEffectModel>)(object)val).SetObtainedAsCornerstone(100);
((EffectBuilder<HookedEffectModel>)(object)val).SetAvailableInAllBiomesAndSeasons();
((EffectBuilder<HookedEffectModel>)(object)val).SetLabel("API", (SystemLanguage)10);
((EffectBuilder<HookedEffectModel>)(object)val).SetDisplayName("Diamond Hunter", (SystemLanguage)10);
((EffectBuilder<HookedEffectModel>)(object)val).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);
val.SetDescriptionArgs(new(SourceType, TextArgType, int)[3]
{
((SourceType)0, (TextArgType)0, 0),
((SourceType)2, (TextArgType)0, 0),
((SourceType)2, (TextArgType)2, 0)
});
val.AddHook((HookLogic)(object)HookFactory.OnNewSeason((SeasonTypes)2, 1, false));
GoodsEffectBuilder val2 = new GoodsEffectBuilder("API_ExampleMod", "Diamonds");
((EffectBuilder<GoodsEffectModel>)(object)val2).SetDisplayName("Diamonds", (SystemLanguage)10);
((EffectBuilder<GoodsEffectModel>)(object)val2).SetDescription("A shiny gem that is used for crafting and trading.", (SystemLanguage)10);
val2.SetGood(1, diamonds.Name);
val.AddHookedEffect((EffectModel)(object)((EffectBuilder<GoodsEffectModel>)(object)val2).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 AssetBundle))
{
CreateBuildings();
CreateRaces();
}
CreateEmbarkRewards();
Log.LogInfo((object)"API_ExampleMod v2.2.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 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)1328, 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)64, 5);
val.SetCostRange(3, 6);
EmbarkEffectMetaRewardBuilder val2 = new EmbarkEffectMetaRewardBuilder("API_ExampleMod", "3 ale per minute Embark Reward");
val2.SetEffect((EffectTypes)990);
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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: 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)57);
val.AddCharacteristic((BuildingTagTypes)3, (VillagerPerkTypes)36);
val.AddGlobalCharacteristic(((BuildingBuilder<HouseModel>)(object)axolotlHouse).NewData.Tag, (EffectTypes)1181);
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.SetHousingNeed(val2.ID);
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)63)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((2, (GoodsTypes)64, 50)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((100, (GoodsTypes)42, 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)23, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((30, (GoodsTypes)18, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)41, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)35, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((40, (GoodsTypes)44, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)24, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)38, 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)65, 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)20, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)45, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)43, 100)) });
val.AddOfferedGoods((NameToAmount[])(object)new NameToAmount[1] { NameToAmount.op_Implicit((50, (GoodsTypes)10, 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)54, 100)) });
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "API_ExampleMod";
public const string PLUGIN_NAME = "API_ExampleMod";
public const string PLUGIN_VERSION = "2.2.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}