This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extensions.cs
207 lines (172 loc) · 6.43 KB
/
Extensions.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
using TaleWorlds.CampaignSystem;
namespace UnlimitLord
{
// For TaleWorlds.CampaignSystem.CharacterObject
internal static partial class Extensions
{
public static bool IsThisCharacterPlayerCharacter(this CharacterObject character)
{
return character?.IsPlayerCharacter == true;
}
public static bool IsThisCharacterPlayerCompanion(this CharacterObject character)
{
return character?.HeroObject?.IsThisHeroPlayerCompanion() == true;
}
public static bool IsThisCharacterInPlayerClan(this CharacterObject character)
{
return character?.HeroObject?.IsThisHeroInPlayerClan() == true;
}
public static bool IsThisCharacterInPlayerArmy(this CharacterObject character)
{
return character?.HeroObject?.IsThisHeroInPlayerArmy() == true;
}
public static bool IsThisCharacterInPlayerKingdom(this CharacterObject character)
{
return character?.HeroObject?.Clan?.IsThisClanInPlayerKingdom() == true;
}
}
// For TaleWorlds.CampaignSystem.Hero
internal static partial class Extensions
{
public static bool IsThisHeroPlayerHero(this Hero hero)
{
return hero?.IsHumanPlayerCharacter == true;
}
public static bool IsThisHeroPlayerCompanion(this Hero hero)
{
return hero?.IsPlayerCompanion == true;
}
public static bool IsThisHeroInPlayerClan(this Hero hero)
{
return hero?.Clan?.IsPlayerLeadingThisClan() == true;
}
public static bool IsThisHeroInPlayerArmy(this Hero hero)
{
return hero?.PartyBelongedTo?.IsThisPartyInPlayerArmy() == true;
}
public static bool IsThisHeroInPlayerKingdom(this Hero hero)
{
return hero?.Clan?.Kingdom?.IsPlayerInThisKingdom() == true;
}
}
// For TaleWorlds.CampaignSystem.PartyBase
internal static partial class Extensions
{
public static bool IsPlayerLeadingThisParty(this PartyBase partyBase)
{
return partyBase?.MobileParty?.IsPlayerLeadingThisParty() == true;
}
public static bool IsThisPartyInPlayerClan(this PartyBase partyBase)
{
return partyBase?.Owner?.IsThisHeroPlayerHero() == true;
}
public static bool IsThisPartyInPlayerArmy(this PartyBase partyBase)
{
return partyBase?.MobileParty?.IsThisPartyInPlayerArmy() == true;
}
public static bool IsThisPartyInPlayerKingdom(this PartyBase partyBase)
{
return partyBase?.Owner?.IsThisHeroInPlayerKingdom() == true;
}
public static bool IsThisPartyGarrison(this PartyBase party)
{
return party?.MobileParty?.IsThisPartyGarrison() == true;
}
public static bool IsThisPartyCaravan(this PartyBase party)
{
return party?.MobileParty?.IsThisPartyCaravan() == true;
}
public static bool IsPartyOwnedByPlayer(this PartyBase party)
{
return party?.Owner?.IsThisHeroPlayerHero() == true;
}
public static bool DoesPartyBelongToCastle(this PartyBase party)
{
return party?.MobileParty?.DoesPartyBelongToCastle() == true;
}
public static bool DoesPartyBelongToTown(this PartyBase party)
{
return party?.MobileParty?.DoesPartyBelongToTown() == true;
}
}
// For TaleWorlds.CampaignSystem.MobileParty
internal static partial class Extensions
{
public static bool IsPlayerLeadingThisParty(this MobileParty mobileParty)
{
return mobileParty?.LeaderHero?.IsThisHeroPlayerHero() == true;
}
public static bool IsThisPartyInPlayerClan(this MobileParty mobileParty)
{
return mobileParty?.LeaderHero?.IsThisHeroInPlayerClan() == true || mobileParty?.Party?.IsPartyOwnedByPlayer() == true;
}
public static bool IsThisPartyInPlayerArmy(this MobileParty mobileParty)
{
return mobileParty?.Army?.IsPlayerInThisArmy() == true;
}
public static bool IsThisPartyInPlayerKingdom(this MobileParty mobileParty)
{
return mobileParty?.Party?.IsThisPartyInPlayerKingdom() == true;
}
public static bool IsThisPartyGarrison(this MobileParty party)
{
return party?.IsGarrison == true;
}
public static bool IsThisPartyCaravan(this MobileParty party)
{
return party?.IsCaravan == true;
}
public static bool IsPartyOwnedByPlayer(this MobileParty party)
{
return party?.Party?.IsPartyOwnedByPlayer() == true;
}
public static bool DoesPartyBelongToCastle(this MobileParty party)
{
return party?.HomeSettlement?.IsCastle == true;
}
public static bool DoesPartyBelongToTown(this MobileParty party)
{
return party?.HomeSettlement?.IsTown == true;
}
}
// For TaleWorlds.CampaignSystem.Clan
internal static partial class Extensions
{
public static bool IsPlayerLeadingThisClan(this Clan clan)
{
return clan?.Leader?.IsThisHeroPlayerHero() == true;
}
public static bool IsThisClanInPlayerKingdom(this Clan clan)
{
return clan?.Kingdom?.IsPlayerInThisKingdom() == true;
}
}
// For TaleWorlds.CampaignSystem.Army
internal static partial class Extensions
{
public static bool IsPlayerInThisArmy(this Army army)
{
return army?.Parties?.Contains(MobileParty.MainParty) == true;
}
public static bool IsPlayerLeadingThisArmy(this Army army)
{
return army?.LeaderParty?.IsPlayerLeadingThisParty() == true;
}
public static bool IsThisArmyInPlayerKingdom(this Army army)
{
return army?.Kingdom?.IsPlayerInThisKingdom() == true;
}
}
// For TaleWorlds.CampaignSystem.Kingdom
internal static partial class Extensions
{
public static bool IsPlayerInThisKingdom(this Kingdom kingdom)
{
return kingdom?.Heroes?.Contains(Hero.MainHero) == true;
}
public static bool IsPlayerRulingThisKingdom(this Kingdom kingdom)
{
return kingdom?.Leader?.IsThisHeroPlayerHero() == true;
}
}
}