using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace ClanCheats;
public enum Lang
{
EN,
VI
}
[BepInPlugin("com.lousan114.clan_cheats", "Clan Cheats", "0.2.0")]
public class ClanCheatsPlugin : BaseUnityPlugin
{
public const string GUID = "com.lousan114.clan_cheats";
public const string NAME = "Clan Cheats";
public const string VERSION = "0.2.0";
internal static ClanCheatsPlugin Instance;
internal static ManualLogSource Log;
internal static ConfigEntry<bool> ModEnabled;
internal static ConfigEntry<KeyCode> MenuKey;
internal static ConfigEntry<Lang> Language;
internal static ConfigEntry<string> FontName;
internal static ConfigEntry<float> UiScale;
internal static ConfigEntry<float> MenuWidth;
internal static ConfigEntry<float> MenuHeight;
internal static ConfigEntry<bool> NoCoinLoss;
internal static ConfigEntry<bool> MaxNpcRelation;
internal static ConfigEntry<bool> MaxClanRelation;
internal static ConfigEntry<bool> MaxOwnMood;
internal static ConfigEntry<bool> RelationOnlyWhenFriendly;
internal static ConfigEntry<bool> MaxRebelRelation;
internal static ConfigEntry<bool> RebelRecruitAlwaysSucceeds;
internal static ConfigEntry<bool> AllCourtRequestsSucceed;
internal static ConfigEntry<int> StatTarget;
internal static ConfigEntry<int> ExtraTarget;
internal static ConfigEntry<bool> SetAge;
internal static ConfigEntry<int> AgeTarget;
internal static ConfigEntry<bool> StaminaToAgeMax;
internal static ConfigEntry<bool> IncludeSpouses;
internal static ConfigEntry<bool> SiBingNoHappinessLoss;
internal static ConfigEntry<bool> SiBingAddPopulation;
internal static ConfigEntry<int> SiBingPopGain;
internal static ConfigEntry<bool> SiBingNoCap;
internal static ConfigEntry<bool> CityNoDiscontent;
internal static ConfigEntry<bool> CityAddPopulation;
internal static ConfigEntry<int> CityPopGain;
internal static ConfigEntry<bool> CityNoCap;
internal static ConfigEntry<bool> ReportButton;
internal static ConfigEntry<KeyCode> ReportKey;
internal static ConfigEntry<bool> ReportAuto;
internal static ConfigEntry<bool> ReportAutoClose;
internal static ConfigEntry<bool> RunAllMinistries;
internal static ConfigEntry<int> CampSoldiers;
internal static ConfigEntry<int> CampPowerTarget;
internal static ConfigEntry<int> CampLoyalty;
internal static ConfigEntry<bool> DispatchButton;
internal static ConfigEntry<KeyCode> DispatchKey;
internal static ConfigEntry<bool> DispatchAuto;
internal static int SiBingDepth;
internal static int ZhaoJunDepth;
private bool _showMenu;
private Rect _win = new Rect(50f, 40f, 1000f, 760f);
private Rect _reportWin = new Rect(20f, 20f, 300f, 74f);
private Vector2 _scroll;
private int _tab;
private string _toast = "";
private float _toastUntil;
private GUIStyle _headStyle;
private GUIStyle _toastStyle;
private static Font _font;
private static bool _fontTried;
private static bool _accents;
private const char Probe = 'ế';
private const string Accented = "àáảãạăằắẳẵặâầấẩẫậÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬèéẻẽẹêềếểễệÈÉẺẼẸÊỀẾỂỄỆìíỉĩịÌÍỈĨỊòóỏõọôồốổỗộơờớởỡợÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢùúủũụưừứửữựÙÚỦŨỤƯỪỨỬỮỰỳýỷỹỵỲÝỶỸỴđĐ";
private const string Plain = "aaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAeeeeeeeeeeeEEEEEEEEEEEiiiiiIIIIIoooooooooooooooooOOOOOOOOOOOOOOOOOuuuuuuuuuuuUUUUUUUUUUUyyyyyYYYYYdD";
internal const int RegencyNone = 6;
private static readonly int[] KingCols = new int[12]
{
2, 3, 4, 5, 6, 7, 16, 18, 19, 21,
23, 28
};
private static readonly int[] QuCols = new int[12]
{
2, 3, 4, 5, 6, 7, 10, 15, 16, 17,
20, 25
};
private const int cInfo = 0;
private const int cAge = 1;
private const int cWen = 2;
private const int cWu = 3;
private const int cShang = 4;
private const int cYi = 5;
private const int cRen = 6;
private const int cMeiLi = 7;
private const int cBody = 8;
private const int cJiMou = 9;
private const int cSkill = 10;
private const int cReg = 11;
internal const int cSoldiers = 2;
internal const int cBasePower = 3;
internal const int cLoyalty = 4;
internal const int cWeaponA = 5;
internal const int cWeaponB = 6;
internal const int cCampName = 7;
private readonly Dictionary<int, int> _pendingPick = new Dictionary<int, int>();
private bool _sizeLoaded;
private bool _resizing;
private Rect _dispatchWin = new Rect(20f, 120f, 300f, 96f);
private int _ministry;
private Vector2 _royalScroll;
private Vector2 _campScroll;
internal static bool VI
{
get
{
if (Language != null)
{
return Language.Value == Lang.VI;
}
return false;
}
}
internal static string RelMax => "100";
private void Awake()
{
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected O, but got Unknown
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Expected O, but got Unknown
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Expected O, but got Unknown
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Expected O, but got Unknown
//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_03bf: Expected O, but got Unknown
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Expected O, but got Unknown
//IL_0524: Unknown result type (might be due to invalid IL or missing references)
//IL_052e: Expected O, but got Unknown
//IL_055a: Unknown result type (might be due to invalid IL or missing references)
//IL_0564: Expected O, but got Unknown
//IL_058d: Unknown result type (might be due to invalid IL or missing references)
//IL_0597: Expected O, but got Unknown
//IL_0625: Unknown result type (might be due to invalid IL or missing references)
//IL_062b: Expected O, but got Unknown
//IL_074d: Unknown result type (might be due to invalid IL or missing references)
//IL_0752: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "Enabled", true, "Master switch. When false the mod changes nothing at all.");
MenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("1. General", "MenuKey", (KeyCode)289, "Key that opens the Clan Cheats menu.");
Language = ((BaseUnityPlugin)this).Config.Bind<Lang>("1. General", "Language", Lang.VI, "Menu language / Ngon ngu giao dien: EN = English, VI = Tieng Viet.");
FontName = ((BaseUnityPlugin)this).Config.Bind<string>("1. General", "FontName", "", "Font used by the mod's menu. Leave empty to pick one automatically that can draw Vietnamese accents (the game's own font first, then an OS font). Put a name here - for example 'Segoe UI', 'Arial', 'Tahoma' - to force one. If no font on the machine can draw accents, the menu falls back to unaccented text instead of showing empty boxes.");
UiScale = ((BaseUnityPlugin)this).Config.Bind<float>("1. General", "UiScale", 1.3f, new ConfigDescription("Widens every column, label and button in the menu by this factor. The layout was measured for the game's narrow built-in font; a font that can draw Vietnamese accents is wider, so 1.3 keeps text from being cut off. Lower it if the menu feels too wide.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 2.5f), Array.Empty<object>()));
MenuWidth = ((BaseUnityPlugin)this).Config.Bind<float>("1. General", "MenuWidth", 1000f, new ConfigDescription("Menu window width in pixels. You can also drag the grip in the bottom-right corner; the size is saved here.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(520f, 3000f), Array.Empty<object>()));
MenuHeight = ((BaseUnityPlugin)this).Config.Bind<float>("1. General", "MenuHeight", 760f, new ConfigDescription("Menu window height in pixels. Drag the bottom-right grip to change it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(360f, 2000f), Array.Empty<object>()));
NoCoinLoss = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Money", "NoCoinLoss", true, "Coins never go down. Every negative change the game makes (buying, paying wages, gifts, bribes, building) is skipped; income still works.");
MaxNpcRelation = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Relations", "MaxNpcRelation", true, "Any interaction that changes your standing with a person of another clan or of the palace sets that person's relation to the maximum (100) instead.");
MaxClanRelation = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Relations", "MaxClanRelation", true, "The same interaction also sets the whole CLAN's relation with your house to the maximum (100).");
MaxOwnMood = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Relations", "MaxOwnMood", true, "Interacting with one of your own clan members sets their mood to the maximum (100).");
RelationOnlyWhenFriendly = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Relations", "RelationOnlyWhenFriendly", true, "Only max out the relation when the action was a friendly one (the game's own change was zero or positive). Turn this off to max it even after hostile actions.");
MaxRebelRelation = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Relations", "MaxRebelRelation", true, "Funding a rebel king sets every rebel king's relation with your house to the maximum (100).");
RebelRecruitAlwaysSucceeds = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Relations", "RebelRecruitAlwaysSucceeds", true, "The court request that installs a royal as a rebel king (and the matching request that removes one) always succeeds.");
AllCourtRequestsSucceed = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Relations", "AllCourtRequestsSucceed", false, "Stronger: EVERY request you make through a palace consort always succeeds, not just the rebel one.");
StatTarget = ((BaseUnityPlugin)this).Config.Bind<int>("4. Stats", "StatTarget", 100, new ConfigDescription("Value written to the capped stats: Writing, Might, Business, Arts, Cunning, Charisma, Renown, Health, Mood. The game clamps these to 100 whenever it changes them, so 100 is the value that sticks. Higher numbers display but are pulled back to 100 the first time the game touches that stat.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 9999), Array.Empty<object>()));
ExtraTarget = ((BaseUnityPlugin)this).Config.Bind<int>("4. Stats", "ExtraTarget", 999, new ConfigDescription("Value written to the uncapped stats: skill level, talent value and luck. 999 is safe here.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 9999), Array.Empty<object>()));
SetAge = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Stats", "SetAge", false, "Also set the age when you press a max button. Off by default, because changing an age reshuffles who is an adult, who can marry and who is near death.");
AgeTarget = ((BaseUnityPlugin)this).Config.Bind<int>("4. Stats", "AgeTarget", 18, new ConfigDescription("Age written when SetAge is on.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), Array.Empty<object>()));
StaminaToAgeMax = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Stats", "StaminaToAgeMax", true, "Stamina has an age-based ceiling in this game (GetTiliMax). ON fills stamina to that ceiling, which the game keeps. OFF writes StatTarget raw, which looks bigger but is recalculated away.");
IncludeSpouses = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Stats", "IncludeSpouses", true, "Include the spouses married into your house (the Qu list) in the clan max buttons.");
SiBingNoHappinessLoss = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Army", "SiBingNoHappinessLoss", true, "Recruiting private soldiers in a fief no longer lowers the happiness of its villages and towns. Disbanding still gives happiness back.");
SiBingAddPopulation = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Army", "SiBingAddPopulation", true, "Recruiting private soldiers ADDS population instead of taking it away.");
SiBingPopGain = ((BaseUnityPlugin)this).Config.Bind<int>("5. Army", "SiBingPopGain", 1, new ConfigDescription("People added per soldier recruited into a private army.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
SiBingNoCap = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Army", "SiBingNoCap", false, "Lift the fief's recruiting cap (normally a third of the happiness-weighted population, minus the soldiers you already have).");
CityNoDiscontent = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Army", "CityNoDiscontent", true, "Recruiting an army in a city or province you govern no longer raises discontent.");
CityAddPopulation = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Army", "CityAddPopulation", true, "Recruiting an army in a city or province ADDS population instead of taking it away.");
CityPopGain = ((BaseUnityPlugin)this).Config.Bind<int>("5. Army", "CityPopGain", 1, new ConfigDescription("People added per soldier recruited in a city or province.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
CityNoCap = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Army", "CityNoCap", false, "Lift the city/province recruiting cap (normally a twentieth of the population, scaled down by discontent).");
ReportButton = ((BaseUnityPlugin)this).Config.Bind<bool>("6. Battle reports", "ReportButton", true, "While the front-line battle report is open, show a small button that presses 'Ignore' on every entry that still has one. Entries that need a real decision (withdraw troops, and anything whose Ignore button the game hides) are left for you.");
ReportKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("6. Battle reports", "ReportKey", (KeyCode)290, "Key that does the same thing without the button.");
ReportAuto = ((BaseUnityPlugin)this).Config.Bind<bool>("6. Battle reports", "ReportAuto", false, "Do it automatically the moment the battle report opens, without pressing anything.");
ReportAutoClose = ((BaseUnityPlugin)this).Config.Bind<bool>("6. Battle reports", "ReportAutoClose", false, "When nothing is left to decide, close the battle report as well.");
CampSoldiers = ((BaseUnityPlugin)this).Config.Bind<int>("8. Private army", "CampSoldiers", 9999, new ConfigDescription("Soldiers written into a camp by the Private-army tab's max button.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 999999), Array.Empty<object>()));
CampPowerTarget = ((BaseUnityPlugin)this).Config.Bind<int>("8. Private army", "CampPowerTarget", 100, new ConfigDescription("Base combat power written into a camp. The two weapon grades are set to 100 each, and the game adds 0.3 of each on top, so the fighting power ends up at this plus 60.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 999), Array.Empty<object>()));
CampLoyalty = ((BaseUnityPlugin)this).Config.Bind<int>("8. Private army", "CampLoyalty", 100, new ConfigDescription("Loyalty written into a camp. It multiplies the whole army: the game uses 0.7 + loyalty/100, so 100 means x1.7 and 0 means x0.7.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
DispatchButton = ((BaseUnityPlugin)this).Config.Bind<bool>("8. Private army", "DispatchButton", true, "While the \"send private soldiers\" panel is open, show a small button that sends every camp's whole garrison at once, instead of clicking + in steps of four.");
DispatchKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("8. Private army", "DispatchKey", (KeyCode)291, "Key that does the same thing without the button.");
DispatchAuto = ((BaseUnityPlugin)this).Config.Bind<bool>("8. Private army", "DispatchAuto", false, "Do it automatically the moment that panel opens.");
RunAllMinistries = ((BaseUnityPlugin)this).Config.Bind<bool>("7. Regency", "RunAllMinistries", false, "A regent normally administers one ministry. With this on, every tick the game runs their ministry, the mod runs the other five for them as well - through the game's own regency routine, so each ministry behaves exactly as it would if that were the one they had chosen.");
Harmony val = new Harmony("com.lousan114.clan_cheats");
int num = 0;
int num2 = 0;
Type[] array = new Type[10]
{
typeof(Patch_ChangeCoins),
typeof(Patch_RelaxChangeShiJia),
typeof(Patch_FundRebel),
typeof(Patch_QuAskKing),
typeof(Patch_ZhaoSiBing),
typeof(Patch_ReduceXingFu),
typeof(Patch_ZhaoJun),
typeof(Patch_MinYuanJunAdd),
typeof(Patch_ReportOpened),
typeof(Patch_SheZheng)
};
foreach (Type type in array)
{
num2++;
try
{
val.PatchAll(type);
num++;
}
catch (Exception ex)
{
Log.LogError((object)("Patch " + type.Name + " failed - the game version may have changed: " + ex.Message));
}
}
Log.LogInfo((object)("Clan Cheats 0.2.0 loaded, " + num + "/" + num2 + " patch sets applied. Press " + ((object)MenuKey.Value/*cast due to .constrained prefix*/).ToString() + " in game."));
}
private void Update()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(MenuKey.Value))
{
_showMenu = !_showMenu;
}
if (!ModEnabled.Value)
{
return;
}
BattleReports.Tick();
Dispatch.Tick();
if (Input.GetKeyDown(DispatchKey.Value))
{
int num = Dispatch.SendAll();
if (num > 0)
{
Toast(T("Sent everything from " + num + " camps.", "Đã điều động toàn bộ từ " + num + " quân doanh."));
}
}
if (DispatchAuto.Value && Dispatch.JustOpened())
{
Dispatch.SendAll();
}
if (Input.GetKeyDown(ReportKey.Value))
{
int num2 = BattleReports.SkipAll();
if (num2 > 0)
{
Toast(T("Ignored " + num2 + " battle reports.", "Đã bỏ qua " + num2 + " chiến báo."));
}
}
if (ReportAuto.Value && BattleReports.JustOpened())
{
BattleReports.SkipAll();
}
}
internal static string T(string en, string vi)
{
if (!VI)
{
return en;
}
return Fit(vi);
}
private static bool CanDrawVietnamese(Font f)
{
try
{
return (Object)(object)f != (Object)null && f.HasCharacter('ế');
}
catch
{
return false;
}
}
internal static Font MenuFont()
{
if (_fontTried)
{
return _font;
}
_fontTried = true;
string text = ((FontName == null) ? "" : (FontName.Value ?? "").Trim());
if (text.Length > 0)
{
try
{
Font val = Font.CreateDynamicFontFromOSFont(text, 14);
if (CanDrawVietnamese(val))
{
_font = val;
_accents = true;
}
else
{
Log.LogWarning((object)("FontName '" + text + "' cannot draw Vietnamese accents - falling back."));
}
}
catch (Exception ex)
{
Log.LogWarning((object)("FontName '" + text + "': " + ex.Message));
}
}
if ((Object)(object)_font == (Object)null)
{
try
{
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
foreach (Font val2 in array)
{
if (CanDrawVietnamese(val2))
{
_font = val2;
_accents = true;
break;
}
}
}
catch (Exception ex2)
{
Log.LogWarning((object)("Scanning the game's fonts: " + ex2.Message));
}
}
if ((Object)(object)_font == (Object)null)
{
string[] array2 = new string[6] { "Segoe UI", "Arial", "Tahoma", "Verdana", "Microsoft Sans Serif", "Times New Roman" };
foreach (string text2 in array2)
{
try
{
Font val3 = Font.CreateDynamicFontFromOSFont(text2, 14);
if (CanDrawVietnamese(val3))
{
_font = val3;
_accents = true;
break;
}
}
catch
{
}
}
}
if ((Object)(object)_font == (Object)null)
{
Log.LogWarning((object)"No font on this machine could draw Vietnamese accents - the menu will use unaccented text.");
}
else
{
Log.LogInfo((object)("Menu font: " + ((Object)_font).name + (_font.dynamic ? " (dynamic)" : " (atlas)")));
}
return _font;
}
private static string Fit(string s)
{
if (_accents || string.IsNullOrEmpty(s))
{
return s;
}
StringBuilder stringBuilder = new StringBuilder(s.Length);
foreach (char c in s)
{
int num = "àáảãạăằắẳẵặâầấẩẫậÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬèéẻẽẹêềếểễệÈÉẺẼẸÊỀẾỂỄỆìíỉĩịÌÍỈĨỊòóỏõọôồốổỗộơờớởỡợÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢùúủũụưừứửữựÙÚỦŨỤƯỪỨỬỮỰỳýỷỹỵỲÝỶỸỴđĐ".IndexOf(c);
stringBuilder.Append((num >= 0) ? "aaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAeeeeeeeeeeeEEEEEEEEEEEiiiiiIIIIIoooooooooooooooooOOOOOOOOOOOOOOOOOuuuuuuuuuuuUUUUUUUUUUUyyyyyYYYYYdD"[num] : c);
}
return stringBuilder.ToString();
}
internal static float W(float px)
{
return px * ((UiScale != null) ? UiScale.Value : 1f);
}
internal static string F(List<string> row, int i)
{
if (row == null || i < 0 || i >= row.Count)
{
return "";
}
return row[i] ?? "";
}
internal static bool SetF(List<string> row, int i, string v)
{
if (row == null || i < 0 || i >= row.Count)
{
return false;
}
row[i] = v;
return true;
}
internal static int PI(string s, int def)
{
if (int.TryParse(s, out var result))
{
return result;
}
if (float.TryParse(s, out var result2))
{
return Mathf.RoundToInt(result2);
}
return def;
}
internal static float PF(string s, float def)
{
if (!float.TryParse(s, out var result))
{
return def;
}
return result;
}
internal static string NameOf(List<string> row, int infoIdx)
{
string text = F(row, infoIdx);
if (string.IsNullOrEmpty(text))
{
return "?";
}
int num = text.IndexOf('|');
if (num <= 0)
{
return text;
}
return text.Substring(0, num);
}
internal static void SetInfoToken(List<string> row, int infoIdx, int token, string value)
{
string text = F(row, infoIdx);
if (!string.IsNullOrEmpty(text))
{
string[] array = text.Split(new char[1] { '|' });
if (token >= 0 && token < array.Length)
{
array[token] = value;
SetF(row, infoIdx, string.Join("|", array));
}
}
}
internal static int PipeField(string s, int idx, int def)
{
if (string.IsNullOrEmpty(s))
{
return def;
}
string[] array = s.Split(new char[1] { '|' });
if (idx < 0 || idx >= array.Length)
{
return def;
}
return PI(array[idx], def);
}
internal static bool InGame()
{
try
{
return Mainload.Member_now != null && Mainload.Member_now.Count > 0;
}
catch
{
return false;
}
}
internal static int StaminaFor(int age)
{
if (!StaminaToAgeMax.Value)
{
return StatTarget.Value;
}
try
{
return FormulaData.GetTiliMax(age);
}
catch
{
return Mathf.Max(2, Mathf.Min(30, age));
}
}
internal static void MaxClanMember(int i)
{
List<List<string>> member_now = Mainload.Member_now;
if (member_now != null && i >= 0 && i < member_now.Count)
{
List<string> row = member_now[i];
string v = StatTarget.Value.ToString();
string text = ExtraTarget.Value.ToString();
if (SetAge.Value)
{
SetF(row, 6, AgeTarget.Value.ToString());
}
int age = PI(F(row, 6), 18);
SetF(row, 7, v);
SetF(row, 8, v);
SetF(row, 9, v);
SetF(row, 10, v);
SetF(row, 11, v);
SetF(row, 16, v);
SetF(row, 20, v);
SetF(row, 21, v);
SetF(row, 27, v);
SetF(row, 30, StaminaFor(age).ToString());
SetF(row, 33, text);
SetInfoToken(row, 4, 3, text);
SetInfoToken(row, 4, 7, text);
}
}
internal static void MaxSpouse(int i)
{
List<List<string>> member_qu = Mainload.Member_qu;
if (member_qu != null && i >= 0 && i < member_qu.Count)
{
List<string> row = member_qu[i];
string v = StatTarget.Value.ToString();
string text = ExtraTarget.Value.ToString();
if (SetAge.Value)
{
SetF(row, 5, AgeTarget.Value.ToString());
}
int age = PI(F(row, 5), 18);
SetF(row, 6, v);
SetF(row, 7, v);
SetF(row, 8, v);
SetF(row, 9, v);
SetF(row, 10, v);
SetF(row, 12, v);
SetF(row, 15, v);
SetF(row, 16, v);
SetF(row, 19, v);
SetF(row, 20, StaminaFor(age).ToString());
SetF(row, 23, text);
SetInfoToken(row, 2, 3, text);
SetInfoToken(row, 2, 7, text);
}
}
internal static void MaxRetainer(int i)
{
List<List<string>> menKe_Now = Mainload.MenKe_Now;
if (menKe_Now != null && i >= 0 && i < menKe_Now.Count)
{
List<string> row = menKe_Now[i];
string v = StatTarget.Value.ToString();
string text = ExtraTarget.Value.ToString();
if (SetAge.Value)
{
SetF(row, 3, AgeTarget.Value.ToString());
}
int age = PI(F(row, 3), 18);
SetF(row, 4, v);
SetF(row, 5, v);
SetF(row, 6, v);
SetF(row, 7, v);
SetF(row, 8, v);
SetF(row, 11, v);
SetF(row, 13, v);
SetF(row, 14, v);
SetF(row, 15, v);
SetF(row, 16, text);
SetF(row, 19, StaminaFor(age).ToString());
SetInfoToken(row, 2, 3, text);
SetInfoToken(row, 2, 7, text);
}
}
internal static int MaxAllClan()
{
int num = 0;
List<List<string>> member_now = Mainload.Member_now;
if (member_now != null)
{
for (int i = 0; i < member_now.Count; i++)
{
MaxClanMember(i);
num++;
}
}
if (IncludeSpouses.Value)
{
List<List<string>> member_qu = Mainload.Member_qu;
if (member_qu != null)
{
for (int j = 0; j < member_qu.Count; j++)
{
MaxSpouse(j);
num++;
}
}
}
return num;
}
internal static int MaxAllRetainers()
{
int num = 0;
List<List<string>> menKe_Now = Mainload.MenKe_Now;
if (menKe_Now != null)
{
for (int i = 0; i < menKe_Now.Count; i++)
{
MaxRetainer(i);
num++;
}
}
return num;
}
internal static int MaxAllClanRelations()
{
int num = 0;
List<List<string>> shiJia_Now = Mainload.ShiJia_Now;
if (shiJia_Now != null)
{
for (int i = 0; i < shiJia_Now.Count; i++)
{
if (SetF(shiJia_Now[i], 3, RelMax))
{
num++;
}
}
}
List<List<List<string>>> member_other = Mainload.Member_other;
if (member_other != null)
{
for (int j = 0; j < member_other.Count; j++)
{
List<List<string>> list = member_other[j];
if (list != null)
{
for (int k = 0; k < list.Count; k++)
{
SetF(list[k], 15, RelMax);
}
}
}
}
List<List<List<string>>> member_Other_qu = Mainload.Member_Other_qu;
if (member_Other_qu != null)
{
for (int l = 0; l < member_Other_qu.Count; l++)
{
List<List<string>> list2 = member_Other_qu[l];
if (list2 != null)
{
for (int m = 0; m < list2.Count; m++)
{
SetF(list2[m], 12, RelMax);
}
}
}
}
return num;
}
internal static int MaxAllRebelRelations()
{
int num = 0;
List<List<string>> member_King = Mainload.Member_King;
if (member_King == null)
{
return 0;
}
for (int i = 0; i < member_King.Count; i++)
{
string text = F(member_King[i], 10);
if (text != null && text.StartsWith("4|") && SetF(member_King[i], 14, RelMax))
{
num++;
}
}
return num;
}
internal static int MaxOwnClanMood()
{
int num = 0;
List<List<string>> member_now = Mainload.Member_now;
if (member_now == null)
{
return 0;
}
for (int i = 0; i < member_now.Count; i++)
{
if (SetF(member_now[i], 11, RelMax))
{
num++;
}
}
return num;
}
internal static int[] RoyalCols(int memberClass)
{
if (memberClass != 0)
{
return QuCols;
}
return KingCols;
}
internal static List<List<string>> RoyalList(int memberClass)
{
if (memberClass != 0)
{
return Mainload.Member_King_qu;
}
return Mainload.Member_King;
}
internal static string MinistryName(int id)
{
try
{
List<List<string>> sheZheng_king = AllText.SheZheng_king;
if (sheZheng_king == null || id < 0 || id >= sheZheng_king.Count)
{
return id.ToString();
}
List<string> list = sheZheng_king[id];
if (list == null || list.Count == 0)
{
return id.ToString();
}
int num = 0;
List<int> setData = Mainload.SetData;
if (setData != null && setData.Count > 4)
{
num = setData[4];
}
if (num < 0 || num >= list.Count)
{
num = 0;
}
return list[num];
}
catch
{
return id.ToString();
}
}
internal static int RegencyOf(int memberClass, int index)
{
List<List<string>> list = RoyalList(memberClass);
if (list == null || index < 0 || index >= list.Count)
{
return 6;
}
return PI(F(list[index], RoyalCols(memberClass)[11]), 6);
}
internal static bool SetRegency(int memberClass, int index, int id)
{
List<List<string>> list = RoyalList(memberClass);
if (list == null || index < 0 || index >= list.Count)
{
return false;
}
if (id < 0 || id > 6)
{
return false;
}
return SetF(list[index], RoyalCols(memberClass)[11], id.ToString());
}
internal static void MaxRoyal(int memberClass, int index)
{
List<List<string>> list = RoyalList(memberClass);
if (list != null && index >= 0 && index < list.Count)
{
List<string> row = list[index];
int[] array = RoyalCols(memberClass);
string v = StatTarget.Value.ToString();
string text = ExtraTarget.Value.ToString();
SetF(row, array[2], v);
SetF(row, array[3], v);
SetF(row, array[4], v);
SetF(row, array[5], v);
SetF(row, array[6], v);
SetF(row, array[7], v);
SetF(row, array[8], v);
SetF(row, array[9], v);
SetF(row, array[10], text);
SetInfoToken(row, array[0], 3, text);
SetInfoToken(row, array[0], 7, text);
}
}
internal static int MaxAllRoyals()
{
int num = 0;
for (int i = 0; i <= 1; i++)
{
List<List<string>> list = RoyalList(i);
if (list != null)
{
for (int j = 0; j < list.Count; j++)
{
MaxRoyal(i, j);
num++;
}
}
}
return num;
}
internal static List<string> Camp(int fief, int terrain)
{
List<List<List<string>>> junYing_now = Mainload.JunYing_now;
if (junYing_now == null || fief < 0 || fief >= junYing_now.Count || junYing_now[fief] == null)
{
return null;
}
if (terrain < 0 || terrain >= junYing_now[fief].Count)
{
return null;
}
return junYing_now[fief][terrain];
}
internal static List<int[]> Camps()
{
List<int[]> list = new List<int[]>();
List<List<List<string>>> junYing_now = Mainload.JunYing_now;
if (junYing_now == null)
{
return list;
}
for (int i = 0; i < junYing_now.Count; i++)
{
if (junYing_now[i] != null)
{
for (int j = 0; j < junYing_now[i].Count; j++)
{
list.Add(new int[2] { i, j });
}
}
}
return list;
}
internal static float CampPower(List<string> camp)
{
if (camp == null)
{
return 0f;
}
float num = PF(F(camp, 3), 0f);
float num2 = PF(F(camp, 5), 0f);
float num3 = PF(F(camp, 6), 0f);
try
{
return FormulaData.ZhanLi_SiBing(num, num2, num3);
}
catch
{
return num + Mathf.Min(num2, 100f) * 0.3f + Mathf.Min(num3, 100f) * 0.3f;
}
}
internal static float CampStrength(List<string> camp)
{
if (camp == null)
{
return 0f;
}
float num = PF(F(camp, 2), 0f);
float num2 = PF(F(camp, 4), 0f);
return num * CampPower(camp) * (0.7f + num2 * 0.01f);
}
internal static float PerSoldier(List<string> camp)
{
if (camp == null)
{
return 0f;
}
return CampPower(camp) * (0.7f + PF(F(camp, 4), 0f) * 0.01f);
}
internal static float TotalArmyStrength()
{
float num = 0f;
foreach (int[] item in Camps())
{
num += CampStrength(Camp(item[0], item[1]));
}
return num;
}
internal static float BestPerSoldier()
{
float num = 0f;
foreach (int[] item in Camps())
{
float num2 = PerSoldier(Camp(item[0], item[1]));
if (num2 > num)
{
num = num2;
}
}
return num;
}
internal static void MaxCamp(int fief, int terrain)
{
List<string> list = Camp(fief, terrain);
if (list == null)
{
return;
}
SetF(list, 2, CampSoldiers.Value.ToString());
SetF(list, 3, CampPowerTarget.Value.ToString());
SetF(list, 4, CampLoyalty.Value.ToString());
SetF(list, 5, "100");
SetF(list, 6, "100");
try
{
Mainload.isFengdiDataChange = true;
}
catch
{
}
}
internal static int MaxAllCamps()
{
int num = 0;
foreach (int[] item in Camps())
{
MaxCamp(item[0], item[1]);
num++;
}
return num;
}
internal static float ClanStrength(int clan, out int soldiers, out int power)
{
soldiers = 0;
power = 0;
List<List<string>> shiJia_Now = Mainload.ShiJia_Now;
if (shiJia_Now == null || clan < 0 || clan >= shiJia_Now.Count)
{
return 0f;
}
string s = F(shiJia_Now[clan], 11);
soldiers = PipeField(s, 0, 0);
power = PipeField(s, 1, 0);
return (float)soldiers * (float)power;
}
internal static string ClanName(int clan)
{
List<List<string>> shiJia_Now = Mainload.ShiJia_Now;
if (shiJia_Now == null || clan < 0 || clan >= shiJia_Now.Count)
{
return "?";
}
string text = F(shiJia_Now[clan], 1);
if (!string.IsNullOrEmpty(text))
{
return text;
}
return "#" + clan;
}
internal void Toast(string s)
{
_toast = s;
_toastUntil = Time.unscaledTime + 4f;
}
private void OnGUI()
{
Font val = MenuFont();
Font font = GUI.skin.font;
if ((Object)(object)val != (Object)null)
{
GUI.skin.font = val;
}
try
{
DrawAll();
}
finally
{
GUI.skin.font = font;
}
}
private void DrawAll()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_0056: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Expected O, but got Unknown
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
if (_headStyle == null)
{
_headStyle = new GUIStyle(GUI.skin.label);
_headStyle.fontStyle = (FontStyle)1;
_toastStyle = new GUIStyle(GUI.skin.box);
_toastStyle.fontSize = 15;
_toastStyle.normal.textColor = Color.white;
}
if (Time.unscaledTime < _toastUntil && !string.IsNullOrEmpty(_toast))
{
GUI.Box(new Rect((float)Screen.width * 0.5f - 320f, 24f, 640f, 32f), _toast, _toastStyle);
}
if (ModEnabled.Value && ReportButton.Value && BattleReports.Pending() > 0)
{
_reportWin = GUILayout.Window(130148982, _reportWin, new WindowFunction(DrawReportWindow), T("Battle report", "Chiến báo"), Array.Empty<GUILayoutOption>());
}
if (ModEnabled.Value && DispatchButton.Value && Dispatch.Pending() > 0)
{
_dispatchWin = GUILayout.Window(130148983, _dispatchWin, new WindowFunction(DrawDispatchWindow), T("Private soldiers", "Điều động tư binh"), Array.Empty<GUILayoutOption>());
}
if (_showMenu)
{
if (!_sizeLoaded)
{
_sizeLoaded = true;
((Rect)(ref _win)).width = MenuWidth.Value;
((Rect)(ref _win)).height = MenuHeight.Value;
}
_win = GUILayout.Window(130148981, _win, new WindowFunction(DrawWindow), "Clan Cheats 0.2.0 - " + T("press F8 to close", "bấm F8 để đóng"), Array.Empty<GUILayoutOption>());
}
}
private int StableToolbar(int key, int value, string[] labels, params GUILayoutOption[] opts)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
int num = value;
if (_pendingPick.TryGetValue(key, out var value2))
{
num = value2;
}
int num2 = GUILayout.Toolbar(num, labels, opts);
if (num2 != num)
{
_pendingPick[key] = num2;
}
if (Event.current != null && (int)Event.current.type == 8 && _pendingPick.TryGetValue(key, out value2))
{
_pendingPick.Remove(key);
return value2;
}
return value;
}
private int StableGrid(int key, int value, string[] labels, int xCount)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
int num = value;
if (_pendingPick.TryGetValue(key, out var value2))
{
num = value2;
}
int num2 = GUILayout.SelectionGrid(num, labels, xCount, Array.Empty<GUILayoutOption>());
if (num2 != num)
{
_pendingPick[key] = num2;
}
if (Event.current != null && (int)Event.current.type == 8 && _pendingPick.TryGetValue(key, out value2))
{
_pendingPick.Remove(key);
return value2;
}
return value;
}
private void ResizeGrip()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Invalid comparison between Unknown and I4
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Invalid comparison between Unknown and I4
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Invalid comparison between Unknown and I4
Rect val = default(Rect);
((Rect)(ref val))..ctor(((Rect)(ref _win)).width - 18f - 2f, ((Rect)(ref _win)).height - 18f - 2f, 18f, 18f);
GUI.Box(val, GUIContent.none);
GUI.Label(new Rect(((Rect)(ref val)).x + 4f, ((Rect)(ref val)).y - 1f, 18f, 18f), "//");
Event current = Event.current;
if (current != null)
{
if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition))
{
_resizing = true;
current.Use();
}
else if (_resizing && (int)current.type == 3)
{
((Rect)(ref _win)).width = Mathf.Clamp(current.mousePosition.x + 9f, 520f, 3000f);
((Rect)(ref _win)).height = Mathf.Clamp(current.mousePosition.y + 9f, 360f, 2000f);
current.Use();
}
else if (_resizing && ((int)current.type == 1 || (int)current.type == 21))
{
_resizing = false;
MenuWidth.Value = ((Rect)(ref _win)).width;
MenuHeight.Value = ((Rect)(ref _win)).height;
current.Use();
}
}
}
private void DrawDispatchWindow(int id)
{
if (GUILayout.Button(T("Send everything (" + Dispatch.Pending() + " camps)", "Điều động tối đa (" + Dispatch.Pending() + " doanh)"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
{
int num = Dispatch.SendAll();
Toast(T("Sent everything from " + num + " camps.", "Đã điều động toàn bộ từ " + num + " quân doanh."));
}
if (GUILayout.Button(T("Send none", "Bỏ hết"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) }))
{
int num2 = Dispatch.ClearAll();
Toast(T("Cleared " + num2 + " camps.", "Đã bỏ " + num2 + " quân doanh."));
}
GUI.DragWindow();
}
private void DrawReportWindow(int id)
{
int num = BattleReports.Pending();
if (GUILayout.Button(T("Ignore all (" + num + ")", "Bỏ qua tất cả (" + num + ")"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
int num2 = BattleReports.SkipAll();
Toast(T("Ignored " + num2 + " battle reports.", "Đã bỏ qua " + num2 + " chiến báo."));
}
GUILayout.Label(T("Entries that need a decision are left alone.", "Mục cần quyết định vẫn giữ nguyên."), Array.Empty<GUILayoutOption>());
GUI.DragWindow();
}
private void DrawWindow(int id)
{
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
if (!ModEnabled.Value)
{
GUILayout.Label(T("The mod is switched off in the config file (Enabled = false).", "Mod đang tắt trong file config (Enabled = false)."), Array.Empty<GUILayoutOption>());
GUI.DragWindow();
return;
}
_tab = StableToolbar(0, _tab, new string[8]
{
T("Clan", "Gia tộc"),
T("Retainers", "Môn khách"),
T("Relations", "Quan hệ"),
T("Money & Army", "Tiền & Quân"),
T("Reports", "Chiến báo"),
T("Regency", "Nhiếp chính"),
T("Private army", "Tư binh"),
T("Settings", "Cài đặt")
});
GUILayout.Space(6f);
if (!InGame())
{
GUILayout.Label(T("Load a save first - no clan data in memory yet.", "Hãy vào ván chơi trước - chưa có dữ liệu gia tộc."), Array.Empty<GUILayoutOption>());
GUI.DragWindow();
return;
}
_scroll = GUILayout.BeginScrollView(_scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(Mathf.Max(200f, ((Rect)(ref _win)).height - 140f)) });
try
{
switch (_tab)
{
case 0:
TabClan();
break;
case 1:
TabRetainers();
break;
case 2:
TabRelations();
break;
case 3:
TabArmy();
break;
case 4:
TabReports();
break;
case 5:
TabRegency();
break;
case 6:
TabArmyCamps();
break;
default:
TabSettings();
break;
}
}
catch (Exception ex)
{
GUILayout.Label("Error: " + ex.Message, Array.Empty<GUILayoutOption>());
Log.LogWarning((object)("GUI: " + ex));
}
GUILayout.EndScrollView();
ResizeGrip();
GUI.DragWindow(new Rect(0f, 0f, 10000f, 24f));
}
private void StatHeader()
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(T("Capped stats", "Chỉ số có trần") + ": " + StatTarget.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(180f)) });
if (GUILayout.Button("100", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(50f)) }))
{
StatTarget.Value = 100;
}
if (GUILayout.Button("999", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(50f)) }))
{
StatTarget.Value = 999;
}
GUILayout.Label(T("Talent / skill / luck", "Thiên phú / kỹ năng / may mắn") + ": " + ExtraTarget.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(250f)) });
if (GUILayout.Button("999", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(50f)) }))
{
ExtraTarget.Value = 999;
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
SetAge.Value = GUILayout.Toggle(SetAge.Value, T("also set age", "chỉnh cả tuổi") + " ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(160f)) });
GUILayout.Label(T("age", "tuổi") + ": " + AgeTarget.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(70f)) });
AgeTarget.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)AgeTarget.Value, 1f, 99f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(180f)) }));
StaminaToAgeMax.Value = GUILayout.Toggle(StaminaToAgeMax.Value, " " + T("stamina to its age ceiling", "thể lực = trần theo tuổi"), Array.Empty<GUILayoutOption>());
GUILayout.EndHorizontal();
if (StatTarget.Value > 100)
{
GUILayout.Label(T("Note: the game clamps these stats to 100 whenever it changes them, so anything above 100 is temporary.", "Lưu ý: game ép các chỉ số này về 100 mỗi lần nó thay đổi, nên số trên 100 chỉ là tạm thời."), Array.Empty<GUILayoutOption>());
}
GUILayout.Space(6f);
}
private void TabClan()
{
StatHeader();
List<List<string>> member_now = Mainload.Member_now;
List<List<string>> member_qu = Mainload.Member_qu;
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button(T("MAX EVERYONE IN THE CLAN", "MAX TẤT CẢ THÀNH VIÊN GIA TỘC"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
int num = MaxAllClan();
Toast(T("Maxed " + num + " people.", "Đã max " + num + " người."));
}
IncludeSpouses.Value = GUILayout.Toggle(IncludeSpouses.Value, " " + T("include spouses", "gồm cả thê thiếp"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(200f)) });
GUILayout.EndHorizontal();
GUILayout.Space(6f);
GUILayout.Label(T("Clan members", "Thành viên gia tộc") + " (" + (member_now?.Count ?? 0) + ")", _headStyle, Array.Empty<GUILayoutOption>());
if (member_now != null)
{
for (int i = 0; i < member_now.Count; i++)
{
List<string> row = member_now[i];
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(NameOf(row, 4), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(170f)) });
GUILayout.Label(T("age", "tuổi") + " " + F(row, 6), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(65f)) });
GUILayout.Label("W" + Mathf.FloorToInt(PF(F(row, 7), 0f)) + " M" + Mathf.FloorToInt(PF(F(row, 8), 0f)) + " B" + Mathf.FloorToInt(PF(F(row, 9), 0f)) + " A" + Mathf.FloorToInt(PF(F(row, 10), 0f)) + " C" + Mathf.FloorToInt(PF(F(row, 27), 0f)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(190f)) });
GUILayout.Label(T("ren", "dt") + " " + Mathf.FloorToInt(PF(F(row, 16), 0f)) + " " + T("sta", "tl") + " " + F(row, 30), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(110f)) });
if (GUILayout.Button("Max", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(60f)) }))
{
MaxClanMember(i);
Toast(NameOf(row, 4) + " " + T("maxed.", "đã max."));
}
GUILayout.EndHorizontal();
}
}
GUILayout.Space(8f);
GUILayout.Label(T("Spouses married in", "Thê thiếp gia nhập") + " (" + (member_qu?.Count ?? 0) + ")", _headStyle, Array.Empty<GUILayoutOption>());
if (member_qu == null)
{
return;
}
for (int j = 0; j < member_qu.Count; j++)
{
List<string> row2 = member_qu[j];
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(NameOf(row2, 2), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(170f)) });
GUILayout.Label(T("age", "tuổi") + " " + F(row2, 5), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(65f)) });
GUILayout.Label("W" + Mathf.FloorToInt(PF(F(row2, 6), 0f)) + " M" + Mathf.FloorToInt(PF(F(row2, 7), 0f)) + " B" + Mathf.FloorToInt(PF(F(row2, 8), 0f)) + " A" + Mathf.FloorToInt(PF(F(row2, 9), 0f)) + " C" + Mathf.FloorToInt(PF(F(row2, 19), 0f)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(190f)) });
GUILayout.Label(T("ren", "dt") + " " + Mathf.FloorToInt(PF(F(row2, 12), 0f)) + " " + T("sta", "tl") + " " + F(row2, 20), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(110f)) });
if (GUILayout.Button("Max", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(60f)) }))
{
MaxSpouse(j);
Toast(NameOf(row2, 2) + " " + T("maxed.", "đã max."));
}
GUILayout.EndHorizontal();
}
}
private void TabRetainers()
{
StatHeader();
List<List<string>> menKe_Now = Mainload.MenKe_Now;
if (GUILayout.Button(T("MAX EVERY RETAINER", "MAX TẤT CẢ MÔN KHÁCH"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
int num = MaxAllRetainers();
Toast(T("Maxed " + num + " retainers.", "Đã max " + num + " môn khách."));
}
GUILayout.Space(6f);
GUILayout.Label(T("Retainers", "Môn khách") + " (" + (menKe_Now?.Count ?? 0) + ")", _headStyle, Array.Empty<GUILayoutOption>());
if (menKe_Now == null)
{
return;
}
for (int i = 0; i < menKe_Now.Count; i++)
{
List<string> row = menKe_Now[i];
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(NameOf(row, 2), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(170f)) });
GUILayout.Label(T("age", "tuổi") + " " + F(row, 3), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(65f)) });
GUILayout.Label("W" + Mathf.FloorToInt(PF(F(row, 4), 0f)) + " M" + Mathf.FloorToInt(PF(F(row, 5), 0f)) + " B" + Mathf.FloorToInt(PF(F(row, 6), 0f)) + " A" + Mathf.FloorToInt(PF(F(row, 7), 0f)) + " C" + Mathf.FloorToInt(PF(F(row, 15), 0f)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(190f)) });
GUILayout.Label(T("ren", "dt") + " " + Mathf.FloorToInt(PF(F(row, 11), 0f)) + " " + T("sta", "tl") + " " + F(row, 19), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(110f)) });
if (GUILayout.Button("Max", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(60f)) }))
{
MaxRetainer(i);
Toast(NameOf(row, 2) + " " + T("maxed.", "đã max."));
}
GUILayout.EndHorizontal();
}
}
private void TabRelations()
{
GUILayout.Label(T("Automatic - these fire while you play", "Tự động - chạy trong lúc bạn chơi"), _headStyle, Array.Empty<GUILayoutOption>());
MaxNpcRelation.Value = GUILayout.Toggle(MaxNpcRelation.Value, " " + T("Chatting with anyone outside your house maxes that person's relation", "Nói chuyện với người ngoài gia tộc -> quan hệ với người đó lên max"), Array.Empty<GUILayoutOption>());
MaxClanRelation.Value = GUILayout.Toggle(MaxClanRelation.Value, " " + T("...and maxes that whole clan's relation with your house", "...và quan hệ của cả gia tộc đó với nhà bạn lên max"), Array.Empty<GUILayoutOption>());
MaxOwnMood.Value = GUILayout.Toggle(MaxOwnMood.Value, " " + T("Interacting with your own people maxes their mood", "Tương tác với người nhà -> tâm trạng lên max"), Array.Empty<GUILayoutOption>());
RelationOnlyWhenFriendly.Value = GUILayout.Toggle(RelationOnlyWhenFriendly.Value, " " + T("only after friendly actions (recommended)", "chỉ sau hành động thiện chí (nên bật)"), Array.Empty<GUILayoutOption>());
GUILayout.Space(6f);
MaxRebelRelation.Value = GUILayout.Toggle(MaxRebelRelation.Value, " " + T("Funding a rebel king maxes every rebel king's relation with you", "Tài trợ phản vương -> quan hệ với mọi phản vương lên max"), Array.Empty<GUILayoutOption>());
RebelRecruitAlwaysSucceeds.Value = GUILayout.Toggle(RebelRecruitAlwaysSucceeds.Value, " " + T("The court request that installs / removes a rebel king always succeeds", "Thỉnh cầu lập / bỏ phản vương luôn thành công"), Array.Empty<GUILayoutOption>());
AllCourtRequestsSucceed.Value = GUILayout.Toggle(AllCourtRequestsSucceed.Value, " " + T("Stronger: EVERY request through a palace consort always succeeds", "Mạnh hơn: MỌI thỉnh cầu qua phi tần đều thành công"), Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
GUILayout.Label(T("One-off buttons", "Nút bấm một lần"), _headStyle, Array.Empty<GUILayoutOption>());
if (GUILayout.Button(T("Max relations with every clan and everyone in them", "Max quan hệ với mọi gia tộc và mọi người trong đó"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
{
int num = MaxAllClanRelations();
Toast(T("Maxed relations with " + num + " clans.", "Đã max quan hệ với " + num + " gia tộc."));
}
if (GUILayout.Button(T("Max relations with every rebel king", "Max quan hệ với mọi phản vương"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
{
int num2 = MaxAllRebelRelations();
Toast((num2 > 0) ? T("Maxed " + num2 + " rebel kings.", "Đã max " + num2 + " phản vương.") : T("There is no rebel king right now.", "Hiện không có phản vương nào."));
}
if (GUILayout.Button(T("Max the mood of everyone in your clan", "Max tâm trạng toàn bộ gia tộc"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
{
int num3 = MaxOwnClanMood();
Toast(T("Mood maxed for " + num3 + " people.", "Đã max tâm trạng cho " + num3 + " người."));
}
}
private void TabArmy()
{
GUILayout.Label(T("Money", "Tiền"), _headStyle, Array.Empty<GUILayoutOption>());
NoCoinLoss.Value = GUILayout.Toggle(NoCoinLoss.Value, " " + T("Coins never go down (income still works)", "Tiền không bao giờ giảm (vẫn thu được tiền vào)"), Array.Empty<GUILayoutOption>());
try
{
List<string> cGNum = Mainload.CGNum;
if (cGNum != null && cGNum.Count > 0)
{
GUILayout.Label(T("current coins", "tiền hiện có") + ": " + cGNum[0], Array.Empty<GUILayoutOption>());
}
}
catch
{
}
GUILayout.Space(10f);
GUILayout.Label(T("Private army in a fief", "Tư binh trong phong địa"), _headStyle, Array.Empty<GUILayoutOption>());
SiBingNoHappinessLoss.Value = GUILayout.Toggle(SiBingNoHappinessLoss.Value, " " + T("recruiting costs no happiness", "chiêu mộ không mất hạnh phúc"), Array.Empty<GUILayoutOption>());
SiBingAddPopulation.Value = GUILayout.Toggle(SiBingAddPopulation.Value, " " + T("recruiting ADDS population instead of taking it", "chiêu mộ làm TĂNG dân số thay vì giảm"), Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(T("people per soldier", "dân / lính") + ": " + SiBingPopGain.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(210f)) });
SiBingPopGain.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)SiBingPopGain.Value, 0f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(200f)) }));
GUILayout.EndHorizontal();
SiBingNoCap.Value = GUILayout.Toggle(SiBingNoCap.Value, " " + T("lift the recruiting cap", "bỏ giới hạn số lính chiêu mộ"), Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
GUILayout.Label(T("City / province army (you must govern it)", "Quân đội quận / huyện (phải có người nhà làm quan)"), _headStyle, Array.Empty<GUILayoutOption>());
CityNoDiscontent.Value = GUILayout.Toggle(CityNoDiscontent.Value, " " + T("recruiting causes no discontent", "chiêu quân không gây dân oán"), Array.Empty<GUILayoutOption>());
CityAddPopulation.Value = GUILayout.Toggle(CityAddPopulation.Value, " " + T("recruiting ADDS population instead of taking it", "chiêu quân làm TĂNG dân số thay vì giảm"), Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(T("people per soldier", "dân / lính") + ": " + CityPopGain.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(210f)) });
CityPopGain.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)CityPopGain.Value, 0f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(200f)) }));
GUILayout.EndHorizontal();
CityNoCap.Value = GUILayout.Toggle(CityNoCap.Value, " " + T("lift the recruiting cap", "bỏ giới hạn số quân chiêu mộ"), Array.Empty<GUILayoutOption>());
}
private void TabReports()
{
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Label(T("Front-line battle report", "Chiến báo tiền tuyến"), _headStyle, Array.Empty<GUILayoutOption>());
GUILayout.Label(T("The game will not let you close this panel until every entry has been dealt with. This presses 'Ignore' on every entry that still offers one, and leaves the entries that need a real decision - withdrawing troops, and anything else where the game hides the Ignore button.", "Game không cho đóng bảng này cho tới khi mọi mục đã được xử lý. Tính năng này bấm 'Bỏ qua' cho mọi mục còn nút đó, và giữ nguyên những mục cần bạn quyết định - thu quân, và bất kỳ mục nào game ẩn nút Bỏ qua."), Array.Empty<GUILayoutOption>());
GUILayout.Space(6f);
ReportButton.Value = GUILayout.Toggle(ReportButton.Value, " " + T("show the floating button while the report is open", "hiện nút nổi khi bảng chiến báo đang mở"), Array.Empty<GUILayoutOption>());
ReportAuto.Value = GUILayout.Toggle(ReportAuto.Value, " " + T("do it automatically as soon as the report opens", "tự động làm ngay khi bảng chiến báo mở ra"), Array.Empty<GUILayoutOption>());
ReportAutoClose.Value = GUILayout.Toggle(ReportAutoClose.Value, " " + T("close the report too when nothing is left to decide", "đóng luôn bảng chiến báo khi không còn gì phải quyết định"), Array.Empty<GUILayoutOption>());
GUILayout.Label(T("hotkey", "phím tắt") + ": " + ((object)ReportKey.Value/*cast due to .constrained prefix*/).ToString(), Array.Empty<GUILayoutOption>());
GUILayout.Space(8f);
int num = BattleReports.Pending();
GUILayout.Label(T("entries that can be ignored right now", "số mục có thể bỏ qua ngay bây giờ") + ": " + num, Array.Empty<GUILayoutOption>());
if (GUILayout.Button(T("Ignore all now", "Bỏ qua tất cả ngay"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
{
int num2 = BattleReports.SkipAll();
Toast(T("Ignored " + num2 + " battle reports.", "Đã bỏ qua " + num2 + " chiến báo."));
}
}
private void TabRegency()
{
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Label(T("What a regent does", "Nhiếp chính làm gì"), _headStyle, Array.Empty<GUILayoutOption>());
GUILayout.Label(T("A royal with a portfolio runs that ministry every tick, using one of their own stats. Cunning drives Civil, Industry and Judicial; Might drives War; Business drives Revenue; Writing drives Ritual - and Ritual pushes a commandery's Order DOWN when the regent's Writing is low, so it is the one to be careful with.", "Hoàng thân có chức nhiếp chính sẽ điều hành bộ đó mỗi lượt, dựa vào một chỉ số của chính họ. Mưu lược chi phối Lại bộ, Công bộ và Hình bộ; Võ tài chi phối Binh bộ; Thương tài chi phối Hộ bộ; Văn tài chi phối Lễ bộ - và Lễ bộ sẽ KÉO TỤT điểm Giáo hoá của quận nếu Văn tài thấp, nên đây là bộ cần cân nhắc."), Array.Empty<GUILayoutOption>());
GUILayout.Space(6f);
RunAllMinistries.Value = GUILayout.Toggle(RunAllMinistries.Value, " " + T("A regent runs all six ministries, not just the one they hold", "Nhiếp chính chạy cả sáu bộ, không chỉ bộ đang giữ"), Array.Empty<GUILayoutOption>());
GUILayout.Space(8f);
List<string> list = new List<string>();
for (int i = 0; i <= 6; i++)
{
list.Add(MinistryName(i));
}
GUILayout.Label(T("Portfolio to assign", "Chức sẽ giao") + ":", _headStyle, Array.Empty<GUILayoutOption>());
_ministry = StableGrid(1, Mathf.Clamp(_ministry, 0, list.Count - 1), list.ToArray(), 4);
GUILayout.Space(6f);
if (GUILayout.Button(T("Max the stats of every royal", "Max chỉ số toàn bộ hoàng thất"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
{
int num = MaxAllRoyals();
Toast(T("Maxed " + num + " royals.", "Đã max " + num + " hoàng thân."));
}
GUILayout.Space(8f);
_royalScroll = GUILayout.BeginScrollView(_royalScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(300f) });
for (int j = 0; j <= 1; j++)
{
List<List<string>> list2 = RoyalList(j);
GUILayout.Label(((j == 0) ? T("Royals", "Hoàng thân") : T("Consorts", "Phi tần")) + " (" + (list2?.Count ?? 0) + ")", _headStyle, Array.Empty<GUILayoutOption>());
if (list2 == null)
{
continue;
}
int[] array = RoyalCols(j);
for (int k = 0; k < list2.Count; k++)
{
List<string> row = list2[k];
int num2 = RegencyOf(j, k);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(NameOf(row, array[0]), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(150f)) });
GUILayout.Label(T("age", "tuổi") + " " + F(row, array[1]), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(60f)) });
GUILayout.Label("W" + Mathf.FloorToInt(PF(F(row, array[2]), 0f)) + " M" + Mathf.FloorToInt(PF(F(row, array[3]), 0f)) + " B" + Mathf.FloorToInt(PF(F(row, array[4]), 0f)) + " C" + Mathf.FloorToInt(PF(F(row, array[9]), 0f)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(150f)) });
GUILayout.Label((num2 == 6) ? "-" : MinistryName(num2), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(140f)) });
if (GUILayout.Button(T("Assign", "Giao"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(60f)) }))
{
SetRegency(j, k, _ministry);
Toast(NameOf(row, array[0]) + " -> " + MinistryName(_ministry));
}
if (GUILayout.Button("Max", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(50f)) }))
{
MaxRoyal(j, k);
Toast(NameOf(row, array[0]) + " " + T("maxed.", "đã max."));
}
GUILayout.EndHorizontal();
}
GUILayout.Space(6f);
}
GUILayout.EndScrollView();
}
private void TabArmyCamps()
{
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Label(T("How an armed clash is decided", "Đối kháng võ lực được tính thế nào"), _headStyle, Array.Empty<GUILayoutOption>());
GUILayout.Label(T("soldiers x fighting power x (0.7 + loyalty/100) against their soldiers x their power. Loyalty multiplies the whole army - 100 is x1.7, 0 is x0.7 - so it is worth as much as power. Fighting power is the camp's base plus 0.3 of each weapon grade, and each grade is capped at 100 by the game, so weapons are worth at most +60.\n\nWinning by a hair kills almost everyone: the survivors are exactly the strength left over after cancelling out their army. The clash also costs you 20-49 relation with that clan, win or lose.", "số lính x chiến lực x (0,7 + trung thành/100) đấu với số lính họ x chiến lực họ. Trung thành nhân vào toàn quân - 100 là x1,7, 0 là x0,7 - nên quan trọng ngang chiến lực. Chiến lực = giá trị gốc của doanh cộng 0,3 mỗi cấp vũ khí, mà mỗi cấp game chặn ở 100, nên vũ khí tối đa chỉ thêm +60.\n\nThắng sát nút là chết gần hết: số sống sót đúng bằng phần lực còn dư sau khi triệt tiêu quân địch. Trận này còn trừ 20-49 điểm quan hệ với gia tộc đó, dù thắng hay thua."), Array.Empty<GUILayoutOption>());
GUILayout.Space(8f);
List<int[]> list = Camps();
if (list.Count == 0)
{
GUILayout.Label(T("You have no military camp anywhere", "Bạn chưa có quân doanh nào"), _headStyle, Array.Empty<GUILayoutOption>());
GUILayout.Label(T("There is no camp on the map, which is why the dispatch list is empty and nothing can be sent. A camp is a building you raise on an empty plot inside a fief you hold, and soldiers are then recruited into it.\n\nThis tab deliberately will not create one: the fief scene spawns a building for every camp row, so a row invented here would leave a structure your save carries forever. Build it in game, then come back and this tab will fill it.", "Trên bản đồ chưa có quân doanh nào, nên danh sách điều động trống và không gửi được ai. Quân doanh là công trình bạn xây trên một lô đất trống trong phong địa của mình, rồi chiêu mộ lính vào đó.\n\nTab này cố ý KHÔNG tự tạo quân doanh: cảnh phong địa sinh một công trình cho mỗi dòng quân doanh, nên dòng do mod bịa ra sẽ để lại một công trình mà save mang theo vĩnh viễn. Hãy xây trong game, xong quay lại đây là tab này bơm đầy cho."), Array.Empty<GUILayoutOption>());
GUILayout.Space(8f);
}
else
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(T("soldiers", "số lính") + ": " + CampSoldiers.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(150f)) });
CampSoldiers.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)CampSoldiers.Value, 0f, 99999f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(150f)) }));
GUILayout.Space(10f);
GUILayout.Label(T("power", "chiến lực") + ": " + CampPowerTarget.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(130f)) });
CampPowerTarget.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)CampPowerTarget.Value, 0f, 999f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(120f)) }));
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(T("loyalty", "trung thành") + ": " + CampLoyalty.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(150f)) });
CampLoyalty.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)CampLoyalty.Value, 0f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(150f)) }));
GUILayout.Label(T("weapons are set to 100 each, the game's own cap", "hai cấp vũ khí đặt 100 - đúng trần của game"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(360f)) });
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
if (GUILayout.Button(T("FILL EVERY CAMP", "BƠM ĐẦY MỌI QUÂN DOANH"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
{
int num = MaxAllCamps();
Toast(T("Filled " + num + " camps.", "Đã bơm " + num + " quân doanh."));
}
GUILayout.Space(6f);
}
_campScroll = GUILayout.BeginScrollView(_campScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(Mathf.Max(140f, ((Rect)(ref _win)).height - 470f)) });
foreach (int[] item in list)
{
List<string> list2 = Camp(item[0], item[1]);
if (list2 != null)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
string text = F(list2, 7);
GUILayout.Label((string.IsNullOrEmpty(text) ? T("camp", "quân doanh") : text) + " (" + T("fief", "phong địa") + " " + item[0] + ")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(190f)) });
GUILayout.Label(T("men", "lính") + " " + F(list2, 2), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(110f)) });
GUILayout.Label(T("pow", "lực") + " " + Mathf.RoundToInt(CampPower(list2)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(90f)) });
GUILayout.Label(T("loy", "tt") + " " + Mathf.RoundToInt(PF(F(list2, 4), 0f)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(80f)) });
GUILayout.Label("= " + Mathf.RoundToInt(CampStrength(list2)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(120f)) });
if (GUILayout.Button(T("Fill", "Bơm"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(60f)) }))
{
MaxCamp(item[0], item[1]);
Toast(T("Camp filled.", "Đã bơm quân doanh."));
}
GUILayout.EndHorizontal();
}
}
GUILayout.Space(8f);
float num2 = TotalArmyStrength();
float num3 = BestPerSoldier();
GUILayout.Label(T("Your total fighting strength", "Tổng lực của bạn") + ": " + Mathf.RoundToInt(num2) + ((num3 > 0f) ? (" (" + T("best camp", "doanh mạnh nhất") + ": " + Mathf.RoundToInt(num3) + T("/man", "/lính") + ")") : ""), _headStyle, Array.Empty<GUILayoutOption>());
GUILayout.Space(4f);
List<List<string>> shiJia_Now = Mainload.ShiJia_Now;
int num4 = 0;
while (shiJia_Now != null && num4 < shiJia_Now.Count)
{
int soldiers;
int power;
float num5 = ClanStrength(num4, out soldiers, out power);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(ClanName(num4), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(150f)) });
GUILayout.Label(soldiers + " x " + power + " = " + Mathf.RoundToInt(num5), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(200f)) });
if (num5 <= 0f)
{
GUILayout.Label("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(230f)) });
}
else if (num2 > num5)
{
GUILayout.Label(T("you win", "bạn thắng") + " (" + T("survivors", "sống sót") + " ~" + ((num3 > 0f) ? Mathf.FloorToInt((num2 - num5) / num3) : 0) + ")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(230f)) });
}
else if (num3 > 0f)
{
GUILayout.Label(T("need ", "cần thêm ") + (Mathf.CeilToInt((num5 - num2) / num3) + 1) + T(" more men", " lính nữa"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(230f)) });
}
else
{
GUILayout.Label(T("no army yet", "chưa có quân"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(230f)) });
}
GUILayout.EndHorizontal();
num4++;
}
GUILayout.EndScrollView();
}
private void TabSettings()
{
GUILayout.Label(T("Language / Ngôn ngữ", "Ngôn ngữ / Language"), _headStyle, Array.Empty<GUILayoutOption>());
if (GUILayout.Button(VI ? "Switch to English" : "Chuyển sang Tiếng Việt", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(W(240f)) }))
{
Language.Value = ((!VI) ? Lang.VI : Lang.EN);
}
Font val = MenuFont();
GUILayout.Label(T("menu font", "phông chữ menu") + ": " + (((Object)(object)val == (Object)null) ? "(default)" : ((Object)val).name) + " - " + (_accents ? T("accents OK", "hiển thị được dấu") : T("no accents available on this machine", "máy này không có phông hiển thị dấu")), Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
GUILayout.Label(T("What the numbers mean", "Ý nghĩa các con số"), _headStyle, Array.Empty<GUILayoutOption>());
GUILayout.Label(T("Writing, Might, Business, Arts, Cunning, Charisma, Renown, Health and Mood all run through the game's own clamp, which pins them to 100. Writing 999 shows 999 until the game next changes that stat, then it snaps back to 100.\n\nTalent value, skill level and luck have no clamp, so 999 stays.\n\nStamina has an age-based ceiling: 30 and under = your age, 31-50 = 60 minus your age, over 50 = a small number. Filling to that ceiling is what the game keeps.", "Văn tài, Võ tài, Thương tài, Nghệ tài, Mưu lược, Mị lực, Danh tiếng, Sức khỏe và Tâm trạng đều đi qua hàm giới hạn của game, ép về 100. Ghi 999 sẽ hiện 999 cho đến lần sau game thay đổi chỉ số đó, rồi tự trở về 100.\n\nThiên phú, cấp kỹ năng và may mắn không bị giới hạn, nên 999 giữ nguyên.\n\nThể lực có trần theo tuổi: <=30 = bằng tuổi, 31-50 = 60 trừ tuổi, >50 = một số nhỏ. Đổ đầy đến trần đó mới là giá trị game giữ lại."), Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
GUILayout.Label(T("Safety", "An toàn"), _headStyle, Array.Empty<GUILayoutOption>());
GUILayout.Label(T("This mod only writes numbers the game already writes itself, in the same columns and the same format. Nothing is added or removed from any list, so removing the mod leaves your save working - the numbers simply stop being refreshed.\n\nBack up your save before a first run anyway.", "Mod chỉ ghi những con số mà chính game cũng ghi, đúng ô và đúng định dạng. Không thêm / xóa dòng nào trong danh sách, nên gỡ mod ra save vẫn chạy bình thường - chỉ là các con số không còn được làm mới.\n\nDù vậy hãy sao lưu save trước khi chạy lần đầu."), Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
ModEnabled.Value = GUILayout.Toggle(ModEnabled.Value, " " + T("mod enabled", "bật mod"), Array.Empty<GUILayoutOption>());
}
}
internal static class BattleReports
{
private static MethodInfo _actA;
private static FieldInfo _reSalveNum;
private static FieldInfo _eventData;
private static MethodInfo _closeBT;
private const float ScanEvery = 0.25f;
private static float _nextScan;
private static int _pendingCache;
private static bool _openCache;
private static bool _justOpened;
private static bool _tickFailed;
private static MethodInfo ActA
{
get
{
if (_actA == null)
{
_actA = AccessTools.Method(typeof(PerZhanBao), "ActABT", (Type[])null, (Type[])null);
}
return _actA;
}
}
private static Event_10_PanelA Panel()
{
try
{
Event_10_PanelA[] array = Object.FindObjectsOfType<Event_10_PanelA>();
foreach (Event_10_PanelA val in array)
{
if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled)
{
return val;
}
}
}
catch
{
}
return null;
}
private static List<PerZhanBao> Rows()
{
List<PerZhanBao> list = new List<PerZhanBao>();
try
{
PerZhanBao[] array = Object.FindObjectsOfType<PerZhanBao>();
foreach (PerZhanBao val in array)
{
if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy)
{
list.Add(val);
}
}
}
catch
{
}
return list;
}
private static bool CanIgnore(PerZhanBao row)
{
try
{
Transform val = ((Component)row).transform.Find("ActABT");
return (Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf;
}
catch
{
return false;
}
}
private static bool EventStillThere(PerZhanBao row)
{
try
{
string zhanBaoData = row.ZhanBaoData;
if (string.IsNullOrEmpty(zhanBaoData))
{
return false;
}
string[] array = zhanBaoData.Split(new char[1] { '|' });
if (array.Length < 2)
{
return false;
}
string text = array[0] + "|" + array[1];
List<List<string>> warEvent_Now = Mainload.WarEvent_Now;
if (warEvent_Now == null)
{
return false;
}
for (int i = 0; i < warEvent_Now.Count; i++)
{
if (warEvent_Now[i] != null && warEvent_Now[i].Count > 3 && warEvent_Now[i][3] == text)
{
return true;
}
}
}
catch
{
}
return false;
}
internal static void Tick()
{
try
{
if (!(Time.unscaledTime < _nextScan))
{
_nextScan = Time.unscaledTime + 0.25f;
Rescan();
}
}
catch (Exception ex)
{
if (!_tickFailed)
{
_tickFailed = true;
ClanCheatsPlugin.Log.LogWarning((object)("Battle-report scan disabled after an error: " + ex.Message));
}
_nextScan = float.MaxValue;
}
}
private static void Rescan()
{
bool num = (Object)(object)Panel() != (Object)null;
_justOpened = num && !_openCache;
_openCache = num;
if (!num)
{
_pendingCache = 0;
return;
}
int num2 = 0;
foreach (PerZhanBao item in Rows())
{
if (CanIgnore(item) && EventStillThere(item))
{
num2++;
}
}
_pendingCache = num2;
}
internal static int Pending()
{
return _pendingCache;
}
internal static bool JustOpened()
{
if (!_justOpened)
{
return false;
}
_justOpened = false;
return true;
}
internal static int SkipAll()
{
Event_10_PanelA val = Panel();
if ((Object)(object)val == (Object)null)
{
return 0;
}
MethodInfo actA = ActA;
if (actA == null)
{
ClanCheatsPlugin.Log.LogError((object)"PerZhanBao.ActABT not found - the game version may have changed.");
return 0;
}
int num = 0;
foreach (PerZhanBao item in Rows())
{
if (!((Object)(object)item == (Object)null) && CanIgnore(item) && EventStillThere(item))
{
try
{
actA.Invoke(item, null);
num++;
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("Ignoring a battle report failed, leaving it for you: " + ((ex.InnerException != null) ? ex.InnerException.Message : ex.Message)));
}
}
}
if (num > 0 && ClanCheatsPlugin.ReportAutoClose.Value)
{
TryClose(val);
}
Rescan();
return num;
}
private static void TryClose(Event_10_PanelA panel)
{
try
{
if (_reSalveNum == null)
{
_reSalveNum = AccessTools.Field(typeof(Event_10_PanelA), "ReSalveNum");
}
if (_eventData == null)
{
_eventData = AccessTools.Field(typeof(Event_10_PanelA), "EventData");
}
if (_closeBT == null)
{
_closeBT = AccessTools.Method(typeof(Event_10_PanelA), "CloseBT", (Type[])null, (Type[])null);
}
if (!(_reSalveNum == null) && !(_eventData == null) && !(_closeBT == null))
{
int num = (int)_reSalveNum.GetValue(panel);
if (_eventData.GetValue(panel) is string[] array && num >= array.Length)
{
_closeBT.Invoke(panel, null);
}
}
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("Auto-close: " + ex.Message));
}
}
internal static void MarkOpened()
{
_openCache = false;
if (!_tickFailed)
{
_nextScan = 0f;
}
}
}
[HarmonyPatch(typeof(Event_10_PanelA), "OnEnableData")]
internal static class Patch_ReportOpened
{
[HarmonyPostfix]
private static void Postfix()
{
try
{
BattleReports.MarkOpened();
}
catch
{
}
}
}
[HarmonyPatch(typeof(FormuAct), "SheZheng_KingMember")]
internal static class Patch_SheZheng
{
private static int _depth;
[HarmonyPostfix]
private static void Postfix(int __0, int __1)
{
if (!ClanCheatsPlugin.ModEnabled.Value || !ClanCheatsPlugin.RunAllMinistries.Value || _depth > 0)
{
return;
}
List<List<string>> list = ClanCheatsPlugin.RoyalList(__0);
if (list == null || __1 < 0 || __1 >= list.Count)
{
return;
}
int num = ClanCheatsPlugin.RegencyOf(__0, __1);
if (num < 0 || num >= 6)
{
return;
}
_depth++;
try
{
for (int i = 0; i < 6; i++)
{
if (i != num)
{
if (!ClanCheatsPlugin.SetRegency(__0, __1, i))
{
break;
}
try
{
FormuAct.SheZheng_KingMember(__0, __1);
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("Regency ministry " + i + " threw, skipping it: " + ex.Message));
}
}
}
}
finally
{
ClanCheatsPlugin.SetRegency(__0, __1, num);
_depth--;
}
}
}
internal static class Dispatch
{
private static FieldInfo _numAll;
private static FieldInfo _numDiao;
private static MethodInfo _show;
private const float ScanEvery = 0.25f;
private static float _nextScan;
private static int _rowCache;
private static bool _openCache;
private static bool _justOpened;
private static bool _tickFailed;
private static bool Bind()
{
if (_show != null)
{
return true;
}
_numAll = AccessTools.Field(typeof(PerSiBingCanDiao), "Num_All");
_numDiao = AccessTools.Field(typeof(PerSiBingCanDiao), "Num_Diao");
_show = AccessTools.Method(typeof(PerSiBingCanDiao), "SiBingNumShow", (Type[])null, (Type[])null);
if (_numAll == null || _numDiao == null || _show == null)
{
ClanCheatsPlugin.Log.LogError((object)"PerSiBingCanDiao changed shape - the dispatch button is off.");
return false;
}
return true;
}
private static List<PerSiBingCanDiao> Rows()
{
List<PerSiBingCanDiao> list = new List<PerSiBingCanDiao>();
try
{
PerSiBingCanDiao[] array = Object.FindObjectsOfType<PerSiBingCanDiao>();
foreach (PerSiBingCanDiao val in array)
{
if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy)
{
list.Add(val);
}
}
}
catch
{
}
return list;
}
internal static void Tick()
{
try
{
if (!(Time.unscaledTime < _nextScan))
{
_nextScan = Time.unscaledTime + 0.25f;
List<PerSiBingCanDiao> list = Rows();
bool num = list.Count > 0;
_justOpened = num && !_openCache;
_openCache = num;
_rowCache = list.Count;
}
}
catch (Exception ex)
{
if (!_tickFailed)
{
_tickFailed = true;
ClanCheatsPlugin.Log.LogWarning((object)("Dispatch scan disabled after an error: " + ex.Message));
}
_nextScan = float.MaxValue;
}
}
internal static int Pending()
{
return _rowCache;
}
internal static bool JustOpened()
{
if (!_justOpened)
{
return false;
}
_justOpened = false;
return true;
}
internal static int SendAll()
{
return SetAll(toMax: true);
}
internal static int ClearAll()
{
return SetAll(toMax: false);
}
private static int SetAll(bool toMax)
{
if (!Bind())
{
return 0;
}
int num = 0;
foreach (PerSiBingCanDiao item in Rows())
{
try
{
int num2 = (int)_numAll.GetValue(item);
int num3 = (int)_numDiao.GetValue(item);
int num4 = (toMax ? num2 : 0);
if (num4 != num3)
{
_numDiao.SetValue(item, num4);
_show.Invoke(item, null);
num++;
}
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("A camp row refused, leaving it for you: " + ((ex.InnerException != null) ? ex.InnerException.Message : ex.Message)));
}
}
return num;
}
}
[HarmonyPatch(typeof(FormulaData), "ChangeCoins")]
internal static class Patch_ChangeCoins
{
[HarmonyPrefix]
private static bool Prefix(int __0)
{
if (!ClanCheatsPlugin.ModEnabled.Value)
{
return true;
}
if (!ClanCheatsPlugin.NoCoinLoss.Value)
{
return true;
}
return __0 >= 0;
}
}
[HarmonyPatch(typeof(FormulaData), "RelaxChangeShiJia")]
internal static class Patch_RelaxChangeShiJia
{
[HarmonyPostfix]
private static void Postfix(int __0, float __1, int __2, int __3)
{
if (!ClanCheatsPlugin.ModEnabled.Value || (ClanCheatsPlugin.RelationOnlyWhenFriendly.Value && __1 < 0f))
{
return;
}
try
{
if (__2 >= 0)
{
if (ClanCheatsPlugin.MaxNpcRelation.Value)
{
switch (__3)
{
case 0:
{
List<List<List<string>>> member_other = Mainload.Member_other;
if (member_other != null && __2 < member_other.Count && member_other[__2] != null && __0 >= 0 && __0 < member_other[__2].Count)
{
ClanCheatsPlugin.SetF(member_other[__2][__0], 15, ClanCheatsPlugin.RelMax);
}
break;
}
case 1:
{
List<List<List<string>>> member_Other_qu = Mainload.Member_Other_qu;
if (member_Other_qu != null && __2 < member_Other_qu.Count && member_Other_qu[__2] != null && __0 >= 0 && __0 < member_Other_qu[__2].Count)
{
ClanCheatsPlugin.SetF(member_Other_qu[__2][__0], 12, ClanCheatsPlugin.RelMax);
}
break;
}
}
}
if (ClanCheatsPlugin.MaxClanRelation.Value)
{
List<List<string>> shiJia_Now = Mainload.ShiJia_Now;
if (shiJia_Now != null && __2 < shiJia_Now.Count)
{
ClanCheatsPlugin.SetF(shiJia_Now[__2], 3, ClanCheatsPlugin.RelMax);
}
}
}
else if (__2 == -1 && __3 == 0 && ClanCheatsPlugin.MaxOwnMood.Value)
{
List<List<string>> member_now = Mainload.Member_now;
if (member_now != null && __0 >= 0 && __0 < member_now.Count)
{
ClanCheatsPlugin.SetF(member_now[__0], 11, ClanCheatsPlugin.RelMax);
}
}
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("RelaxChangeShiJia postfix: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(WangGPanelJ), "SureBT")]
internal static class Patch_FundRebel
{
[HarmonyPostfix]
private static void Postfix()
{
if (!ClanCheatsPlugin.ModEnabled.Value || !ClanCheatsPlugin.MaxRebelRelation.Value)
{
return;
}
try
{
ClanCheatsPlugin.MaxAllRebelRelations();
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("FundRebel postfix: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(FormuAct), "Result_QuAskKing")]
internal static class Patch_QuAskKing
{
[HarmonyPostfix]
private static void Postfix(int __0, ref List<string> __result)
{
if (ClanCheatsPlugin.ModEnabled.Value && __result != null && __result.Count != 0 && (ClanCheatsPlugin.AllCourtRequestsSucceed.Value || (ClanCheatsPlugin.RebelRecruitAlwaysSucceeds.Value && (__0 == 7 || __0 == 8))))
{
__result[0] = "1";
}
}
}
[HarmonyPatch(typeof(FormulaData), "zhaoSiBing")]
internal static class Patch_ZhaoSiBing
{
private static int[] _cun;
private static int[] _zhen;
private static int _troopsBefore;
private static int _fengdi;
private static int _dixing;
private static bool _armed;
[HarmonyPrefix]
private static void Prefix(int __0, int __1, int __2)
{
_armed = false;
if (!ClanCheatsPlugin.ModEnabled.Value)
{
return;
}
ClanCheatsPlugin.SiBingDepth++;
try
{
_fengdi = __1;
_dixing = __2;
_cun = Snapshot(Mainload.Cun_now, __1, 2);
_zhen = Snapshot(Mainload.Zhen_now, __1, 2);
_troopsBefore = Troops(__1, __2);
_armed = true;
if (ClanCheatsPlugin.SiBingNoCap.Value)
{
long need = (long)__0 * 4L + (long)_troopsBefore * 3L + 400;
Inflate(Mainload.Cun_now, __1, 2, need);
}
}
catch (Exception ex)
{
_armed = false;
ClanCheatsPlugin.Log.LogWarning((object)("zhaoSiBing prefix: " + ex.Message));
}
}
[HarmonyFinalizer]
private static void Finalizer()
{
if (ClanCheatsPlugin.SiBingDepth > 0)
{
ClanCheatsPlugin.SiBingDepth--;
}
if (!_armed)
{
return;
}
_armed = false;
try
{
int num = Mathf.Max(0, Troops(_fengdi, _dixing) - _troopsBefore);
int bonus = (ClanCheatsPlugin.SiBingAddPopulation.Value ? (num * ClanCheatsPlugin.SiBingPopGain.Value) : 0);
Restore(Mainload.Cun_now, _fengdi, 2, _cun, bonus);
Restore(Mainload.Zhen_now, _fengdi, 2, _zhen, 0);
Mainload.isFengdiDataChange = true;
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("zhaoSiBing finalizer: " + ex.Message));
}
}
private static int Troops(int fengdi, int dixing)
{
List<List<List<string>>> junYing_now = Mainload.JunYing_now;
if (junYing_now == null || fengdi < 0 || fengdi >= junYing_now.Count || junYing_now[fengdi] == null)
{
return 0;
}
if (dixing < 0 || dixing >= junYing_now[fengdi].Count)
{
return 0;
}
return ClanCheatsPlugin.PI(ClanCheatsPlugin.F(junYing_now[fengdi][dixing], 2), 0);
}
private static int[] Snapshot(List<List<List<string>>> src, int fengdi, int col)
{
if (src == null || fengdi < 0 || fengdi >= src.Count || src[fengdi] == null)
{
return null;
}
List<List<string>> list = src[fengdi];
int[] array = new int[list.Count];
for (int i = 0; i < list.Count; i++)
{
array[i] = ClanCheatsPlugin.PI(ClanCheatsPlugin.F(list[i], col), 0);
}
return array;
}
private static void Inflate(List<List<List<string>>> src, int fengdi, int col, long need)
{
if (src == null || fengdi < 0 || fengdi >= src.Count || src[fengdi] == null)
{
return;
}
List<List<string>> list = src[fengdi];
if (list.Count == 0)
{
return;
}
long num = need / list.Count + 1000;
for (int i = 0; i < list.Count; i++)
{
if (ClanCheatsPlugin.PI(ClanCheatsPlugin.F(list[i], col), 0) < num)
{
ClanCheatsPlugin.SetF(list[i], col, num.ToString());
}
}
}
private static void Restore(List<List<List<string>>> src, int fengdi, int col, int[] snap, int bonus)
{
if (snap == null || src == null || fengdi < 0 || fengdi >= src.Count || src[fengdi] == null)
{
return;
}
List<List<string>> list = src[fengdi];
int num = Mathf.Min(list.Count, snap.Length);
for (int i = 0; i < num; i++)
{
int num2 = (ClanCheatsPlugin.SiBingAddPopulation.Value ? snap[i] : ClanCheatsPlugin.PI(ClanCheatsPlugin.F(list[i], col), snap[i]));
if (i == 0)
{
num2 += bonus;
}
ClanCheatsPlugin.SetF(list[i], col, num2.ToString());
}
}
}
[HarmonyPatch(typeof(FormulaData), "ReduceXingFu_ForSiBing")]
internal static class Patch_ReduceXingFu
{
[HarmonyPrefix]
private static bool Prefix(ref float __result)
{
if (!ClanCheatsPlugin.ModEnabled.Value)
{
return true;
}
if (ClanCheatsPlugin.SiBingDepth <= 0)
{
return true;
}
if (!ClanCheatsPlugin.SiBingNoHappinessLoss.Value)
{
return true;
}
__result = 0f;
return false;
}
}
[HarmonyPatch(typeof(FormulaData), "ZhaoJun")]
internal static class Patch_ZhaoJun
{
private static bool _armed;
private static int _city;
private static int _xian;
private static int _popBefore;
private static int _armyBefore;
private static string _discontentBefore;
private static List<string> Row(int city, int xian)
{
List<List<List<string>>> cityData_now = Mainload.CityData_now;
if (cityData_now == null || city < 0 || city >= cityData_now.Count || cityData_now[city] == null)
{
return null;
}
int num = ((xian >= 0) ? (xian + 1) : 0);
if (num >= cityData_now[city].Count)
{
return null;
}
return cityData_now[city][num];
}
private static int PopCol(int xian)
{
if (xian >= 0)
{
return 3;
}
return 7;
}
private static int DisCol(int xian)
{
if (xian >= 0)
{
return 4;
}
return 8;
}
private static int ArmyCol(int xian)
{
if (xian >= 0)
{
return 5;
}
return 0;
}
[HarmonyPrefix]
private static void Prefix(int __0, int __1, int __2)
{
_armed = false;
if (!ClanCheatsPlugin.ModEnabled.Value)
{
return;
}
ClanCheatsPlugin.ZhaoJunDepth++;
try
{
_city = __1;
_xian = __2;
List<string> list = Row(__1, __2);
if (list == null)
{
return;
}
_popBefore = ClanCheatsPlugin.PI(ClanCheatsPlugin.F(list, PopCol(__2)), 0);
_discontentBefore = ClanCheatsPlugin.F(list, DisCol(__2));
_armyBefore = ClanCheatsPlugin.PipeField(ClanCheatsPlugin.F(list, ArmyCol(__2)), 1, 0);
_armed = true;
if (ClanCheatsPlugin.CityNoCap.Value)
{
float num = ClanCheatsPlugin.PF(_discontentBefore, 0f);
float num2 = Mathf.Max(0.01f, (100f - num) / 100f);
long num3 = (long)((float)((long)(__0 + 10) * 20L) / num2) + 1000;
if (_popBefore < num3)
{
ClanCheatsPlugin.SetF(list, PopCol(__2), num3.ToString());
}
}
}
catch (Exception ex)
{
_armed = false;
ClanCheatsPlugin.Log.LogWarning((object)("ZhaoJun prefix: " + ex.Message));
}
}
[HarmonyFinalizer]
private static void Finalizer()
{
if (ClanCheatsPlugin.ZhaoJunDepth > 0)
{
ClanCheatsPlugin.ZhaoJunDepth--;
}
if (!_armed)
{
return;
}
_armed = false;
try
{
List<string> list = Row(_city, _xian);
if (list != null)
{
int num = ClanCheatsPlugin.PipeField(ClanCheatsPlugin.F(list, ArmyCol(_xian)), 1, _armyBefore);
int num2 = Mathf.Max(0, num - _armyBefore);
if (ClanCheatsPlugin.CityAddPopulation.Value)
{
int num3 = _popBefore + num2 * ClanCheatsPlugin.CityPopGain.Value;
ClanCheatsPlugin.SetF(list, PopCol(_xian), num3.ToString());
}
else if (ClanCheatsPlugin.CityNoCap.Value)
{
int num4 = num2;
ClanCheatsPlugin.SetF(list, PopCol(_xian), Mathf.Max(0, _popBefore - num4).ToString());
}
if (ClanCheatsPlugin.CityNoDiscontent.Value && _discontentBefore != null)
{
ClanCheatsPlugin.SetF(list, DisCol(_xian), _discontentBefore);
}
}
}
catch (Exception ex)
{
ClanCheatsPlugin.Log.LogWarning((object)("ZhaoJun finalizer: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(FormulaData), "MinYuanChangeForJunAdd")]
internal static class Patch_MinYuanJunAdd
{
[HarmonyPrefix]
private static bool Prefix(ref int __result)
{
if (!ClanCheatsPlugin.ModEnabled.Value)
{
return true;
}
if (ClanCheatsPlugin.ZhaoJunDepth <= 0)
{
return true;
}
if (!ClanCheatsPlugin.CityNoDiscontent.Value)
{
return true;
}
__result = 0;
return false;
}
}