-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGlobals.cs
115 lines (101 loc) · 4.42 KB
/
Globals.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using System.Collections.Generic;
using System.Diagnostics;
using SandBox.ViewModelCollection.Map;
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.Core;
using TaleWorlds.LinQuick;
using TaleWorlds.Localization;
using TaleWorlds.ObjectSystem;
// ReSharper disable InconsistentNaming
namespace BanditMilitias
{
public struct Globals
{
public static void ClearGlobals()
{
PartyImageMap = new();
ItemTypes = new();
Recruits = new();
EquipmentItems = new();
Arrows = new();
Bolts = new();
LastCalculated = 0;
PartyCacheInterval = 0;
RaidCap = 0;
foreach (var BM in Helper.GetCachedBMs(true).SelectQ(bm => bm.Party))
{
var index = MapMobilePartyTrackerVM.Trackers.FindIndexQ(t =>
t.TrackedParty == BM.MobileParty);
if (index >= 0)
MapMobilePartyTrackerVM.Trackers.RemoveAt(index);
}
HeroTemplates = new();
Mounts = new();
Saddles = new();
Hideouts = new();
AllBMs = new ModBanditMilitiaPartyComponent[] { };
}
internal static DeferringLogger Log = new();
// merge/split criteria
internal const float MergeDistance = 1.5f;
internal const float FindRadius = 20;
internal const float MinDistanceFromHideout = 8;
// holders for criteria
internal static float CalculatedMaxPartySize;
internal static float CalculatedGlobalPowerLimit;
internal static float GlobalMilitiaPower;
internal static float MilitiaPowerPercent;
internal static float MilitiaPartyAveragePower;
// dictionary maps
internal static Dictionary<MobileParty, ImageIdentifierVM> PartyImageMap = new();
internal static Dictionary<ItemObject.ItemTypeEnum, List<ItemObject>> ItemTypes = new();
internal static Dictionary<CultureObject, List<CharacterObject>> Recruits = new();
// object tracking
internal static List<Hero> Heroes = new();
// misc
internal static readonly Random Rng = new();
internal static readonly Stopwatch T = new();
internal static Settings Settings;
internal static List<EquipmentElement> EquipmentItems = new();
internal static List<ItemObject> Arrows = new();
internal static List<ItemObject> Bolts = new();
internal static List<Equipment> BanditEquipment = new();
internal static readonly List<Banner> Banners = new();
internal static double LastCalculated;
internal static double PartyCacheInterval;
internal static int RaidCap;
internal static Clan Looters;
internal static Clan Wights; // ROT
internal static List<ItemObject> Mounts;
internal static List<ItemObject> Saddles;
internal static List<Settlement> Hideouts;
internal static IEnumerable<ModBanditMilitiaPartyComponent> AllBMs;
internal static CharacterObject Giant;
internal static List<CharacterObject> BasicRanged = new();
internal static List<CharacterObject> BasicInfantry = new();
internal static List<CharacterObject> BasicCavalry = new();
// ReSharper disable once InconsistentNaming
internal static MapMobilePartyTrackerVM MapMobilePartyTrackerVM;
internal static float Variance => MBRandom.RandomFloatRanged(0.925f, 1.075f);
internal static List<CharacterObject> HeroTemplates = new();
// ArmsDealer compatibility
internal static CultureObject BlackFlag => MBObjectManager.Instance.GetObject<CultureObject>("ad_bandit_blackflag");
internal static Dictionary<TextObject, int> DifficultyXpMap = new()
{
{ new TextObject("{=BMXpOff}Off"), 0 },
{ new TextObject("{=BMXpNormal}Normal"), 300 },
{ new TextObject("{=BMXpHard}Hard"), 600 },
{ new TextObject("{=BMXpHardest}Hardest"), 900 },
};
internal static Dictionary<TextObject, int> GoldMap = new()
{
{ new TextObject("{=BMGoldLow}Low"), 250 },
{ new TextObject("{=BMGoldNormal}Normal"), 500 },
{ new TextObject("{=BMGoldRich}Rich"), 900 },
{ new TextObject("{=BMGoldRichest}Richest"), 2000 },
};
}
}