Skip to content

Commit 05641e3

Browse files
committed
fixed format
1 parent c9f1902 commit 05641e3

4 files changed

Lines changed: 34 additions & 31 deletions

File tree

HarmonyDetours.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ static void Postfix(Verse.ResearchProjectDef __instance, ref float __result, Tec
6969
int num = __instance.techLevel - researcherTechLevel;
7070
__result = 1f + num * 0.5f;
7171

72-
if (TechAdvancing_Config_Tab.configCheckboxDisableCostMultiplicatorCap == 0)
72+
if (TechAdvancing_Config_Tab.ConfigCheckboxDisableCostMultiplicatorCap == 0)
7373
{
7474
__result = Mathf.Min(__result, 2);
7575
}
7676

77-
if (TechAdvancing_Config_Tab.configCheckboxMakeHigherResearchesSuperExpensive == 1)
77+
if (TechAdvancing_Config_Tab.ConfigCheckboxMakeHigherResearchesSuperExpensive == 1)
7878
{
79-
__result *= (float)(TechAdvancing_Config_Tab.configCheckboxMakeHigherResearchesSuperExpensiveFac * Math.Pow(2, num));
79+
__result *= (float)(TechAdvancing_Config_Tab.ConfigCheckboxMakeHigherResearchesSuperExpensiveFac * Math.Pow(2, num));
8080
}
8181
}
8282

@@ -93,6 +93,7 @@ static void Postfix(Verse.ResearchProjectDef __instance, ref float __result, Tec
9393
class TA_OnKill_Event
9494
{
9595
[SuppressMessage("Codequality", "IDE0051:Remove unused private member", Justification = "Referenced at runtime by harmony")]
96+
[SuppressMessage("Style", "IDE0060:Remove unused parameters", Justification = "Referenced at runtime by harmony")]
9697
static void Postfix(Pawn __instance, DamageInfo? dinfo, Hediff exactCulprit = null)
9798
{
9899
TechAdvancing.Event.OnKill(__instance);
@@ -108,6 +109,7 @@ static void Postfix(Pawn __instance, DamageInfo? dinfo, Hediff exactCulprit = nu
108109
class TA_OnNewPawn_Event
109110
{
110111
[SuppressMessage("Codequality", "IDE0051:Remove unused private member", Justification = "Referenced at runtime by harmony")]
112+
[SuppressMessage("Style", "IDE0060:Remove unused parameters", Justification = "Referenced at runtime by harmony")]
111113
static void Prefix(Pawn __instance, Faction newFaction, Pawn recruiter = null)
112114
{
113115
TechAdvancing.Event.OnNewPawn(__instance);
@@ -123,6 +125,7 @@ static void Prefix(Pawn __instance, Faction newFaction, Pawn recruiter = null)
123125
class TA_PostOnNewPawn_Event
124126
{
125127
[SuppressMessage("Codequality", "IDE0051:Remove unused private member", Justification = "Referenced at runtime by harmony")]
128+
[SuppressMessage("Style", "IDE0060:Remove unused parameters", Justification = "Referenced at runtime by harmony")]
126129
static void Postfix(Faction newFaction, Pawn recruiter = null)
127130
{
128131
TechAdvancing.Event.PostOnNewPawn();
@@ -259,9 +262,9 @@ player researched more than 50% of the techlevel Y then the techlevel rises to Y
259262
{
260263
TechAdvancing_Config_Tab.ExposeData(TA_Expose_Mode.Load);
261264

262-
if (TechAdvancing_Config_Tab.baseTechlvlCfg != 1)
265+
if (TechAdvancing_Config_Tab.BaseTechlvlCfg != 1)
263266
{
264-
TechAdvancing_Config_Tab.baseFactionTechLevel = (TechAdvancing_Config_Tab.baseTechlvlCfg == 0) ? TechLevel.Neolithic : TechLevel.Industrial;
267+
TechAdvancing_Config_Tab.baseFactionTechLevel = (TechAdvancing_Config_Tab.BaseTechlvlCfg == 0) ? TechLevel.Neolithic : TechLevel.Industrial;
265268
}
266269
}
267270

@@ -286,7 +289,7 @@ internal static void RecalculateTechlevel(bool showIncreaseMsg = true)
286289

287290
GetAndReloadTL();
288291
TechLevel baseNewTL = Rules.GetNewTechLevel();
289-
if (TechAdvancing_Config_Tab.configCheckboxNeedTechColonists == 1 && !Util.ColonyHasHiTechPeople())
292+
if (TechAdvancing_Config_Tab.ConfigCheckboxNeedTechColonists == 1 && !Util.ColonyHasHiTechPeople())
290293
{
291294
Faction.OfPlayer.def.techLevel = (TechLevel)Util.Clamp((int)TechLevel.Undefined, (int)baseNewTL, (int)TechAdvancing_Config_Tab.maxTechLevelForTribals);
292295
}

Main.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static class Event
3535
{
3636
TechAdvancing.MapCompSaveHandler.ColonyPeople.Remove(oldPawn);
3737
if (TechAdvancing.MapCompSaveHandler.ColonyPeople.Count == 0 && // that means there was something in there before -> now the techlvl is locked
38-
TechAdvancing_Config_Tab.configCheckboxNeedTechColonists == 1 // and the limit is enabled
38+
TechAdvancing_Config_Tab.ConfigCheckboxNeedTechColonists == 1 // and the limit is enabled
3939
)
4040
{
4141
Find.LetterStack.ReceiveLetter("newTechLevelMedievalCapRemLetterTitleRev".Translate(), "newTechLevelMedievalCapRemLetterContentsRev".Translate(), LetterDefOf.NegativeEvent);
@@ -52,7 +52,7 @@ public static class Event
5252
{
5353
TechAdvancing.MapCompSaveHandler.ColonyPeople.Add(oldPawn, oldPawn.Faction);
5454
if (TechAdvancing.MapCompSaveHandler.ColonyPeople.Count == 1 && // that means there was nothing in there before -> now the techlvl is unlocked
55-
TechAdvancing_Config_Tab.configCheckboxNeedTechColonists == 1 // and the limit is enabled
55+
TechAdvancing_Config_Tab.ConfigCheckboxNeedTechColonists == 1 // and the limit is enabled
5656
)
5757
{
5858
Find.LetterStack.ReceiveLetter("newTechLevelMedievalCapRemLetterTitle".Translate(), "newTechLevelMedievalCapRemLetterContents".Translate(TA_ResearchManager.isTribe ? "configTribe".Translate() : "configColony".Translate()), LetterDefOf.PositiveEvent);
0 Bytes
Binary file not shown.

TechAdvancing_Config_Tab.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,30 @@ public class TechAdvancing_Config_Tab : Window
3939
// private static float _margin = 6f;
4040

4141
[ConfigTabValueSaved("baseTechlvlCfg")]
42-
public static int baseTechlvlCfg { get; set; } = 1; //0=neolithic ; 1= auto ; 2=colony
42+
public static int BaseTechlvlCfg { get; set; } = 1; //0=neolithic ; 1= auto ; 2=colony
4343
public static TechLevel baseFactionTechLevel = TechLevel.Undefined;
4444
public const TechLevel maxTechLevelForTribals = TechLevel.Medieval;
4545

4646
[ConfigTabValueSaved("configCheckboxNeedTechColonists")]
47-
public static int configCheckboxNeedTechColonists { get => b_configCheckboxNeedTechColonists ? 1 : 0; set => b_configCheckboxNeedTechColonists = value == 1; }
47+
public static int ConfigCheckboxNeedTechColonists { get => b_configCheckboxNeedTechColonists ? 1 : 0; set => b_configCheckboxNeedTechColonists = value == 1; }
4848
public static bool b_configCheckboxNeedTechColonists = false; //bool for selecting if we need colonists instead of tribals if we want to advance past medival tech
4949

5050
[ConfigTabValueSaved("configCheckboxDisableCostMultiplicatorCap")]
51-
public static int configCheckboxDisableCostMultiplicatorCap { get => b_configCheckboxDisableCostMultiplicatorCap ? 1 : 0; set => b_configCheckboxDisableCostMultiplicatorCap = value == 1; }
51+
public static int ConfigCheckboxDisableCostMultiplicatorCap { get => b_configCheckboxDisableCostMultiplicatorCap ? 1 : 0; set => b_configCheckboxDisableCostMultiplicatorCap = value == 1; }
5252
public static bool b_configCheckboxDisableCostMultiplicatorCap = false;
5353

5454
[ConfigTabValueSaved("configCheckboxMakeHigherResearchesSuperExpensive")]
55-
public static int configCheckboxMakeHigherResearchesSuperExpensive { get => b_configCheckboxMakeHigherResearchesSuperExpensive ? 1 : 0; set => b_configCheckboxMakeHigherResearchesSuperExpensive = value == 1; }
55+
public static int ConfigCheckboxMakeHigherResearchesSuperExpensive { get => b_configCheckboxMakeHigherResearchesSuperExpensive ? 1 : 0; set => b_configCheckboxMakeHigherResearchesSuperExpensive = value == 1; }
5656
public static bool b_configCheckboxMakeHigherResearchesSuperExpensive = false;
5757

5858
[ConfigTabValueSaved("configCheckboxMakeHigherResearchesSuperExpensiveFac")]
59-
public static int configCheckboxMakeHigherResearchesSuperExpensiveFac { get; set; } = 10;
59+
public static int ConfigCheckboxMakeHigherResearchesSuperExpensiveFac { get; set; } = 10;
6060

6161
[ConfigTabValueSaved("configChangeResearchCostFac")]
62-
public static int configChangeResearchCostFac { get; set; } = 100; // 100 equals to a factor of x1
62+
public static int ConfigChangeResearchCostFac { get; set; } = 100; // 100 equals to a factor of x1
6363
public static float ConfigChangeResearchCostFacAsFloat()
6464
{
65-
var scaled = configChangeResearchCostFac * 0.01f;
65+
var scaled = ConfigChangeResearchCostFac * 0.01f;
6666

6767
if (scaled < 1) // e.g. 0.99
6868
{
@@ -139,26 +139,26 @@ public override void DoWindowContents(Rect canvas)
139139
{
140140
DrawText(canvas, this.description, ref drawpos);
141141
AddSpace(ref drawpos, 5f);
142-
if (Widgets.RadioButtonLabeled(new Rect(canvas.x + 20, drawpos, 100f, 60f), "configRadioBtnNeolithic".Translate(), baseTechlvlCfg == 0)) //translation default: Neolithic / Tribal
142+
if (Widgets.RadioButtonLabeled(new Rect(canvas.x + 20, drawpos, 100f, 60f), "configRadioBtnNeolithic".Translate(), BaseTechlvlCfg == 0)) //translation default: Neolithic / Tribal
143143
{
144-
baseTechlvlCfg = 0;
144+
BaseTechlvlCfg = 0;
145145
}
146-
if (Widgets.RadioButtonLabeled(new Rect(canvas.x + 200f, drawpos, 100f, 60f), "configRadioBtnAutoDetect".Translate(), baseTechlvlCfg == 1)) //translation default: Auto-Detect (default)
146+
if (Widgets.RadioButtonLabeled(new Rect(canvas.x + 200f, drawpos, 100f, 60f), "configRadioBtnAutoDetect".Translate(), BaseTechlvlCfg == 1)) //translation default: Auto-Detect (default)
147147
{
148-
baseTechlvlCfg = 1;
148+
BaseTechlvlCfg = 1;
149149
}
150150

151-
if (Widgets.RadioButtonLabeled(new Rect(canvas.x + 400f, drawpos, 100f, 60f), "configRadioBtnIndustrial".Translate(), baseTechlvlCfg == 2)) //translation default: Industrial / Colony
151+
if (Widgets.RadioButtonLabeled(new Rect(canvas.x + 400f, drawpos, 100f, 60f), "configRadioBtnIndustrial".Translate(), BaseTechlvlCfg == 2)) //translation default: Industrial / Colony
152152
{
153-
baseTechlvlCfg = 2;
153+
BaseTechlvlCfg = 2;
154154
}
155155
AddSpace(ref drawpos, 70f);
156-
DrawText(canvas, "configBaseTechLvl".Translate() + " (" + ((baseTechlvlCfg == 1) ? ((TA_ResearchManager.isTribe) ? "configTribe".Translate() : "configColony".Translate()) : ((baseTechlvlCfg == 0) ? "configSetToTribe".Translate() : "configSetToColony".Translate())) + "): " + ((baseTechlvlCfg == 1) ? TA_ResearchManager.factionDefault.ToString().TranslateOrDefault(null, "TA_TL_") : ((baseTechlvlCfg == 0) ? "configNeolithic".Translate() : "configIndustrial".Translate())), ref drawpos);
156+
DrawText(canvas, "configBaseTechLvl".Translate() + " (" + ((BaseTechlvlCfg == 1) ? ((TA_ResearchManager.isTribe) ? "configTribe".Translate() : "configColony".Translate()) : ((BaseTechlvlCfg == 0) ? "configSetToTribe".Translate() : "configSetToColony".Translate())) + "): " + ((BaseTechlvlCfg == 1) ? TA_ResearchManager.factionDefault.ToString().TranslateOrDefault(null, "TA_TL_") : ((BaseTechlvlCfg == 0) ? "configNeolithic".Translate() : "configIndustrial".Translate())), ref drawpos);
157157
AddSpace(ref drawpos, 20f);
158158
baseFactionTechLevel = TA_ResearchManager.factionDefault;
159-
if (baseTechlvlCfg != 1)
159+
if (BaseTechlvlCfg != 1)
160160
{
161-
baseFactionTechLevel = (baseTechlvlCfg == 0) ? TechLevel.Neolithic : TechLevel.Industrial;
161+
baseFactionTechLevel = (BaseTechlvlCfg == 0) ? TechLevel.Neolithic : TechLevel.Industrial;
162162
}
163163
DrawText(canvas, this.descriptionA2 + " (" + "configWordDefault".Translate() + conditionvalue_A_Default + ")", ref drawpos);
164164
string bufferA = null;
@@ -188,10 +188,10 @@ public override void DoWindowContents(Rect canvas)
188188
// previewTechLevels[2] = (Util.ColonyHasHiTechPeople()) ? TechLevel.Archotech : TechAdvancing_Config_Tab.maxTechLevelForTribals;
189189
//}
190190

191-
b_configCheckboxNeedTechColonists = configCheckboxNeedTechColonists == 1;
191+
b_configCheckboxNeedTechColonists = ConfigCheckboxNeedTechColonists == 1;
192192

193193
Widgets.CheckboxLabeled(new Rect(canvas.x, drawpos, Verse.Text.CalcSize("configCheckboxNeedTechColonists".Translate(maxTechLevelForTribals.ToString().TranslateOrDefault(null, "TA_TL_"))).x + 40f, 40f), "configCheckboxNeedTechColonists".Translate(maxTechLevelForTribals.ToString().TranslateOrDefault(null, "TA_TL_")), ref b_configCheckboxNeedTechColonists, false);
194-
configCheckboxNeedTechColonists = (b_configCheckboxNeedTechColonists) ? 1 : 0;
194+
ConfigCheckboxNeedTechColonists = (b_configCheckboxNeedTechColonists) ? 1 : 0;
195195
AddSpace(ref drawpos, 32f);
196196

197197
if (this.previewTechLevels[2] == maxTechLevelForTribals && b_configCheckboxNeedTechColonists)
@@ -208,10 +208,10 @@ public override void DoWindowContents(Rect canvas)
208208

209209
case 1:
210210
{
211-
b_configCheckboxDisableCostMultiplicatorCap = configCheckboxDisableCostMultiplicatorCap == 1;
211+
b_configCheckboxDisableCostMultiplicatorCap = ConfigCheckboxDisableCostMultiplicatorCap == 1;
212212

213213
Widgets.CheckboxLabeled(new Rect(canvas.x, drawpos, Verse.Text.CalcSize("configCheckboxDisableCostMultiplicatorCap".Translate()).x + 40f, 40f), "configCheckboxDisableCostMultiplicatorCap".Translate() + "\n", ref b_configCheckboxDisableCostMultiplicatorCap, false);
214-
configCheckboxDisableCostMultiplicatorCap = (b_configCheckboxDisableCostMultiplicatorCap) ? 1 : 0;
214+
ConfigCheckboxDisableCostMultiplicatorCap = (b_configCheckboxDisableCostMultiplicatorCap) ? 1 : 0;
215215

216216
AddSpace(ref drawpos, 40f);
217217

@@ -223,8 +223,8 @@ public override void DoWindowContents(Rect canvas)
223223
int slider1ToCfg(float x) => x < 10 ? (int)x : (int)(x * x / 10);
224224
float cfgToSlider1(float x) => x < 10 ? x : (float)Math.Sqrt(10 * x);
225225

226-
configCheckboxMakeHigherResearchesSuperExpensiveFac = slider1ToCfg(Widgets.HorizontalSlider(new Rect(canvas.x, drawpos, this.windowRect.width - 40f, 40f), cfgToSlider1(configCheckboxMakeHigherResearchesSuperExpensiveFac), 1, 100f,
227-
label: "configCheckboxMakeHigherResearchesSuperExpensiveFac".Translate(configCheckboxMakeHigherResearchesSuperExpensiveFac), roundTo: 1f));
226+
ConfigCheckboxMakeHigherResearchesSuperExpensiveFac = slider1ToCfg(Widgets.HorizontalSlider(new Rect(canvas.x, drawpos, this.windowRect.width - 40f, 40f), cfgToSlider1(ConfigCheckboxMakeHigherResearchesSuperExpensiveFac), 1, 100f,
227+
label: "configCheckboxMakeHigherResearchesSuperExpensiveFac".Translate(ConfigCheckboxMakeHigherResearchesSuperExpensiveFac), roundTo: 1f));
228228
}
229229

230230
AddSpace(ref drawpos, 40f);
@@ -243,7 +243,7 @@ public override void DoWindowContents(Rect canvas)
243243
s = val.ToString();
244244
}
245245

246-
configChangeResearchCostFac = slider2ToCfg(Widgets.HorizontalSlider(new Rect(canvas.x, drawpos, this.windowRect.width - 40f, 40f), cfgToSlider2(configChangeResearchCostFac), 2, 1000f,
246+
ConfigChangeResearchCostFac = slider2ToCfg(Widgets.HorizontalSlider(new Rect(canvas.x, drawpos, this.windowRect.width - 40f, 40f), cfgToSlider2(ConfigChangeResearchCostFac), 2, 1000f,
247247
label: "configChangeResearchCostFac".Translate(s), roundTo: 1f));
248248
}
249249
break;

0 commit comments

Comments
 (0)