forked from Barhidous/CulturedStart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CulturedStartInit.cs
41 lines (31 loc) · 1.56 KB
/
CulturedStartInit.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using HarmonyLib;
using TaleWorlds.MountAndBlade;
using TaleWorlds.Localization;
using StoryMode.Behaviors.Quests.FirstPhase;
using System.Reflection;
using zCulturedStart.Patches;
namespace zCulturedStart
{
class SubModule : MBSubModuleBase
{
protected override void OnSubModuleLoad()
{
base.OnSubModuleLoad();
var BannerInvestigationQuest = typeof(BannerInvestigationQuestBehavior).Assembly.GetType("StoryMode.Behaviors.Quests.FirstPhase.BannerInvestigationQuestBehavior+BannerInvestigationQuest").GetMethod("InitializeNotablesToTalkList", BindingFlags.NonPublic | BindingFlags.Instance);
var postfix = typeof(CSTalkWithNoblePatch).GetMethod("NoblePatch", BindingFlags.NonPublic | BindingFlags.Static);
Harmony harmony = new Harmony("mod.bannerlord.CS");
if (CultureStartOptions.FreePlayLoadedOnCondition()) {
var FPStart = AccessTools.Method(AccessTools.TypeByName("FreePlay.FreePlayGameStartBehavior"), "OnCharacterCreationIsOver");
var FPPostfix = typeof(CSFreePlayPatch).GetMethod("Postfix", BindingFlags.NonPublic | BindingFlags.Static);
harmony.Patch(FPStart, null, new HarmonyMethod(FPPostfix));
}
harmony.Patch(BannerInvestigationQuest, new HarmonyMethod(postfix));
harmony.PatchAll();
}
}
}