2using System.Collections.Generic;
122 public List<Chara>
members =
new List<Chara>();
162 return _lv * _lv * 100 + 100;
214 num -= (num2 -
MaxPopulation) * 20 * 100 / (100 + 20 * (
int)Mathf.Sqrt(ration));
223 if (!h.
source.elements.IsEmpty())
225 for (
int i = 0; i < h.
source.elements.Length; i += 2)
227 if (h.
source.elements[i] == 2207)
229 ration += h.
source.elements[i + 1];
262 Debug.LogError(
"exception: c==null");
266 Debug.LogError(
"exception: pc==null");
326 if (EClass.rnd(24 * members.Count) < starveChance)
337 if (c.hunger.GetPhase() >= 3)
339 Thing meal = GetMeal(c);
342 FoodEffect.Proc(c, meal);
355 int num2 = Evalue(3707);
356 int num3 = Evalue(3705) + Evalue(3710) * 2;
357 int num4 = 4 + num3 * 4;
358 int num5 = Mathf.Max(1, (100 + Evalue(2205) * 5 + Evalue(3703) * 100 - num2 * 80) / 10);
370 int num7 = 1 +
EClass.
rnd(num2 + num3 + 1);
371 for (
int num8 = 0; num8 < num7; num8++)
390 int num9 = 3 + lv + Evalue(2206) / 5 + Evalue(3702) * 2 + Evalue(2202) / 2;
391 num9 = num9 * (100 + Evalue(3702) * 20 + Evalue(2206)) / 100;
392 num9 = num9 * (100 + (int)Mathf.Sqrt(Evalue(2811)) * 3) / 100;
400 if (luckyMonth || (policies.
IsActive(2822) && Mathf.Sqrt(Evalue(2822) / 2) + 5f >= (
float)
EClass.
rnd(100)))
409 if (chara2 !=
null && (chara2.
id ==
"nun_mother" || chara2.
id ==
"prostitute") && policies.
IsActive(2710))
419 chara2.c_allowance = chara2.LV * 100;
422 chara2.c_allowance *= 10;
454 for (
int num10 = 0; num10 < ((!luckyMonth) ? 1 : 2); num10++)
458 GenerateGarbage(date);
459 if (!date.IsRealTime)
472 ReceivePackages(date);
474 if (!date.IsRealTime && date.hour % 8 == 0)
478 for (
int num11 = 0; num11 < 3; num11++)
511 Dictionary<string, Thing> dictionary =
new Dictionary<string, Thing>();
512 HashSet<string> hashSet =
new HashSet<string>();
513 List<Thing> list2 =
new List<Thing>(1);
518 if (windowSaveData !=
null && windowSaveData.
userFilter)
524 foreach (
Chara member
in members)
545 for (; num3 < list.Count; num3++)
555 Thing thing = list[num3];
560 string text = (flag ? (thing.id +
"|" + thing.IsDecayed +
"|" + thing.
GetName(
NameStyle.Full, 1)) : (thing.
id +
"|" + thing.
IsDecayed));
561 if (hashSet.Contains(text))
566 if (dictionary.TryGetValue(text, out var value) && !value.isDestroyed)
577 dictionary[text] = thing2;
590 list.RemoveRange(0, num3);
610 foreach (
Chara member
in members)
618 foreach (
Chara member2
in members)
620 member2.c_isPrayed =
false;
621 member2.c_isTrained =
false;
630 luckyMonthDone =
false;
635 luckyMonth = (float)(flag ? 30 : 5) + Mathf.Sqrt(Evalue(2118)) * (
float)(flag ? 4 : 2) > (
float)
EClass.
rnd(720);
647 luckyMonthDone =
true;
655 foreach (
Chara member
in members)
671 if (member.
GetWork(
"Pioneer") !=
null)
682 lastStatistics = statistics;
688 int sortChance = 40 + GetCivility();
689 int unsortedCount = 0;
690 foreach (
Chara member
in members)
701 int num = Evalue(2702);
703 for (
int i = 0; i < num2; i++)
710 foreach (
Chara member2
in members)
717 void Generate(
Chara c)
732 string id =
"trash2";
739 id = ((
EClass.
rnd(3) == 0) ?
"529" :
"1170");
767 if (unsortedCount >= 5)
798 EClass.player.flags.elinGift =
true;
800 if (listPackage.Count == 0)
808 if (
item.id !=
"bill")
812 PutInMailBox(
item,
item.id ==
"cardboard_box" ||
item.id ==
"gift");
815 Msg.
Say(
"deliver_arrive", num.ToString() ??
"");
822 foreach (
Chara member
in members)
828 thing2.c_idRefCard = m.
id;
846 if (m.
race.breeder >=
EClass.
rnd(2500 - (
int)Mathf.Sqrt(Evalue(2827) * 100)))
850 Thing t = m.
MakeEgg(date.IsRealTime, 1, date.IsRealTime);
851 if (!date.IsRealTime)
859 if (!date.IsRealTime)
887 foreach (
Hobby item in m.ListHobbies().ToList())
895 void GetOutcome(
Hobby h)
898 int num4 = h.
GetLv(m);
900 if (!m.elements.HasBase(
id))
902 m.elements.SetBase(
id, 1);
905 for (
int i = 0; i < h.
source.things.Length; i += 2)
907 string text = h.
source.things[i];
908 int num5 = Mathf.Max(1, h.
source.things[i + 1].ToInt() * num3 / 1000);
909 int num6 = num5 / 1000;
916 if (!(text ==
"_egg"))
920 m.MakeMilk(date.IsRealTime, num6);
951 thing4.c_IDTState = 0;
953 bool flag = thing4.category.id ==
"garbage";
963 if (thing4.
id ==
"lunch_dystopia")
975 m.TryPutShared(thing4);
982 m.MakeEgg(date.IsRealTime, num6);
990 foreach (
Chara member2
in members)
996 Log(
"bNurse", m, member2);
1015 for (
int num8 = 0; num8 < num3 / 2; num8++)
1025 case "TreasureHunt":
1032 m.TryPutShared(thing6);
1042 int num = Mathf.Min(100, 70 + (MaxSoil - soilCost));
1047 if (cell.
obj != 0 && cell.
sourceObj.tag.Contains(
"flower"))
1049 PlantData plantData = cell.TryGetPlant();
1050 if (plantData != null && plantData.seed != null)
1052 lv += plantData.seed.encLV + 1;
1088 Thing mailBox = GetMailBox();
1089 if (mailBox !=
null)
1095 Point mailBoxPos = GetMailBoxPos();
1110 Thing thing = GetMailBox();
1117 return thing.
pos.
GetNearestPoint(allowBlock:
false, allowChara:
true, allowInstalled:
false, ignoreCenter:
true).
Clamp(useBounds:
true);
1129 int num2 = (policies.
IsActive(2500, 30) ? Evalue(2500) : 0);
1130 int num3 = (policies.
IsActive(2501, 30) ? Evalue(2501) : 0);
1131 int num4 = 50 + (int)Mathf.Sqrt(Evalue(2512)) * 5;
1132 foreach (
Chara member
in members)
1142 int num6 = item.source.tax * 100 / 100;
1148 int num7 = (int)(((isWealthy ? 50 : 10) + (long)member.
LV * 2L) * num5 / 100 * num4 / 100);
1149 if (isWealthy && num2 > 0)
1151 num7 = num7 * (150 + (int)Mathf.Sqrt(num2) * 5) / 100;
1155 num7 += (80 + (int)Mathf.Sqrt(num3) * 5) * member.
faith.
source.tax / 100;
1157 num7 = num7 * efficiency / (IsTaxFree ? 100 : 1000);
1161 Log(
"bTax", num7.ToString() ??
"", member.
Name);
1164 statistics.tax += num;
1170 int num = CountGuests();
1181 int maxHolders = traitBed.MaxHolders;
1183 num3 += traitBed.owner.LV * (100 + traitBed.owner.Quality / 2 + traitBed.owner.Evalue(750) / 2) / 100 * maxHolders;
1186 num = Mathf.Min(num, num2);
1190 num3 = num3 * (100 + 5 * (int)Mathf.Sqrt(Evalue(2812))) / 100;
1191 float num4 = 10f + Mathf.Sqrt(num) * 10f;
1194 num4 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2813))) / 100f;
1198 num4 = num4 * (float)(100 + num3) / 100f;
1200 num4 = Mathf.Min(num4, Mathf.Sqrt(Worth) / 15f + 5f);
1207 int num = CountGuests();
1210 float num2 = 10f + Mathf.Sqrt(num) * 10f;
1213 num2 += Mathf.Sqrt(CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt(Evalue(2815))) / 100f;
1215 num2 = Mathf.Min(num2, Mathf.Sqrt(
tourism) / 5f);
1222 GetIncome(ref incomeShop, ref statistics.
shop,
"getIncomeShop", tax:
false);
1223 GetIncome(ref incomeInn, ref statistics.
inn,
"getIncomeInn", tax:
true);
1224 GetIncome(ref incomeTourism, ref statistics.
tourism,
"getIncomeTourism", tax:
true);
1225 void GetIncome(ref
int n, ref
int stat,
string lang,
bool tax)
1227 if (tax && !IsTaxFree)
1255 thing = thing.
Split(1);
1266 elements.SetBase(
item.id, 1);
1275 elements.SetBase(2003, 1);
1276 elements.SetBase(4002, 1);
1277 elements.SetBase(2115, 1);
1278 elements.SetBase(2204, 1);
1279 elements.SetBase(2120, 1);
1292 elements.SetBase(element.
id, 1);
1296 elements.SetBase(2206, 10);
1299 elements.SetBase(2206, 15);
1313 ValidateUpgradePolicies();
1326 Element[] array = elements.dict.Values.ToArray();
1327 foreach (
Element element
in array)
1329 elements.SetBase(element.
id, 0);
1331 owner.landFeats =
null;
1333 owner.branch =
null;
1367 policies.
AddPolicy(globalPolicy, show:
false);
1379 if (traitCoreZone !=
null)
1381 SE.Play(
"godbless");
1411 elements.SetBase(2003, Mathf.Min((lv - 1) * 2 + 1, 10));
1412 elements.SetBase(2115, (lv - 1) * admin + 1);
1413 elements.SetBase(2204, (lv - 1) *
food + 1);
1414 elements.GetElement(2003).CheckLevelBonus(elements);
1415 ValidateUpgradePolicies();
1418 elements.SetBase(list[1].
id, 1);
1422 elements.SetBase(list[2].
id, 1);
1426 List<Element> list2 = elements.dict.Values.Where((
Element a) => a.
source.category ==
"landfeat" && a.
HasTag(
"network")).ToList();
1431 foreach (
Element item2
in list2)
1433 elements.Remove(item2.
id);
1436 Msg.
Say(
"upgrade_hearth", lv.ToString() ??
"", owner.
Name);
1437 LogRaw(
"upgrade_hearth".langGame(lv.ToString() ??
"", owner.
Name),
"Good");
1439 void Set(
int a,
int f)
1450 if (exp < GetNextExp())
1461 return lv * lv * lv * 1000;
1475 if (exp >= GetNextExp() && CanUpgrade())
1493 return "hearth1".lang();
1496 for (
int i = 1; i < a; i++)
1498 string text2 = (
"hearth" + (i + 1)).lang();
1499 if (!text2.IsEmpty())
1501 text = text + text2 + Environment.NewLine;
1504 return text.TrimEnd(Environment.NewLine.ToCharArray());
1509 elements.ModBase(ele, v);
1515 if (members.Contains(c))
1553 RefreshEfficiency();
1555 if (uidMaid == 0 && c.
id ==
"maid")
1580 c.memberType = type;
1581 c.c_wasInPcParty =
false;
1582 RefreshEfficiency();
1625 RefreshEfficiency();
1631 if (members.Count == 0)
1635 foreach (
Chara member
in members)
1639 return (
int)(num / (float)members.Count);
1644 foreach (
Chara member
in members)
1658 c.isRestrained =
false;
1664 RefreshEfficiency();
1671 foreach (
Chara member
in members)
1683 if (
EClass.
rnd(4) == 0 || members.Count == 0)
1687 return members.RandomItem().Name;
1693 foreach (
Chara member
in members)
1734 listRecruit.ForeachReverse(delegate(
HireInfo i)
1742 listRecruit.Remove(i);
1745 listRecruit.Clear();
1746 lastUpdateReqruit = -1;
1750 listRecruit.ForeachReverse(delegate(
HireInfo i)
1754 if (!i.chara.IsGlobal)
1758 listRecruit.Remove(i);
1767 int num = 2 + (int)Mathf.Sqrt(Evalue(2513)) / 2;
1768 int num2 =
EClass.
rnd(3 + (
int)Mathf.Sqrt(Evalue(2513)) / 2) + num - listRecruit.Count;
1774 for (
int num3 = 0; num3 < num2; num3++)
1800 listRecruit.Add(hireInfo);
1805 listRecruit.ForeachReverse(delegate(
HireInfo i)
1809 listRecruit.Remove(i);
1839 if (
item.chara == c)
1859 int num = 10 + Evalue(2203);
1860 if (Evalue(2701) > 0)
1862 num += 10 + (int)Mathf.Sqrt(Evalue(2701));
1864 if (Evalue(2702) > 0)
1866 num -= 10 + (int)Mathf.Sqrt(Evalue(2702));
1874 foreach (
Element value
in elements.dict.Values)
1876 if (value.
source.category ==
"culture")
1878 num += GetHearthIncome(value.
source.alias);
1887 foreach (KeyValuePair<int, Element>
item in elements.dict)
1889 if (
item.Value.source.aliasParent ==
id)
1894 return 0.2f * (float)num;
1905 return valueWithoutLink;
1908 public string Log(
string idLang,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null,
string ref4 =
null)
1910 Msg.alwaysVisible =
true;
1914 public string Log(
string idLang,
Card c1,
Card c2,
string ref1 =
null,
string ref2 =
null)
1916 Msg.alwaysVisible =
true;
1920 public string Log(
string idLang,
Card c1,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null)
1922 Msg.alwaysVisible =
true;
1926 public string LogRaw(
string text,
string col =
null)
1928 log.
Add(text, col.IsEmpty() ?
null : col);
1929 Msg.alwaysVisible =
false;
static List< Thing > ListThingsToClean(List< Thing > result)
static void Pray(Chara c, bool silent=false)
void Add(Act a, string s="")
GlobalCharaList globalCharas
List< Thing > listPackage
void SetTier(int a, bool setTraits=true)
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
void PurgeDuplicateArtifact(Thing af)
ElementContainerCard elements
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
void SetInt(string id, int value=0)
Thing AddThing(string id, int lv=-1)
virtual void SetBlessedState(BlessedState s)
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Window.SaveData GetWindowSaveData()
Thing MakeMilk(bool effect=true, int num=1, bool addToZone=true, BlessedState? state=null)
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Thing Add(string id, int num=1, int lv=1)
SourceCategory.Row category
void ModNum(int a, bool notify=true)
int GetInt(string id, int? defaultInt=null)
bool HasElement(int ele, bool includeNagative=false)
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=true, int fertChance=20, BlessedState? state=null)
static Chara CreateWealthy(int lv=-1)
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
override bool IsAliveInCurrentZone
Hostility OriginalHostility
void TryPutShared(Thing t, List< Thing > containers=null, bool dropIfFail=true)
void CureHost(CureType type, int p=100, BlessedState state=BlessedState.Normal)
void RefreshWorkElements(ElementContainer parent=null)
bool HasCondition(string alias)
Chara SetHomeZone(Zone zone)
Chara SetFaction(Faction f)
Chara SetGlobal(Zone _home, int x, int z)
bool CanEat(Thing t, bool shouldEat=false)
override bool IsDeadOrSleeping
List< Hobby > ListHobbies(bool useMemberType=true)
FactionMemberType memberType
List< Hobby > ListWorks(bool useMemberType=true)
void Revive(Point p=null, bool msg=false)
void ClearBed(Map map=null)
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
static void MakeDish(Thing food, int lv, Chara crafter=null, int seed=-1)
int GetRaw(int offsetHours=0)
static int curve(long _a, int start, int step, int rate=75)
static SourceManager sources
static int rndHalf(int a)
void OnRemoveMember(Chara c)
void OnAddMemeber(Chara c)
Element ModBase(int ele, int v)
Element SetBase(string alias, int v, int potential=0)
int GetRoadDist(int gx, int gy)
void SetOwner(FactionBranch _branch)
int GetProductBonus(Chara c)
string Log(string idLang, Card c1, Card c2, string ref1=null, string ref2=null)
ExpeditionManager expeditions
void DailyOutcome(VirtualDate date)
HappinessManager happiness
string Log(string idLang, Card c1, string ref1=null, string ref2=null, string ref3=null)
void RemoveRecruit(Chara c)
void OnSimulateMonth(VirtualDate date)
int CountMembers(FactionMemberType type, bool onlyAlive=false)
void ChangeMemberType(Chara c, FactionMemberType type)
void AddFeat(int ele, int v)
Statistics lastStatistics
ResearchManager researches
string GetHearthHint(int a)
int GetTechUpgradeCost(Element e)
void OnSimulateDay(VirtualDate date)
int GetNextExp(int _lv=-1)
float GetHearthIncome(string id)
void GenerateGarbage(VirtualDate date)
void RemoveMemeber(Chara c)
void UpdateReqruits(bool clear=false)
void OnSimulateHour(VirtualDate date)
List< HireInfo > listRecruit
string LogRaw(string text, string col=null)
void PutInMailBox(Thing t, bool outside=false, bool install=true)
void ReceivePackages(VirtualDate date)
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
HomeResourceManager resources
int GetHappiness(FactionMemberType type)
ElementContainerZone elements
void BanishMember(Chara c, bool skipMsg=false)
void ValidateUpgradePolicies()
FactionBranch FindBranch(Chara c)
ElementContainerFaction charaElements
bool IsGlobalPolicyActive(int id)
ElementContainerZone elements
HashSet< int > globalPolicies
void RemoveReserve(Chara c)
void SetGlobalPolicyActive(int id, bool active)
ReligionManager religions
void SetOwner(FactionBranch _owner)
int GetEfficiency(Chara c)
void SetOwner(FactionBranch _owner)
static string _currency(object a, string IDCurrency)
void ForeachCell(Action< Cell > action)
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Thing FindThing(Func< Thing, bool > func)
void SetDecal(int x, int z, int id=0, int amount=1, bool refresh=true)
void OnSimulateHour(VirtualDate date)
void SetOwner(FactionBranch _branch)
static string GetRawText(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
void AddMemeber(Chara c, bool showMsg=false)
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Point Clamp(bool useBounds=false)
Thing FindThing(Func< Thing, bool > func)
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
void AddPolicy(string id)
bool IsActive(int id, int days=-1)
void OnSimulateHour(VirtualDate date)
void SetOwner(FactionBranch _owner)
int GetNum(string id, bool onlyShared=false)
SourceReligion.Row source
void SetOwner(FactionBranch _branch)
static SpawnSetting HomeWild(int lv)
static SpawnSetting HomeEnemy(int lv)
static SpawnSetting HomeGuest(int lv)
static void GetAchievement(ID_Achievement id)
static bool HasDLC(ID_DLC id)
void OnUpdateRecruit(FactionBranch branch)
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
static Thing CreateTreasure(string id, int lv, TreasureType type=TreasureType.Map)
static Thing CreateFromTag(string idTag, int lv=-1)
static Thing CreateFromCategory(string idCat, int lv=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
override string GetName(NameStyle style, int _num=-1)
virtual bool IsCountAsResident
static Chara Incubate(Thing egg, Point pos, Card incubator=null)
TraitSet GetTraitSet(Type t)
virtual bool RemoveGlobalOnBanish
static void Reserve(string idStep, Action onBeforePlay=null)
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)
void SendPackage(Thing p)
List< Chara > ListMinions(Chara c)
Thing TryGetThingFromSharedContainer(Func< Thing, bool > func)
ElementContainerZone elements
Thing FindSharedContainer(Thing t, List< Thing > containers=null, bool sharedOnly=true)
Chara SpawnMob(string id, Point pos=null)
bool TryAddThing(Thing target, Point p, bool destroyIfFail=false)
List< Element > ListLandFeats()
Card AddCard(Card t, Point point)
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)