12 public int GetNextExp(
int _lv = -1)
18 return _lv * _lv * 100 + 100;
22 public int Evalue(
int ele)
25 if (row.category ==
"policy")
27 return this.policies.GetValue(ele);
29 if (this.HasNetwork && row.tag.Contains(
"network"))
31 return EClass.pc.faction.elements.Value(ele) + this.elements.Value(ele);
33 return this.elements.Value(ele);
42 return this.resources.money.value;
52 return this.resources.worth.value;
58 public int NumHeirloom
62 return 4 + this.Evalue(2120);
72 return 4 + this.Evalue(2115) + this.Evalue(3900) * 5 + this.Evalue(3709) * this.lv;
78 public int MaxPopulation
82 return 5 + this.Evalue(2204);
92 return ((
int)(Mathf.Sqrt((
float)(
EClass._map.bounds.Width *
EClass._map.bounds.Height)) * 3f) +
this.Evalue(2200) * 5) * (100 + this.Evalue(3700) * 25) / 100;
102 return Mathf.Max(1, this.lv * 4 +
EClass.scene.elomap.GetRoadDist(
EClass._zone.x,
EClass._zone.y) - 4);
112 return Mathf.Max(1, this.ContentLV - (
int)Mathf.Sqrt((
float)
this.Evalue(2704)) * 2 + (
int)Mathf.Sqrt((
float)
this.Evalue(2706)) * 4);
118 public bool HasNetwork
128 public bool IsTaxFree
132 return this.policies.IsActive(2514, -1);
137 public int GetProductBonus(
Chara c)
139 if (c.isDead || c.IsPCParty)
143 return Mathf.Max(1, (90 + this.Evalue(2116) / 2) * this.efficiency / 100);
147 public void RefreshEfficiency()
150 int num2 = this.CountMembers(FactionMemberType.Default,
false);
151 if (num2 > this.MaxPopulation)
153 num -= (num2 - this.MaxPopulation) * (2000 / (100 + 20 * (
int)Mathf.Sqrt((
float)
this.Evalue(2207))));
155 this.efficiency = num;
160 public string RankText
164 return (0.01f * (
float)this.exp + (
float)this.rank).ToString(
"F2");
174 return this.lv.ToString() +
" (" + (100f * (float)this.exp / (float)this.GetNextExp(-1)).ToString(
"F1") +
")";
180 public bool IsStartBranch
184 return this.owner.id ==
"startSite";
194 return this.owner.elements;
199 public void Abandon()
204 public void OnCreate(
Zone zone)
207 this.stash =
ThingGen.Create(
"container_salary", -1, -1);
208 this.stash.RemoveThings();
209 this.faith =
EClass.game.religions.Eyth;
210 this.dateFound =
EClass.world.date.GetRaw(0);
214 public void SetOwner(
Zone zone)
217 this.resources.SetOwner(
this);
218 this.researches.SetOwner(
this);
219 this.policies.SetOwner(
this);
220 this.happiness.SetOwner(
this);
221 this.expeditions.SetOwner(
this);
222 this.meetings.SetOwner(
this);
223 foreach (
Chara chara
in EClass.game.cards.globalCharas.Values)
227 Debug.LogError(
"exception: c==null");
229 else if (
EClass.pc ==
null)
231 Debug.LogError(
"exception: pc==null");
233 else if (chara.homeZone == zone && chara.faction ==
EClass.pc.faction)
235 this.members.Add(chara);
236 EClass.pc.faction.charaElements.OnAddMemeber(chara);
239 this.RefreshEfficiency();
243 public void OnActivateZone()
246 this.incomeTourism = 0;
247 foreach (
Chara chara
in this.members)
249 if (chara.IsAliveInCurrentZone && !chara.pos.IsInBounds)
251 chara.MoveImmediate(
EClass._map.GetCenterPos().GetNearestPoint(
false,
true,
true,
false),
true,
true);
253 chara.RefreshWorkElements(this.elements);
255 this.ValidateUpgradePolicies();
259 public void OnAfterSimulate()
261 if (!
EClass.game.isLoading)
263 this.GetDailyIncome();
268 public void OnUnloadMap()
275 int num = this.CountMembers(FactionMemberType.Default,
true);
276 int starveChance = Mathf.Max(num - this.MaxPopulation, 0);
277 this.members.ForeachReverse(delegate(
Chara c)
279 if (c.IsPCParty || !c.IsAliveInCurrentZone || c.noMove)
284 if (
EClass.rnd(24 *
this.members.Count) < starveChance)
286 starveChance = starveChance;
293 if (!date.IsRealTime &&
EClass.rnd(3) != 0 && c.memberType == FactionMemberType.Default)
296 if (c.hunger.GetPhase() >= 3)
298 Thing meal = this.GetMeal(c);
309 this.expeditions.OnSimulateHour();
310 this.meetings.OnSimulateHour(date);
311 this.policies.OnSimulateHour(date);
312 int num2 = this.Evalue(3707);
313 int num3 = this.Evalue(3705) + this.Evalue(3710) * 2;
314 int num4 = 4 + num3 * 4;
315 int num5 = Mathf.Max(1, (100 + this.Evalue(2205) * 5 + this.Evalue(3703) * 100 - num2 * 80) / 10);
317 if (this.policies.IsActive(2709, -1))
321 if (
EClass.world.date.IsNight)
325 if ((date.IsRealTime || num2 > 0) && !
EClass.debug.enable &&
EClass.rnd(num5) == 0 && !
EClass.pc.IsDeadOrSleeping &&
EClass._map.CountHostile() < num4)
327 int num6 = 1 +
EClass.rnd(num2 + num3 + 1);
328 for (
int i = 0; i < num6; i++)
333 if ((date.IsRealTime || num2 == 0) &&
EClass.rnd(a) == 0 &&
EClass._map.CountWildAnimal() < num4)
337 if (
EClass.rnd(5) == 0 &&
this.policies.IsActive(2810, -1))
339 int num7 = 3 + this.lv + this.Evalue(2206) / 5 + this.Evalue(3702) * 2 + this.Evalue(2202) / 2;
340 num7 = num7 * (100 + this.Evalue(3702) * 20 + this.Evalue(2206)) / 100;
341 num7 = num7 * (100 + (int)Mathf.Sqrt((
float)this.Evalue(2811)) * 3) / 100;
342 if (
EClass._map.CountGuest() < num7)
345 if (this.policies.IsActive(2822, -1) && Mathf.Sqrt((
float)(
this.Evalue(2822) / 2)) + 5f >= (
float)
EClass.rnd(100))
347 chara =
CharaGen.CreateWealthy(this.ContentLV);
348 EClass._zone.AddCard(chara,
EClass._zone.GetSpawnPos(SpawnPosition.Random, 100) ??
EClass._map.GetRandomSurface(
false,
true,
false));
354 if (chara !=
null && (chara.id ==
"nun_mother" || chara.id ==
"prostitute") &&
this.policies.IsActive(2710, -1))
361 this.statistics.visitor++;
362 chara.memberType = FactionMemberType.Guest;
363 chara.SetInt(34,
EClass.world.date.GetRaw(0));
364 chara.c_allowance = chara.LV * 100;
367 chara.c_allowance *= 10;
371 Msg.Say(
"guestArrive", chara.Name,
null,
null,
null);
375 chara.TryAssignBed();
382 if (chara2.memberType == FactionMemberType.Guest && ((chara2.c_allowance <= 0 &&
EClass.rnd(2) == 0) || chara2.GetInt(34,
null) + 10080 <
EClass.world.date.GetRaw(0)))
384 if (!chara2.IsGlobal)
388 chara2.ClearBed(
null);
394 this.DailyOutcome(date);
395 this.GenerateGarbage(date);
396 if (!date.IsRealTime)
400 this.CalcTourismIncome();
401 this.CalcInnIncome();
404 this.GetDailyIncome();
407 if (!
EClass.player.simulatingZone && date.hour == 6)
409 this.ReceivePackages(date);
411 if (!date.IsRealTime && date.hour % 8 == 0)
414 where c.memberType == FactionMemberType.Guest
415 select c).ToList<
Chara>())
417 for (
int j = 0; j < 3; j++)
431 thing.ModNum(-1,
true);
434 chara3.PlaySound(
"egg", 1f,
true);
441 this.resources.SetDirty();
445 public void AutoClean()
447 foreach (
Chara chara
in this.members)
449 if (!chara.IsPCParty && chara.ExistsOnMap && chara.memberType == FactionMemberType.Default)
451 Hobby hobby = chara.GetWork(
"Clean") ?? chara.GetWork(
"Chore");
454 int num = (5 +
EClass.rnd(5)) * hobby.GetEfficiency(chara) / 100;
455 for (
int i = 0; i < num; i++)
458 if (thingToClean ==
null)
462 EClass._zone.TryAddThingInSharedContainer(thingToClean,
null,
true,
false,
null,
true);
472 if (this.owner ==
null || this.owner.mainFaction !=
EClass.Home)
476 this.researches.OnSimulateDay();
477 this.resources.OnSimulateDay();
478 this.happiness.OnSimulateDay();
479 if (!date.IsRealTime)
481 BranchMap branchMap = date.GetBranchMap();
482 foreach (
Chara chara
in this.members)
484 if (!chara.IsPCParty && chara.memberType != FactionMemberType.Livestock && !chara.faith.IsEyth && !chara.c_isPrayed && branchMap.altarMap.Contains(chara.faith.id))
490 foreach (
Chara chara2
in this.members)
492 chara2.c_isPrayed =
false;
493 chara2.c_isTrained =
false;
498 public void OnAdvanceDay()
501 foreach (
Chara chara
in this.members)
503 if (!chara.IsPC && !chara.isDead && chara.memberType == FactionMemberType.Default)
509 if (chara.GetWork(
"Pioneer") !=
null)
521 this.lastStatistics = this.statistics;
529 CS$<>8__locals1.<>4__this =
this;
530 CS$<>8__locals1.sortChance = 40 + this.GetCivility();
531 CS$<>8__locals1.unsortedCount = 0;
532 foreach (
Chara chara
in this.members)
534 if (!chara.IsPCParty && chara.ExistsOnMap)
536 Hobby hobby = chara.GetWork(
"Clean") ?? chara.GetWork(
"Chore");
539 CS$<>8__locals1.sortChance += 20 * hobby.GetEfficiency(chara) / 100;
543 int num = this.Evalue(2702);
545 for (
int i = 0; i < num2; i++)
547 if (num == 0 ||
EClass.rnd(num + (
EClass.debug.enable ? 100000 : 10)) == 0)
549 this.<GenerateGarbage>g__Generate|72_0(
null, ref CS$<>8__locals1);
552 foreach (
Chara chara2
in this.members)
554 if (!chara2.IsPCParty && chara2.ExistsOnMap && (num == 0 ||
EClass.rnd(num + (
EClass.debug.enable ? 100000 : 10)) == 0))
556 this.<GenerateGarbage>g__Generate|72_0(chara2, ref CS$<>8__locals1);
562 public bool TryTrash(
Thing t)
569 else if (!t.isFireproof)
588 if (
EClass.player.simulatingZone)
592 List<Thing> listPackage =
EClass.game.cards.listPackage;
593 if (
EClass.player.stats.days >= 2 && !
EClass.player.flags.elinGift &&
Steam.HasDLC(ID_DLC.BackerReward))
595 listPackage.Add(
ThingGen.Create(
"gift", -1, -1));
596 EClass.player.flags.elinGift =
true;
598 if (listPackage.Count == 0)
604 foreach (
Thing thing
in listPackage)
606 if (thing.id !=
"bill")
610 this.PutInMailBox(thing, thing.id ==
"cardboard_box" || thing.id ==
"gift",
true);
611 WidgetPopText.Say(
"popDeliver".lang(thing.Name,
null,
null,
null,
null), FontColor.Default,
null);
613 Msg.Say(
"deliver_arrive", num.ToString() ??
"",
null,
null,
null);
621 CS$<>8__locals1.<>4__this =
this;
622 CS$<>8__locals1.date = date;
624 foreach (
Chara m
in this.members)
627 CS$<>8__locals2.m = m;
628 if (!CS$<>8__locals2.m.IsPCParty && CS$<>8__locals2.m.ExistsOnMap)
630 CS$<>8__locals2.m.RefreshWorkElements(this.elements);
631 if (CS$<>8__locals2.m.memberType == FactionMemberType.Livestock)
635 thing = (
EClass._map.Stocked.Find(
"pasture", -1, -1,
true) ??
EClass._map.Installed.Find(
"pasture", -1, -1,
false));
639 if (CS$<>8__locals2.m.race.breeder >=
EClass.rnd(2500 - (
int)Mathf.Sqrt((
float)(
this.Evalue(2827) * 100))))
643 Thing t = CS$<>8__locals2.m.MakeEgg(CS$<>8__locals1.date.IsRealTime, 1, CS$<>8__locals1.date.IsRealTime);
644 if (!CS$<>8__locals1.date.IsRealTime)
646 CS$<>8__locals2.m.TryPutShared(t,
null,
true);
651 Thing t2 = CS$<>8__locals2.m.MakeMilk(CS$<>8__locals1.date.IsRealTime, 1, CS$<>8__locals1.date.IsRealTime);
652 if (!CS$<>8__locals1.date.IsRealTime)
654 CS$<>8__locals2.m.TryPutShared(t2,
null,
true);
658 if (CS$<>8__locals2.m.HaveFur())
660 Chara m2 = CS$<>8__locals2.m;
661 int c_fur = m2.c_fur;
662 m2.c_fur = c_fur + 1;
664 thing.ModNum(-1,
true);
665 if (thing.isDestroyed || thing.Num == 0)
673 foreach (
Hobby h
in CS$<>8__locals2.m.ListHobbies(
true))
675 CS$<>8__locals1.<DailyOutcome>g__GetOutcome|1(h, ref CS$<>8__locals2);
677 foreach (
Hobby h2
in CS$<>8__locals2.m.ListWorks(
true))
679 CS$<>8__locals1.<DailyOutcome>g__GetOutcome|1(h2, ref CS$<>8__locals2);
684 int soilCost =
EClass._zone.GetSoilCost();
685 int num = Mathf.Min(100, 70 + (this.MaxSoil - soilCost));
686 CS$<>8__locals1.flower = 5;
687 CS$<>8__locals1.lv = 1;
688 EClass._map.bounds.ForeachCell(delegate(
Cell cell)
690 if (cell.obj != 0 && cell.sourceObj.tag.Contains(
"flower"))
692 PlantData plantData = cell.TryGetPlant();
694 if (plantData !=
null && plantData.seed !=
null)
696 CS$<>8__locals1.lv += plantData.seed.encLV + 1;
700 flower = CS$<>8__locals1.lv;
701 CS$<>8__locals1.lv = flower + 1;
703 flower = CS$<>8__locals1.flower;
704 CS$<>8__locals1.flower = flower + 1;
707 CS$<>8__locals1.lv /= CS$<>8__locals1.flower;
711 if (thing2.IsInstalled && thing2.trait is
TraitBeekeep && !thing2.things.IsFull(0))
713 CS$<>8__locals1.flower -= 3 +
EClass.rnd(5 + num2 * 4);
715 if (CS$<>8__locals1.flower < 0)
719 if (
EClass.rnd(100) <= num)
722 thing3.SetEncLv(CS$<>8__locals1.lv / 10);
723 thing3.elements.SetBase(2,
EClass.curve(CS$<>8__locals1.lv, 50, 10, 80), 0);
724 thing2.AddThing(thing3,
true, -1, -1);
731 public void PutInMailBox(
Thing t,
bool outside =
false,
bool install =
true)
735 Thing mailBox = this.GetMailBox();
742 Point mailBoxPos = this.GetMailBoxPos();
743 EClass._zone.AddCard(t, mailBoxPos);
751 public Thing GetMailBox()
757 public Point GetMailBoxPos()
759 Thing thing = this.GetMailBox();
766 return thing.pos.GetNearestPoint(
false,
true,
false,
true).Clamp(
true);
768 return EClass._map.GetCenterPos();
772 public int GetResidentTax()
774 if (!this.policies.IsActive(2512, 30))
779 int num2 = this.policies.IsActive(2500, 30) ? this.Evalue(2500) : 0;
780 int num3 = this.policies.IsActive(2501, 30) ? this.Evalue(2501) : 0;
781 int num4 = 50 + (int)Mathf.Sqrt((
float)
this.Evalue(2512)) * 5;
782 foreach (
Chara chara
in this.members)
786 bool isWealthy = chara.IsWealthy;
788 foreach (
Hobby hobby
in chara.ListWorks(
true).Concat(chara.ListHobbies(
true)))
790 int num6 = hobby.source.tax * 100 / 100;
796 int num7 = ((isWealthy ? 50 : 10) + chara.LV * 2) * num5 / 100 * num4 / 100;
797 if (isWealthy && num2 > 0)
799 num7 = num7 * (150 + (int)Mathf.Sqrt((
float)num2) * 5) / 100;
803 num7 += (80 + (int)Mathf.Sqrt((
float)num3) * 5) * chara.faith.source.tax / 100;
805 num7 = num7 * this.efficiency / 100;
809 this.Log(
"bTax", num7.ToString() ??
"", chara.Name,
null,
null);
813 this.statistics.tax += num;
818 public void CalcInnIncome()
820 int num = this.CountGuests();
829 if (thing.IsInstalled)
832 if (traitBed !=
null && traitBed.owner.c_bedType == BedType.guest)
835 num3 += traitBed.owner.LV;
839 num = Mathf.Min(num, num2);
845 num3 = num3 * (100 + 5 * (int)Mathf.Sqrt((
float)this.Evalue(2812))) / 100;
846 float num4 = 10f + Mathf.Sqrt((
float)num) * 10f;
847 if (this.policies.IsActive(2813, -1))
849 num4 += Mathf.Sqrt((
float)this.CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt((
float)this.Evalue(2813))) / 100f;
851 if (this.policies.IsActive(2812, -1))
853 num4 = num4 * (float)(100 + num3) / 100f;
855 num4 = Mathf.Min(num4, Mathf.Sqrt((
float)
this.Worth) / 15f + 5f);
856 this.incomeInn +=
EClass.rndHalf((
int)num4) +
EClass.rndHalf((
int)num4);
860 public void CalcTourismIncome()
862 int num = this.CountGuests();
867 float num2 = 10f + Mathf.Sqrt((
float)num) * 10f;
868 if (this.policies.IsActive(2815, -1))
870 num2 += Mathf.Sqrt((
float)this.CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt((
float)this.Evalue(2815))) / 100f;
872 num2 = Mathf.Min(num2, Mathf.Sqrt((
float)
this.tourism) / 5f);
873 this.incomeTourism +=
EClass.rndHalf((
int)num2) +
EClass.rndHalf((
int)num2);
877 public void GetDailyIncome()
879 this.<GetDailyIncome>g__GetIncome|82_0(ref this.incomeShop, ref this.statistics.shop,
"getIncomeShop",
false);
880 this.<GetDailyIncome>g__GetIncome|82_0(ref this.incomeInn, ref this.statistics.inn,
"getIncomeInn",
true);
881 this.<GetDailyIncome>g__GetIncome|82_0(ref this.incomeTourism, ref this.statistics.tourism,
"getIncomeTourism",
true);
887 Thing thing =
EClass._zone.TryGetThingFromSharedContainer((
Thing t) => c.CanEat(t,
true));
890 thing = thing.Split(1);
896 public void OnClaimZone()
898 if (
EClass.debug.allHomeSkill)
901 where a.category ==
"tech"
904 this.elements.SetBase(row.id, 1, 0);
906 using (IEnumerator<
SourceElement.
Row> enumerator = (from a in EClass.sources.elements.rows
907 where a.category ==
"policy" && !a.tag.Contains(
"hidden")
908 select a).GetEnumerator())
910 while (enumerator.MoveNext())
913 this.policies.AddPolicy(row2.id,
true);
918 this.elements.SetBase(2003, 1, 0);
919 this.elements.SetBase(4002, 1, 0);
920 this.elements.SetBase(2115, 1, 0);
921 this.elements.SetBase(2204, 1, 0);
922 this.elements.SetBase(2120, 1, 0);
923 this.policies.AddPolicy(2512,
true);
924 this.policies.AddPolicy(2702,
true);
925 this.policies.AddPolicy(2703,
true);
926 this.policies.AddPolicy(2516,
true);
927 this.policies.AddPolicy(2515,
true);
928 this.policies.AddPolicy(2514,
true);
930 if (
EClass.pc.faction.CountTaxFreeLand() < 3)
932 this.policies.Activate(2514);
935 this.elements.SetBase(element.id, 1, 0);
941 this.elements.SetBase(2206, 10, 0);
946 this.elements.SetBase(2206, 15, 0);
948 this.AddMemeber(
EClass.pc);
949 if (
EClass.debug.allPolicy)
952 where a.category ==
"policy"
955 this.policies.AddPolicy(row3.id,
true);
958 this.ValidateUpgradePolicies();
962 public void OnUnclaimZone()
967 public void ValidateUpgradePolicies()
971 if (!this.policies.HasPolicy(2705))
973 this.policies.AddPolicy(2705,
true);
974 EClass.pc.faction.SetGlobalPolicyActive(2705,
EClass.pc.faction.IsGlobalPolicyActive(2705));
976 if (!this.policies.HasPolicy(2708))
978 this.policies.AddPolicy(2708,
true);
979 EClass.pc.faction.SetGlobalPolicyActive(2708,
EClass.pc.faction.IsGlobalPolicyActive(2708));
981 if (!this.policies.HasPolicy(2707))
983 this.policies.AddPolicy(2707,
true);
985 if (!this.policies.HasPolicy(2709))
987 this.policies.AddPolicy(2709,
true);
990 foreach (
int id in EClass.pc.faction.globalPolicies)
992 if (!this.policies.HasPolicy(
id))
994 this.policies.AddPolicy(
id,
false);
995 EClass.pc.faction.SetGlobalPolicyActive(
id,
EClass.pc.faction.IsGlobalPolicyActive(
id));
1001 public void Upgrade()
1003 List<Element> list = this.owner.ListLandFeats();
1004 if (this.owner.IsActiveZone)
1007 if (traitCoreZone !=
null)
1009 SE.Play(
"godbless");
1010 traitCoreZone.owner.PlayEffect(
"aura_heaven",
true, 0f,
default(Vector3));
1016 CS$<>8__locals1.admin = 4;
1017 CS$<>8__locals1.food = 4;
1018 FactionBranch.<Upgrade>g__Set|87_0(4, 3, ref CS$<>8__locals1);
1019 int id = list[0].id;
1025 FactionBranch.<Upgrade>g__Set|87_0(5, 3, ref CS$<>8__locals1);
1028 FactionBranch.<Upgrade>g__Set|87_0(4, 4, ref CS$<>8__locals1);
1031 FactionBranch.<Upgrade>g__Set|87_0(5, 2, ref CS$<>8__locals1);
1034 FactionBranch.<Upgrade>g__Set|87_0(6, 2, ref CS$<>8__locals1);
1037 FactionBranch.<Upgrade>g__Set|87_0(4, 3, ref CS$<>8__locals1);
1043 FactionBranch.<Upgrade>g__Set|87_0(5, 3, ref CS$<>8__locals1);
1045 this.elements.SetBase(2003, Mathf.Min((
this.lv - 1) * 2 + 1, 10), 0);
1046 this.elements.SetBase(2115, (this.lv - 1) * CS$<>8__locals1.admin + 1, 0);
1047 this.elements.SetBase(2204, (this.lv - 1) * CS$<>8__locals1.food + 1, 0);
1048 this.elements.GetElement(2003).CheckLevelBonus(this.elements,
null);
1049 this.ValidateUpgradePolicies();
1052 this.elements.SetBase(list[1].
id, 1, 0);
1056 this.elements.SetBase(list[2].
id, 1, 0);
1060 List<Element> list2 = (from a in this.elements.dict.Values
1061 where a.source.category ==
"landfeat" && a.HasTag(
"network")
1063 foreach (
Element element
in list2)
1065 EClass.pc.faction.elements.ModBase(element.id, element.Value);
1067 foreach (
Element element2
in list2)
1069 this.elements.Remove(element2.id);
1072 Msg.Say(
"upgrade_hearth", this.lv.ToString() ??
"",
this.owner.Name,
null,
null);
1073 this.LogRaw(
"upgrade_hearth".langGame(this.lv.ToString() ??
"",
this.owner.Name,
null,
null),
"Good");
1088 public bool CanUpgrade()
1090 return this.lv < this.MaxLv && (this.exp >= this.GetNextExp(-1) ||
EClass.debug.enable);
1094 public int GetUpgradeCost()
1096 return this.lv * this.lv * this.lv * 1000;
1100 public void ModExp(
int a)
1102 if (this.policies.IsActive(2515, -1))
1106 if (this.policies.IsActive(2516, -1))
1108 a = a * 150 / 100 +
EClass.rnd(2);
1111 if (this.exp >= this.GetNextExp(-1) && this.CanUpgrade())
1113 if (
EClass.core.version.demo &&
this.lv >= 3)
1116 Msg.Say(
"demoLimit2");
1124 public string GetHearthHint(
int a)
1128 return "hearth1".lang();
1131 for (
int i = 1; i < a; i++)
1133 string text2 = (
"hearth" + (i + 1).ToString()).lang();
1134 if (!text2.IsEmpty())
1136 text = text + text2 + Environment.NewLine;
1139 return text.TrimEnd(Environment.NewLine.ToCharArray());
1143 public void AddFeat(
int ele,
int v)
1145 this.elements.ModBase(ele, v);
1146 WidgetPopText.Say(
"rewardElement".lang(
EClass.sources.elements.map[ele].GetName(),
null,
null,
null,
null), FontColor.Default,
null);
1150 public void AddMemeber(
Chara c)
1152 if (this.members.Contains(c))
1156 if (c.homeBranch !=
null)
1158 c.homeBranch.RemoveMemeber(c);
1160 EClass.Home.RemoveReserve(c);
1162 c.SetFaction(
EClass.Home);
1163 c.SetHomeZone(this.owner);
1164 if (c.OriginalHostility <= Hostility.Ally)
1166 c.c_originalHostility = Hostility.Ally;
1168 c.hostility = Hostility.Ally;
1171 c.memberType = FactionMemberType.Default;
1172 this.members.Add(c);
1173 EClass.pc.faction.charaElements.OnAddMemeber(c);
1174 c.RefreshWorkElements(this.elements);
1175 if (this.uidMaid == 0 && c.id ==
"maid")
1177 this.uidMaid = c.uid;
1179 this.RefreshEfficiency();
1183 public void ChangeMemberType(
Chara c, FactionMemberType type)
1186 c.memberType = type;
1187 c.RefreshWorkElements(this.elements);
1188 this.policies.Validate();
1192 public void BanishMember(
Chara c,
bool sell =
false)
1194 this.RemoveMemeber(c);
1197 Msg.Say(
"banish", c,
EClass._zone.Name,
null,
null);
1205 if (c_uniqueData !=
null)
1207 Debug.Log(
string.Concat(
new string[]
1209 c_uniqueData.uidZone.ToString(),
1211 EClass.game.spatials.map.ContainsKey(c_uniqueData.uidZone).ToString(),
1213 c_uniqueData.x.ToString(),
1215 c_uniqueData.y.ToString()
1218 if (c_uniqueData !=
null &&
EClass.game.spatials.map.ContainsKey(c_uniqueData.uidZone))
1220 c.MoveHome(
EClass.game.spatials.map[c_uniqueData.uidZone] as
Zone, c_uniqueData.x, c_uniqueData.y);
1223 Zone zone =
EClass.game.spatials.Find(
"somewhere");
1226 zone =
EClass.world.region.ListTowns().RandomItem<
Zone>();
1227 c.SetHomeZone(zone);
1233 public void RemoveMemeber(
Chara c)
1236 if (c.currentZone !=
null && c.currentZone.map !=
null)
1238 c.ClearBed(c.currentZone.map);
1239 c.currentZone.map.props.sales.Remove(c);
1241 c.RefreshWorkElements(
null);
1243 this.members.Remove(c);
1244 EClass.pc.faction.charaElements.OnRemoveMember(c);
1245 c.SetFaction(
EClass.game.factions.Wilds);
1246 this.policies.Validate();
1247 this.RefreshEfficiency();
1251 public int GetHappiness(FactionMemberType type)
1254 if (this.members.Count == 0)
1258 foreach (
Chara chara
in this.members)
1260 num += (float)chara.happiness;
1262 return (
int)(num / (float)this.members.Count);
1266 public bool IsAllDead()
1268 using (List<Chara>.Enumerator enumerator = this.members.GetEnumerator())
1270 while (enumerator.MoveNext())
1272 if (!enumerator.Current.isDead)
1282 public void Recruit(
Chara c)
1284 this.RemoveRecruit(c);
1286 if (c.currentZone !=
EClass._zone && !c.isDead)
1289 Point point = ((random !=
null) ? random.GetPoint() :
null) ??
EClass.pc.pos;
1290 EClass._zone.AddCard(c, point);
1292 c.RefreshWorkElements(
null);
1293 this.RefreshEfficiency();
1294 Msg.Say(
"hire".langGame(c.Name,
null,
null,
null));
1298 public Chara GetMaid()
1300 foreach (
Chara chara
in this.members)
1302 if (chara.IsAliveInCurrentZone && chara.IsMaid)
1311 public string GetRandomName()
1313 if (
EClass.rnd(4) == 0 ||
this.members.Count == 0)
1315 return EClass.player.title;
1317 return this.members.RandomItem<
Chara>().Name;
1321 public int CountMembers(FactionMemberType type,
bool onlyAlive =
false)
1324 foreach (
Chara chara
in this.members)
1326 if (chara.memberType == type && !chara.IsUnique && (!onlyAlive || !chara.isDead))
1335 public int CountGuests()
1338 using (List<Chara>.Enumerator enumerator =
EClass._map.charas.GetEnumerator())
1340 while (enumerator.MoveNext())
1342 if (enumerator.Current.memberType == FactionMemberType.Guest)
1352 public int CountWealthyGuests()
1357 if (chara.memberType == FactionMemberType.Guest && chara.IsWealthy)
1366 public void UpdateReqruits(
bool clear =
false)
1368 this.resources.Refresh();
1371 this.listRecruit.ForeachReverse(delegate(
HireInfo i)
1373 if (!i.chara.IsGlobal)
1377 if (i.chara.isDestroyed)
1379 this.listRecruit.Remove(i);
1382 this.listRecruit.Clear();
1383 this.lastUpdateReqruit = -1;
1387 this.listRecruit.ForeachReverse(delegate(
HireInfo i)
1391 if (!i.chara.IsGlobal)
1395 this.listRecruit.Remove(i);
1399 if (this.lastUpdateReqruit ==
EClass.world.date.day)
1403 this.lastUpdateReqruit =
EClass.world.date.day;
1404 int num = 2 + (int)Mathf.Sqrt((
float)
this.Evalue(2513)) / 2;
1405 int num2 =
EClass.rnd(3 + (
int)Mathf.Sqrt((
float)
this.Evalue(2513)) / 2) + num - this.listRecruit.Count;
1410 new List<Chara>(
EClass.game.cards.globalCharas.Values).Shuffle<
Chara>();
1411 for (
int j = 0; j < num2; j++)
1413 Chara chara =
CharaGen.CreateFromFilter(
"c_neutral", this.ContentLV + Mathf.Min(
EClass.player.stats.days, 10), -1);
1414 if (chara.isBackerContent)
1420 this.AddRecruit(chara);
1426 public void AddRecruit(
Chara c)
1433 hireInfo.deadline =
EClass.world.date.GetRaw(0) + (
EClass.rnd(5) + 1) * 1440 +
EClass.rnd(24) * 60;
1434 this.listRecruit.Add(hireInfo);
1438 public void RemoveRecruit(
Chara c)
1440 this.listRecruit.ForeachReverse(delegate(
HireInfo i)
1444 this.listRecruit.Remove(i);
1450 public int CountNewRecruits()
1453 using (List<HireInfo>.Enumerator enumerator = this.listRecruit.GetEnumerator())
1455 while (enumerator.MoveNext())
1457 if (enumerator.Current.isNew)
1467 public void ClearNewRecruits()
1469 foreach (
HireInfo hireInfo
in this.listRecruit)
1471 hireInfo.isNew =
false;
1476 public bool IsRecruit(
Chara c)
1478 using (List<HireInfo>.Enumerator enumerator = this.listRecruit.GetEnumerator())
1480 while (enumerator.MoveNext())
1482 if (enumerator.Current.chara == c)
1492 public int CountPasture()
1494 return EClass._map.Stocked.GetNum(
"pasture",
true) +
EClass._map.Installed.GetNum(
"pasture",
false);
1498 public int GetPastureCost()
1500 return this.CountMembers(FactionMemberType.Livestock,
false);
1504 public int GetCivility()
1506 int num = 10 + this.Evalue(2203);
1507 if (this.Evalue(2701) > 0)
1509 num += 10 + (int)Mathf.Sqrt((
float)
this.Evalue(2701));
1511 if (this.Evalue(2702) > 0)
1513 num -= 10 + (int)Mathf.Sqrt((
float)
this.Evalue(2702));
1519 public float GetHearthIncome()
1522 foreach (
Element element
in this.elements.dict.Values)
1524 if (element.source.category ==
"culture")
1526 num += this.GetHearthIncome(element.source.alias);
1533 public float GetHearthIncome(
string id)
1536 foreach (KeyValuePair<int, Element> keyValuePair
in this.elements.dict)
1538 if (keyValuePair.Value.source.aliasParent ==
id)
1543 return 0.2f * (float)num;
1547 public int GetTechUpgradeCost(
Element e)
1549 int num = e.ValueWithoutLink;
1551 if (e.source.max != 0 && e.ValueWithoutLink >= e.source.max)
1559 public string Log(
string idLang,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null,
string ref4 =
null)
1561 Msg.alwaysVisible =
true;
1562 return this.LogRaw(
Msg.GetRawText(idLang, ref1, ref2, ref3, ref4),
EClass.sources.langGame.map[idLang].logColor);
1566 public string Log(
string idLang,
Card c1,
Card c2,
string ref1 =
null,
string ref2 =
null)
1568 Msg.alwaysVisible =
true;
1569 return this.LogRaw(
Msg.GetRawText(idLang, c1, c2, ref1, ref2),
EClass.sources.langGame.map[idLang].logColor);
1573 public string Log(
string idLang,
Card c1,
string ref1 =
null,
string ref2 =
null,
string ref3 =
null)
1575 Msg.alwaysVisible =
true;
1576 return this.LogRaw(
Msg.GetRawText(idLang, c1, ref1, ref2, ref3),
EClass.sources.langGame.map[idLang].logColor);
1580 public string LogRaw(
string text,
string col =
null)
1582 this.log.Add(text, col.IsEmpty() ?
null : col);
1583 Msg.alwaysVisible =
false;
1590 private void <GenerateGarbage>g__Generate|72_0(
Chara c, ref
FactionBranch.<>c__DisplayClass72_0 A_2)
1593 CS$<>8__locals1.c = c;
1594 if (CS$<>8__locals1.c !=
null &&
EClass.rnd(5) != 0)
1600 this.<GenerateGarbage>g__Add|72_1(
ThingGen.CreateFromCategory(
"junk", -1), ref A_2, ref CS$<>8__locals1);
1605 this.<GenerateGarbage>g__Add|72_1(
ThingGen.CreateFromTag(
"garbage", -1), ref A_2, ref CS$<>8__locals1);
1608 string id =
"trash2";
1615 id = ((
EClass.rnd(3) == 0) ?
"529" :
"1170");
1617 if (
EClass.rnd((CS$<>8__locals1.c !=
null && CS$<>8__locals1.c.memberType == FactionMemberType.Livestock) ? 2 : 50) == 0)
1621 if (
EClass.rnd(200000) == 0)
1625 this.<GenerateGarbage>g__Add|72_1(
ThingGen.Create(
id, -1, -1), ref A_2, ref CS$<>8__locals1);
1632 if (A_2.sortChance <
EClass.rnd(100))
1634 EClass._zone.TryAddThing(t, (A_3.c !=
null) ? (A_3.c.pos.GetRandomPoint(2,
true,
true,
false, 100) ?? A_3.c.pos).GetNearestPoint(
false,
true,
true,
false) :
EClass._zone.bounds.GetRandomSurface(
false,
true,
false),
true);
1637 if (t.id ==
"_poop" &&
EClass.rnd(150) == 0)
1639 t.ChangeMaterial((
EClass.rnd(2) == 0) ?
"silver" :
"gold");
1641 if (!this.TryTrash(t))
1643 EClass._zone.AddCard(t,
EClass._map.bounds.GetRandomSurface(
false,
true,
false));
1644 int unsortedCount = A_2.unsortedCount;
1645 A_2.unsortedCount = unsortedCount + 1;
1646 if (A_2.unsortedCount >= 5)
1655 private void <GetDailyIncome>g__GetIncome|82_0(ref
int n, ref
int stat,
string lang,
bool tax)
1657 if (tax && !this.IsTaxFree)
1665 Msg.Say(lang, Lang._currency(n,
"money"),
this.owner.Name,
null,
null);
1667 EClass.pc.Pick(t,
true,
true);
1674 internal static void <Upgrade>g__Set|87_0(
int a,
int f, ref
FactionBranch.<>c__DisplayClass87_0 A_2)
1694 public int seedPlan;
1706 public int lastUpdateReqruit;
1710 public int incomeShop;
1760 public List<HireInfo> listRecruit =
new List<HireInfo>();
1764 public int dateFound;
1782 public int incomeInn;
1785 public int incomeTourism;
1788 public int efficiency = 100;
1791 public List<Chara> members =
new List<Chara>();