Elin Modding Docs Doc
Loading...
Searching...
No Matches
FactionBranch.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Runtime.CompilerServices;
5using Newtonsoft.Json;
6using UnityEngine;
7
8// Token: 0x0200006B RID: 107
9public class FactionBranch : EClass
10{
11 // Token: 0x060002D4 RID: 724 RVA: 0x000151EB File Offset: 0x000133EB
12 public int GetNextExp(int _lv = -1)
13 {
14 if (_lv == -1)
15 {
16 _lv = this.lv;
17 }
18 return _lv * _lv * 100 + 100;
19 }
20
21 // Token: 0x060002D5 RID: 725 RVA: 0x00015204 File Offset: 0x00013404
22 public int Evalue(int ele)
23 {
24 SourceElement.Row row = EClass.sources.elements.map[ele];
25 if (row.category == "policy")
26 {
27 return this.policies.GetValue(ele);
28 }
29 if (this.HasNetwork && row.tag.Contains("network"))
30 {
31 return EClass.pc.faction.elements.Value(ele) + this.elements.Value(ele);
32 }
33 return this.elements.Value(ele);
34 }
35
36 // Token: 0x17000089 RID: 137
37 // (get) Token: 0x060002D6 RID: 726 RVA: 0x0001528F File Offset: 0x0001348F
38 public int Money
39 {
40 get
41 {
42 return this.resources.money.value;
43 }
44 }
45
46 // Token: 0x1700008A RID: 138
47 // (get) Token: 0x060002D7 RID: 727 RVA: 0x000152A1 File Offset: 0x000134A1
48 public int Worth
49 {
50 get
51 {
52 return this.resources.worth.value;
53 }
54 }
55
56 // Token: 0x1700008B RID: 139
57 // (get) Token: 0x060002D8 RID: 728 RVA: 0x000152B3 File Offset: 0x000134B3
58 public int NumHeirloom
59 {
60 get
61 {
62 return 4 + this.Evalue(2120);
63 }
64 }
65
66 // Token: 0x1700008C RID: 140
67 // (get) Token: 0x060002D9 RID: 729 RVA: 0x000152C2 File Offset: 0x000134C2
68 public int MaxAP
69 {
70 get
71 {
72 return 4 + this.Evalue(2115) + this.Evalue(3900) * 5 + this.Evalue(3709) * this.lv;
73 }
74 }
75
76 // Token: 0x1700008D RID: 141
77 // (get) Token: 0x060002DA RID: 730 RVA: 0x000152F2 File Offset: 0x000134F2
78 public int MaxPopulation
79 {
80 get
81 {
82 return 5 + this.Evalue(2204);
83 }
84 }
85
86 // Token: 0x1700008E RID: 142
87 // (get) Token: 0x060002DB RID: 731 RVA: 0x00015304 File Offset: 0x00013504
88 public int MaxSoil
89 {
90 get
91 {
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;
93 }
94 }
95
96 // Token: 0x1700008F RID: 143
97 // (get) Token: 0x060002DC RID: 732 RVA: 0x00015360 File Offset: 0x00013560
98 public int ContentLV
99 {
100 get
101 {
102 return Mathf.Max(1, this.lv * 4 + EClass.scene.elomap.GetRoadDist(EClass._zone.x, EClass._zone.y) - 4);
103 }
104 }
105
106 // Token: 0x17000090 RID: 144
107 // (get) Token: 0x060002DD RID: 733 RVA: 0x00015396 File Offset: 0x00013596
108 public int DangerLV
109 {
110 get
111 {
112 return Mathf.Max(1, this.ContentLV - (int)Mathf.Sqrt((float)this.Evalue(2704)) * 2 + (int)Mathf.Sqrt((float)this.Evalue(2706)) * 4);
113 }
114 }
115
116 // Token: 0x17000091 RID: 145
117 // (get) Token: 0x060002DE RID: 734 RVA: 0x000153CE File Offset: 0x000135CE
118 public bool HasNetwork
119 {
120 get
121 {
122 return this.lv >= 5;
123 }
124 }
125
126 // Token: 0x17000092 RID: 146
127 // (get) Token: 0x060002DF RID: 735 RVA: 0x000153DC File Offset: 0x000135DC
128 public bool IsTaxFree
129 {
130 get
131 {
132 return this.policies.IsActive(2514, -1);
133 }
134 }
135
136 // Token: 0x060002E0 RID: 736 RVA: 0x000153EF File Offset: 0x000135EF
137 public int GetProductBonus(Chara c)
138 {
139 if (c.isDead || c.IsPCParty)
140 {
141 return 0;
142 }
143 return Mathf.Max(1, (90 + this.Evalue(2116) / 2) * this.efficiency / 100);
144 }
145
146 // Token: 0x060002E1 RID: 737 RVA: 0x00015424 File Offset: 0x00013624
147 public void RefreshEfficiency()
148 {
149 int num = 100;
150 int num2 = this.CountMembers(FactionMemberType.Default, false);
151 if (num2 > this.MaxPopulation)
152 {
153 num -= (num2 - this.MaxPopulation) * (2000 / (100 + 20 * (int)Mathf.Sqrt((float)this.Evalue(2207))));
154 }
155 this.efficiency = num;
156 }
157
158 // Token: 0x17000093 RID: 147
159 // (get) Token: 0x060002E2 RID: 738 RVA: 0x00015478 File Offset: 0x00013678
160 public string RankText
161 {
162 get
163 {
164 return (0.01f * (float)this.exp + (float)this.rank).ToString("F2");
165 }
166 }
167
168 // Token: 0x17000094 RID: 148
169 // (get) Token: 0x060002E3 RID: 739 RVA: 0x000154A8 File Offset: 0x000136A8
170 public string TextLv
171 {
172 get
173 {
174 return this.lv.ToString() + " (" + (100f * (float)this.exp / (float)this.GetNextExp(-1)).ToString("F1") + ")";
175 }
176 }
177
178 // Token: 0x17000095 RID: 149
179 // (get) Token: 0x060002E4 RID: 740 RVA: 0x000154F2 File Offset: 0x000136F2
180 public bool IsStartBranch
181 {
182 get
183 {
184 return this.owner.id == "startSite";
185 }
186 }
187
188 // Token: 0x17000096 RID: 150
189 // (get) Token: 0x060002E5 RID: 741 RVA: 0x00015509 File Offset: 0x00013709
190 public ElementContainerZone elements
191 {
192 get
193 {
194 return this.owner.elements;
195 }
196 }
197
198 // Token: 0x060002E6 RID: 742 RVA: 0x00015516 File Offset: 0x00013716
199 public void Abandon()
200 {
201 }
202
203 // Token: 0x060002E7 RID: 743 RVA: 0x00015518 File Offset: 0x00013718
204 public void OnCreate(Zone zone)
205 {
206 this.SetOwner(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);
211 }
212
213 // Token: 0x060002E8 RID: 744 RVA: 0x00015574 File Offset: 0x00013774
214 public void SetOwner(Zone zone)
215 {
216 this.owner = 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)
224 {
225 if (chara == null)
226 {
227 Debug.LogError("exception: c==null");
228 }
229 else if (EClass.pc == null)
230 {
231 Debug.LogError("exception: pc==null");
232 }
233 else if (chara.homeZone == zone && chara.faction == EClass.pc.faction)
234 {
235 this.members.Add(chara);
236 EClass.pc.faction.charaElements.OnAddMemeber(chara);
237 }
238 }
239 this.RefreshEfficiency();
240 }
241
242 // Token: 0x060002E9 RID: 745 RVA: 0x00015684 File Offset: 0x00013884
243 public void OnActivateZone()
244 {
245 this.incomeInn = 0;
246 this.incomeTourism = 0;
247 foreach (Chara chara in this.members)
248 {
249 if (chara.IsAliveInCurrentZone && !chara.pos.IsInBounds)
250 {
251 chara.MoveImmediate(EClass._map.GetCenterPos().GetNearestPoint(false, true, true, false), true, true);
252 }
253 chara.RefreshWorkElements(this.elements);
254 }
255 this.ValidateUpgradePolicies();
256 }
257
258 // Token: 0x060002EA RID: 746 RVA: 0x00015720 File Offset: 0x00013920
259 public void OnAfterSimulate()
260 {
261 if (!EClass.game.isLoading)
262 {
263 this.GetDailyIncome();
264 }
265 }
266
267 // Token: 0x060002EB RID: 747 RVA: 0x00015734 File Offset: 0x00013934
268 public void OnUnloadMap()
269 {
270 }
271
272 // Token: 0x060002EC RID: 748 RVA: 0x00015738 File Offset: 0x00013938
273 public void OnSimulateHour(VirtualDate date)
274 {
275 int num = this.CountMembers(FactionMemberType.Default, true);
276 int starveChance = Mathf.Max(num - this.MaxPopulation, 0);
277 this.members.ForeachReverse(delegate(Chara c)
278 {
279 if (c.IsPCParty || !c.IsAliveInCurrentZone || c.noMove)
280 {
281 return;
282 }
283 int starveChance;
284 if (EClass.rnd(24 * this.members.Count) < starveChance)
285 {
286 starveChance = starveChance;
287 starveChance--;
288 }
289 else
290 {
291 c.TickWork(date);
292 }
293 if (!date.IsRealTime && EClass.rnd(3) != 0 && c.memberType == FactionMemberType.Default)
294 {
295 c.hunger.Mod(1);
296 if (c.hunger.GetPhase() >= 3)
297 {
298 Thing meal = this.GetMeal(c);
299 if (meal != null)
300 {
301 FoodEffect.Proc(c, meal);
302 meal.Destroy();
303 return;
304 }
305 c.hunger.Mod(-50);
306 }
307 }
308 });
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);
316 int a = 10;
317 if (this.policies.IsActive(2709, -1))
318 {
319 a = 0;
320 }
321 if (EClass.world.date.IsNight)
322 {
323 num5 /= 2;
324 }
325 if ((date.IsRealTime || num2 > 0) && !EClass.debug.enable && EClass.rnd(num5) == 0 && !EClass.pc.IsDeadOrSleeping && EClass._map.CountHostile() < num4)
326 {
327 int num6 = 1 + EClass.rnd(num2 + num3 + 1);
328 for (int i = 0; i < num6; i++)
329 {
330 EClass._zone.SpawnMob(null, SpawnSetting.HomeEnemy(this.DangerLV));
331 }
332 }
333 if ((date.IsRealTime || num2 == 0) && EClass.rnd(a) == 0 && EClass._map.CountWildAnimal() < num4)
334 {
335 EClass._zone.SpawnMob(null, SpawnSetting.HomeWild(5));
336 }
337 if (EClass.rnd(5) == 0 && this.policies.IsActive(2810, -1))
338 {
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)
343 {
344 Chara chara;
345 if (this.policies.IsActive(2822, -1) && Mathf.Sqrt((float)(this.Evalue(2822) / 2)) + 5f >= (float)EClass.rnd(100))
346 {
347 chara = CharaGen.CreateWealthy(this.ContentLV);
348 EClass._zone.AddCard(chara, EClass._zone.GetSpawnPos(SpawnPosition.Random, 100) ?? EClass._map.GetRandomSurface(false, true, false));
349 }
350 else
351 {
352 chara = EClass._zone.SpawnMob(null, SpawnSetting.HomeGuest(this.ContentLV));
353 }
354 if (chara != null && (chara.id == "nun_mother" || chara.id == "prostitute") && this.policies.IsActive(2710, -1))
355 {
356 chara.Destroy();
357 chara = null;
358 }
359 if (chara != null)
360 {
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;
365 if (chara.IsWealthy)
366 {
367 chara.c_allowance *= 10;
368 }
369 if (date.IsRealTime)
370 {
371 Msg.Say("guestArrive", chara.Name, null, null, null);
372 }
373 else
374 {
375 chara.TryAssignBed();
376 }
377 }
378 }
379 }
380 foreach (Chara chara2 in EClass._map.charas)
381 {
382 if (chara2.memberType == FactionMemberType.Guest && ((chara2.c_allowance <= 0 && EClass.rnd(2) == 0) || chara2.GetInt(34, null) + 10080 < EClass.world.date.GetRaw(0)))
383 {
384 if (!chara2.IsGlobal)
385 {
386 chara2.Destroy();
387 }
388 chara2.ClearBed(null);
389 break;
390 }
391 }
392 if (date.hour == 5)
393 {
394 this.DailyOutcome(date);
395 this.GenerateGarbage(date);
396 if (!date.IsRealTime)
397 {
398 this.AutoClean();
399 }
400 this.CalcTourismIncome();
401 this.CalcInnIncome();
402 if (date.IsRealTime)
403 {
404 this.GetDailyIncome();
405 }
406 }
407 if (!EClass.player.simulatingZone && date.hour == 6)
408 {
409 this.ReceivePackages(date);
410 }
411 if (!date.IsRealTime && date.hour % 8 == 0)
412 {
413 foreach (Chara c2 in (from c in EClass._map.charas
414 where c.memberType == FactionMemberType.Guest
415 select c).ToList<Chara>())
416 {
417 for (int j = 0; j < 3; j++)
418 {
419 AI_Shopping.TryShop(c2, false);
420 }
421 }
422 AI_Shopping.TryRestock(EClass.pc, false);
423 }
424 if (EClass.rnd(24) == 0 || EClass.debug.enable)
425 {
426 foreach (Thing thing in EClass._map.things)
427 {
428 if (EClass.rnd(20) == 0 && thing.trait is TraitFoodEggFertilized && thing.pos.FindThing<TraitBed>() != null)
429 {
430 Chara chara3 = TraitFoodEggFertilized.Incubate(thing, thing.pos, null);
431 thing.ModNum(-1, true);
432 if (date.IsRealTime)
433 {
434 chara3.PlaySound("egg", 1f, true);
435 break;
436 }
437 break;
438 }
439 }
440 }
441 this.resources.SetDirty();
442 }
443
444 // Token: 0x060002ED RID: 749 RVA: 0x00015D9C File Offset: 0x00013F9C
445 public void AutoClean()
446 {
447 foreach (Chara chara in this.members)
448 {
449 if (!chara.IsPCParty && chara.ExistsOnMap && chara.memberType == FactionMemberType.Default)
450 {
451 Hobby hobby = chara.GetWork("Clean") ?? chara.GetWork("Chore");
452 if (hobby != null)
453 {
454 int num = (5 + EClass.rnd(5)) * hobby.GetEfficiency(chara) / 100;
455 for (int i = 0; i < num; i++)
456 {
457 Thing thingToClean = AI_Haul.GetThingToClean(chara);
458 if (thingToClean == null)
459 {
460 break;
461 }
462 EClass._zone.TryAddThingInSharedContainer(thingToClean, null, true, false, null, true);
463 }
464 }
465 }
466 }
467 }
468
469 // Token: 0x060002EE RID: 750 RVA: 0x00015E68 File Offset: 0x00014068
470 public void OnSimulateDay(VirtualDate date)
471 {
472 if (this.owner == null || this.owner.mainFaction != EClass.Home)
473 {
474 return;
475 }
476 this.researches.OnSimulateDay();
477 this.resources.OnSimulateDay();
478 this.happiness.OnSimulateDay();
479 if (!date.IsRealTime)
480 {
481 BranchMap branchMap = date.GetBranchMap();
482 foreach (Chara chara in this.members)
483 {
484 if (!chara.IsPCParty && chara.memberType != FactionMemberType.Livestock && !chara.faith.IsEyth && !chara.c_isPrayed && branchMap.altarMap.Contains(chara.faith.id))
485 {
486 AI_Pray.Pray(chara);
487 }
488 }
489 }
490 foreach (Chara chara2 in this.members)
491 {
492 chara2.c_isPrayed = false;
493 chara2.c_isTrained = false;
494 }
495 }
496
497 // Token: 0x060002EF RID: 751 RVA: 0x00015F8C File Offset: 0x0001418C
498 public void OnAdvanceDay()
499 {
500 int num = 0;
501 foreach (Chara chara in this.members)
502 {
503 if (!chara.IsPC && !chara.isDead && chara.memberType == FactionMemberType.Default)
504 {
505 if (EClass.rnd(3) == 0)
506 {
507 num++;
508 }
509 if (chara.GetWork("Pioneer") != null)
510 {
511 num += 3;
512 }
513 }
514 }
515 this.ModExp(num);
516 }
517
518 // Token: 0x060002F0 RID: 752 RVA: 0x00016018 File Offset: 0x00014218
519 public void OnSimulateMonth(VirtualDate date)
520 {
521 this.lastStatistics = this.statistics;
522 this.statistics = new FactionBranch.Statistics();
523 }
524
525 // Token: 0x060002F1 RID: 753 RVA: 0x00016034 File Offset: 0x00014234
526 public void GenerateGarbage(VirtualDate date)
527 {
528 FactionBranch.<>c__DisplayClass72_0 CS$<>8__locals1;
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)
533 {
534 if (!chara.IsPCParty && chara.ExistsOnMap)
535 {
536 Hobby hobby = chara.GetWork("Clean") ?? chara.GetWork("Chore");
537 if (hobby != null)
538 {
539 CS$<>8__locals1.sortChance += 20 * hobby.GetEfficiency(chara) / 100;
540 }
541 }
542 }
543 int num = this.Evalue(2702);
544 int num2 = EClass.rnd(2);
545 for (int i = 0; i < num2; i++)
546 {
547 if (num == 0 || EClass.rnd(num + (EClass.debug.enable ? 100000 : 10)) == 0)
548 {
549 this.<GenerateGarbage>g__Generate|72_0(null, ref CS$<>8__locals1);
550 }
551 }
552 foreach (Chara chara2 in this.members)
553 {
554 if (!chara2.IsPCParty && chara2.ExistsOnMap && (num == 0 || EClass.rnd(num + (EClass.debug.enable ? 100000 : 10)) == 0))
555 {
556 this.<GenerateGarbage>g__Generate|72_0(chara2, ref CS$<>8__locals1);
557 }
558 }
559 }
560
561 // Token: 0x060002F2 RID: 754 RVA: 0x000161B8 File Offset: 0x000143B8
562 public bool TryTrash(Thing t)
563 {
564 Thing thing;
565 if (t.id == "_poop")
566 {
567 thing = EClass._map.props.installed.FindEmptyContainer<TraitContainerCompost>(t);
568 }
569 else if (!t.isFireproof)
570 {
571 thing = EClass._map.props.installed.FindEmptyContainer<TraitContainerBurnable>(t);
572 }
573 else
574 {
575 thing = EClass._map.props.installed.FindEmptyContainer<TraitContainerUnburnable>(t);
576 }
577 if (thing != null)
578 {
579 thing.AddCard(t);
580 return true;
581 }
582 return EClass._zone.TryAddThingInSpot<TraitSpotGarbage>(t, false, false);
583 }
584
585 // Token: 0x060002F3 RID: 755 RVA: 0x00016240 File Offset: 0x00014440
586 public void ReceivePackages(VirtualDate date)
587 {
588 if (EClass.player.simulatingZone)
589 {
590 return;
591 }
592 List<Thing> listPackage = EClass.game.cards.listPackage;
593 if (EClass.player.stats.days >= 2 && !EClass.player.flags.elinGift && Steam.HasDLC(ID_DLC.BackerReward))
594 {
595 listPackage.Add(ThingGen.Create("gift", -1, -1));
596 EClass.player.flags.elinGift = true;
597 }
598 if (listPackage.Count == 0)
599 {
600 return;
601 }
602 SE.Play("notice");
603 int num = 0;
604 foreach (Thing thing in listPackage)
605 {
606 if (thing.id != "bill")
607 {
608 num++;
609 }
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);
612 }
613 Msg.Say("deliver_arrive", num.ToString() ?? "", null, null, null);
614 listPackage.Clear();
615 }
616
617 // Token: 0x060002F4 RID: 756 RVA: 0x00016388 File Offset: 0x00014588
618 public void DailyOutcome(VirtualDate date)
619 {
620 FactionBranch.<>c__DisplayClass75_0 CS$<>8__locals1 = new FactionBranch.<>c__DisplayClass75_0();
621 CS$<>8__locals1.<>4__this = this;
622 CS$<>8__locals1.date = date;
623 Thing thing = null;
624 foreach (Chara m in this.members)
625 {
626 FactionBranch.<>c__DisplayClass75_1 CS$<>8__locals2;
627 CS$<>8__locals2.m = m;
628 if (!CS$<>8__locals2.m.IsPCParty && CS$<>8__locals2.m.ExistsOnMap)
629 {
630 CS$<>8__locals2.m.RefreshWorkElements(this.elements);
631 if (CS$<>8__locals2.m.memberType == FactionMemberType.Livestock)
632 {
633 if (thing == null)
634 {
635 thing = (EClass._map.Stocked.Find("pasture", -1, -1, true) ?? EClass._map.Installed.Find("pasture", -1, -1, false));
636 }
637 if (thing != null)
638 {
639 if (CS$<>8__locals2.m.race.breeder >= EClass.rnd(2500 - (int)Mathf.Sqrt((float)(this.Evalue(2827) * 100))))
640 {
641 if (EClass.rnd(3) != 0)
642 {
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)
645 {
646 CS$<>8__locals2.m.TryPutShared(t, null, true);
647 }
648 }
649 else
650 {
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)
653 {
654 CS$<>8__locals2.m.TryPutShared(t2, null, true);
655 }
656 }
657 }
658 if (CS$<>8__locals2.m.HaveFur())
659 {
660 Chara m2 = CS$<>8__locals2.m;
661 int c_fur = m2.c_fur;
662 m2.c_fur = c_fur + 1;
663 }
664 thing.ModNum(-1, true);
665 if (thing.isDestroyed || thing.Num == 0)
666 {
667 thing = null;
668 }
669 }
670 }
671 else
672 {
673 foreach (Hobby h in CS$<>8__locals2.m.ListHobbies(true))
674 {
675 CS$<>8__locals1.<DailyOutcome>g__GetOutcome|1(h, ref CS$<>8__locals2);
676 }
677 foreach (Hobby h2 in CS$<>8__locals2.m.ListWorks(true))
678 {
679 CS$<>8__locals1.<DailyOutcome>g__GetOutcome|1(h2, ref CS$<>8__locals2);
680 }
681 }
682 }
683 }
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)
689 {
690 if (cell.obj != 0 && cell.sourceObj.tag.Contains("flower"))
691 {
692 PlantData plantData = cell.TryGetPlant();
693 int flower;
694 if (plantData != null && plantData.seed != null)
695 {
696 CS$<>8__locals1.lv += plantData.seed.encLV + 1;
697 }
698 else
699 {
700 flower = CS$<>8__locals1.lv;
701 CS$<>8__locals1.lv = flower + 1;
702 }
703 flower = CS$<>8__locals1.flower;
704 CS$<>8__locals1.flower = flower + 1;
705 }
706 });
707 CS$<>8__locals1.lv /= CS$<>8__locals1.flower;
708 int num2 = 0;
709 foreach (Thing thing2 in EClass._map.things)
710 {
711 if (thing2.IsInstalled && thing2.trait is TraitBeekeep && !thing2.things.IsFull(0))
712 {
713 CS$<>8__locals1.flower -= 3 + EClass.rnd(5 + num2 * 4);
714 num2++;
715 if (CS$<>8__locals1.flower < 0)
716 {
717 break;
718 }
719 if (EClass.rnd(100) <= num)
720 {
721 Thing thing3 = ThingGen.Create("honey", -1, -1);
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);
725 }
726 }
727 }
728 }
729
730 // Token: 0x060002F5 RID: 757 RVA: 0x000167A4 File Offset: 0x000149A4
731 public void PutInMailBox(Thing t, bool outside = false, bool install = true)
732 {
733 if (!outside)
734 {
735 Thing mailBox = this.GetMailBox();
736 if (mailBox != null)
737 {
738 mailBox.AddCard(t);
739 return;
740 }
741 }
742 Point mailBoxPos = this.GetMailBoxPos();
743 EClass._zone.AddCard(t, mailBoxPos);
744 if (install)
745 {
746 t.Install();
747 }
748 }
749
750 // Token: 0x060002F6 RID: 758 RVA: 0x000167E5 File Offset: 0x000149E5
751 public Thing GetMailBox()
752 {
753 return EClass._map.props.installed.FindEmptyContainer<TraitMailPost>();
754 }
755
756 // Token: 0x060002F7 RID: 759 RVA: 0x000167FC File Offset: 0x000149FC
757 public Point GetMailBoxPos()
758 {
759 Thing thing = this.GetMailBox();
760 if (thing == null)
761 {
762 thing = EClass._map.props.installed.Find<TraitCoreZone>();
763 }
764 if (thing != null)
765 {
766 return thing.pos.GetNearestPoint(false, true, false, true).Clamp(true);
767 }
768 return EClass._map.GetCenterPos();
769 }
770
771 // Token: 0x060002F8 RID: 760 RVA: 0x0001684C File Offset: 0x00014A4C
772 public int GetResidentTax()
773 {
774 if (!this.policies.IsActive(2512, 30))
775 {
776 return 0;
777 }
778 int num = 0;
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)
783 {
784 if (!chara.IsPC)
785 {
786 bool isWealthy = chara.IsWealthy;
787 int num5 = 0;
788 foreach (Hobby hobby in chara.ListWorks(true).Concat(chara.ListHobbies(true)))
789 {
790 int num6 = hobby.source.tax * 100 / 100;
791 if (num6 > num5)
792 {
793 num5 = num6;
794 }
795 }
796 int num7 = ((isWealthy ? 50 : 10) + chara.LV * 2) * num5 / 100 * num4 / 100;
797 if (isWealthy && num2 > 0)
798 {
799 num7 = num7 * (150 + (int)Mathf.Sqrt((float)num2) * 5) / 100;
800 }
801 if (num3 > 0)
802 {
803 num7 += (80 + (int)Mathf.Sqrt((float)num3) * 5) * chara.faith.source.tax / 100;
804 }
805 num7 = num7 * this.efficiency / 100;
806 num += num7;
807 if (num7 > 0)
808 {
809 this.Log("bTax", num7.ToString() ?? "", chara.Name, null, null);
810 }
811 }
812 }
813 this.statistics.tax += num;
814 return num;
815 }
816
817 // Token: 0x060002F9 RID: 761 RVA: 0x00016A68 File Offset: 0x00014C68
818 public void CalcInnIncome()
819 {
820 int num = this.CountGuests();
821 if (num == 0)
822 {
823 return;
824 }
825 int num2 = 0;
826 int num3 = 0;
827 foreach (Thing thing in EClass._map.things)
828 {
829 if (thing.IsInstalled)
830 {
831 TraitBed traitBed = thing.trait as TraitBed;
832 if (traitBed != null && traitBed.owner.c_bedType == BedType.guest)
833 {
834 num2++;
835 num3 += traitBed.owner.LV;
836 }
837 }
838 }
839 num = Mathf.Min(num, num2);
840 if (num == 0)
841 {
842 return;
843 }
844 num3 /= 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))
848 {
849 num4 += Mathf.Sqrt((float)this.CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt((float)this.Evalue(2813))) / 100f;
850 }
851 if (this.policies.IsActive(2812, -1))
852 {
853 num4 = num4 * (float)(100 + num3) / 100f;
854 }
855 num4 = Mathf.Min(num4, Mathf.Sqrt((float)this.Worth) / 15f + 5f);
856 this.incomeInn += EClass.rndHalf((int)num4) + EClass.rndHalf((int)num4);
857 }
858
859 // Token: 0x060002FA RID: 762 RVA: 0x00016BF0 File Offset: 0x00014DF0
860 public void CalcTourismIncome()
861 {
862 int num = this.CountGuests();
863 if (num == 0)
864 {
865 return;
866 }
867 float num2 = 10f + Mathf.Sqrt((float)num) * 10f;
868 if (this.policies.IsActive(2815, -1))
869 {
870 num2 += Mathf.Sqrt((float)this.CountWealthyGuests()) * 50f * (80f + 5f * Mathf.Sqrt((float)this.Evalue(2815))) / 100f;
871 }
872 num2 = Mathf.Min(num2, Mathf.Sqrt((float)this.tourism) / 5f);
873 this.incomeTourism += EClass.rndHalf((int)num2) + EClass.rndHalf((int)num2);
874 }
875
876 // Token: 0x060002FB RID: 763 RVA: 0x00016CA0 File Offset: 0x00014EA0
877 public void GetDailyIncome()
878 {
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);
882 }
883
884 // Token: 0x060002FC RID: 764 RVA: 0x00016D04 File Offset: 0x00014F04
885 public Thing GetMeal(Chara c)
886 {
887 Thing thing = EClass._zone.TryGetThingFromSharedContainer((Thing t) => c.CanEat(t, true));
888 if (thing != null)
889 {
890 thing = thing.Split(1);
891 }
892 return thing;
893 }
894
895 // Token: 0x060002FD RID: 765 RVA: 0x00016D44 File Offset: 0x00014F44
896 public void OnClaimZone()
897 {
898 if (EClass.debug.allHomeSkill)
899 {
900 foreach (SourceElement.Row row in from a in EClass.sources.elements.rows
901 where a.category == "tech"
902 select a)
903 {
904 this.elements.SetBase(row.id, 1, 0);
905 }
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())
909 {
910 while (enumerator.MoveNext())
911 {
912 SourceElement.Row row2 = enumerator.Current;
913 this.policies.AddPolicy(row2.id, true);
914 }
915 goto IL_1B0;
916 }
917 }
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);
929 IL_1B0:
930 if (EClass.pc.faction.CountTaxFreeLand() < 3)
931 {
932 this.policies.Activate(2514);
933 }
934 Element element = EClass._zone.ListLandFeats()[0];
935 this.elements.SetBase(element.id, 1, 0);
936 int id = element.id;
937 if (id != 3602)
938 {
939 if (id == 3604)
940 {
941 this.elements.SetBase(2206, 10, 0);
942 }
943 }
944 else
945 {
946 this.elements.SetBase(2206, 15, 0);
947 }
948 this.AddMemeber(EClass.pc);
949 if (EClass.debug.allPolicy)
950 {
951 foreach (SourceElement.Row row3 in from a in EClass.sources.elements.rows
952 where a.category == "policy"
953 select a)
954 {
955 this.policies.AddPolicy(row3.id, true);
956 }
957 }
958 this.ValidateUpgradePolicies();
959 }
960
961 // Token: 0x060002FE RID: 766 RVA: 0x0001703C File Offset: 0x0001523C
962 public void OnUnclaimZone()
963 {
964 }
965
966 // Token: 0x060002FF RID: 767 RVA: 0x00017040 File Offset: 0x00015240
967 public void ValidateUpgradePolicies()
968 {
969 if (this.lv >= 2)
970 {
971 if (!this.policies.HasPolicy(2705))
972 {
973 this.policies.AddPolicy(2705, true);
974 EClass.pc.faction.SetGlobalPolicyActive(2705, EClass.pc.faction.IsGlobalPolicyActive(2705));
975 }
976 if (!this.policies.HasPolicy(2708))
977 {
978 this.policies.AddPolicy(2708, true);
979 EClass.pc.faction.SetGlobalPolicyActive(2708, EClass.pc.faction.IsGlobalPolicyActive(2708));
980 }
981 if (!this.policies.HasPolicy(2707))
982 {
983 this.policies.AddPolicy(2707, true);
984 }
985 if (!this.policies.HasPolicy(2709))
986 {
987 this.policies.AddPolicy(2709, true);
988 }
989 }
990 foreach (int id in EClass.pc.faction.globalPolicies)
991 {
992 if (!this.policies.HasPolicy(id))
993 {
994 this.policies.AddPolicy(id, false);
995 EClass.pc.faction.SetGlobalPolicyActive(id, EClass.pc.faction.IsGlobalPolicyActive(id));
996 }
997 }
998 }
999
1000 // Token: 0x06000300 RID: 768 RVA: 0x000171C0 File Offset: 0x000153C0
1001 public void Upgrade()
1002 {
1003 List<Element> list = this.owner.ListLandFeats();
1004 if (this.owner.IsActiveZone)
1005 {
1006 TraitCoreZone traitCoreZone = EClass._map.FindThing<TraitCoreZone>();
1007 if (traitCoreZone != null)
1008 {
1009 SE.Play("godbless");
1010 traitCoreZone.owner.PlayEffect("aura_heaven", true, 0f, default(Vector3));
1011 }
1012 }
1013 this.lv++;
1014 this.exp = 0;
1015 FactionBranch.<>c__DisplayClass87_0 CS$<>8__locals1;
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;
1020 if (id != 3500)
1021 {
1022 switch (id)
1023 {
1024 case 3600:
1025 FactionBranch.<Upgrade>g__Set|87_0(5, 3, ref CS$<>8__locals1);
1026 break;
1027 case 3601:
1028 FactionBranch.<Upgrade>g__Set|87_0(4, 4, ref CS$<>8__locals1);
1029 break;
1030 case 3602:
1031 FactionBranch.<Upgrade>g__Set|87_0(5, 2, ref CS$<>8__locals1);
1032 break;
1033 case 3603:
1034 FactionBranch.<Upgrade>g__Set|87_0(6, 2, ref CS$<>8__locals1);
1035 break;
1036 case 3604:
1037 FactionBranch.<Upgrade>g__Set|87_0(4, 3, ref CS$<>8__locals1);
1038 break;
1039 }
1040 }
1041 else
1042 {
1043 FactionBranch.<Upgrade>g__Set|87_0(5, 3, ref CS$<>8__locals1);
1044 }
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();
1050 if (this.lv == 4)
1051 {
1052 this.elements.SetBase(list[1].id, 1, 0);
1053 }
1054 if (this.lv == 7)
1055 {
1056 this.elements.SetBase(list[2].id, 1, 0);
1057 }
1058 if (this.lv >= 5)
1059 {
1060 List<Element> list2 = (from a in this.elements.dict.Values
1061 where a.source.category == "landfeat" && a.HasTag("network")
1062 select a).ToList<Element>();
1063 foreach (Element element in list2)
1064 {
1065 EClass.pc.faction.elements.ModBase(element.id, element.Value);
1066 }
1067 foreach (Element element2 in list2)
1068 {
1069 this.elements.Remove(element2.id);
1070 }
1071 }
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");
1074 Tutorial.Reserve("stone", null);
1075 }
1076
1077 // Token: 0x17000097 RID: 151
1078 // (get) Token: 0x06000301 RID: 769 RVA: 0x000174FC File Offset: 0x000156FC
1079 public int MaxLv
1080 {
1081 get
1082 {
1083 return 7;
1084 }
1085 }
1086
1087 // Token: 0x06000302 RID: 770 RVA: 0x000174FF File Offset: 0x000156FF
1088 public bool CanUpgrade()
1089 {
1090 return this.lv < this.MaxLv && (this.exp >= this.GetNextExp(-1) || EClass.debug.enable);
1091 }
1092
1093 // Token: 0x06000303 RID: 771 RVA: 0x0001752C File Offset: 0x0001572C
1094 public int GetUpgradeCost()
1095 {
1096 return this.lv * this.lv * this.lv * 1000;
1097 }
1098
1099 // Token: 0x06000304 RID: 772 RVA: 0x00017548 File Offset: 0x00015748
1100 public void ModExp(int a)
1101 {
1102 if (this.policies.IsActive(2515, -1))
1103 {
1104 return;
1105 }
1106 if (this.policies.IsActive(2516, -1))
1107 {
1108 a = a * 150 / 100 + EClass.rnd(2);
1109 }
1110 this.exp += a;
1111 if (this.exp >= this.GetNextExp(-1) && this.CanUpgrade())
1112 {
1113 if (EClass.core.version.demo && this.lv >= 3)
1114 {
1115 this.exp = 0;
1116 Msg.Say("demoLimit2");
1117 return;
1118 }
1119 this.Upgrade();
1120 }
1121 }
1122
1123 // Token: 0x06000305 RID: 773 RVA: 0x000175E8 File Offset: 0x000157E8
1124 public string GetHearthHint(int a)
1125 {
1126 if (a <= 1)
1127 {
1128 return "hearth1".lang();
1129 }
1130 string text = "";
1131 for (int i = 1; i < a; i++)
1132 {
1133 string text2 = ("hearth" + (i + 1).ToString()).lang();
1134 if (!text2.IsEmpty())
1135 {
1136 text = text + text2 + Environment.NewLine;
1137 }
1138 }
1139 return text.TrimEnd(Environment.NewLine.ToCharArray());
1140 }
1141
1142 // Token: 0x06000306 RID: 774 RVA: 0x00017656 File Offset: 0x00015856
1143 public void AddFeat(int ele, int v)
1144 {
1145 this.elements.ModBase(ele, v);
1146 WidgetPopText.Say("rewardElement".lang(EClass.sources.elements.map[ele].GetName(), null, null, null, null), FontColor.Default, null);
1147 }
1148
1149 // Token: 0x06000307 RID: 775 RVA: 0x00017698 File Offset: 0x00015898
1150 public void AddMemeber(Chara c)
1151 {
1152 if (this.members.Contains(c))
1153 {
1154 return;
1155 }
1156 if (c.homeBranch != null)
1157 {
1158 c.homeBranch.RemoveMemeber(c);
1159 }
1160 EClass.Home.RemoveReserve(c);
1161 c.SetGlobal();
1162 c.SetFaction(EClass.Home);
1163 c.SetHomeZone(this.owner);
1164 if (c.OriginalHostility <= Hostility.Ally)
1165 {
1166 c.c_originalHostility = Hostility.Ally;
1167 }
1168 c.hostility = Hostility.Ally;
1169 c.enemy = null;
1170 c.orgPos = null;
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")
1176 {
1177 this.uidMaid = c.uid;
1178 }
1179 this.RefreshEfficiency();
1180 }
1181
1182 // Token: 0x06000308 RID: 776 RVA: 0x00017776 File Offset: 0x00015976
1183 public void ChangeMemberType(Chara c, FactionMemberType type)
1184 {
1185 c.ClearBed(null);
1186 c.memberType = type;
1187 c.RefreshWorkElements(this.elements);
1188 this.policies.Validate();
1189 }
1190
1191 // Token: 0x06000309 RID: 777 RVA: 0x000177A0 File Offset: 0x000159A0
1192 public void BanishMember(Chara c, bool sell = false)
1193 {
1194 this.RemoveMemeber(c);
1195 if (!sell)
1196 {
1197 Msg.Say("banish", c, EClass._zone.Name, null, null);
1198 }
1199 if (!c.IsGlobal)
1200 {
1201 c.Destroy();
1202 return;
1203 }
1204 UniqueData c_uniqueData = c.c_uniqueData;
1205 if (c_uniqueData != null)
1206 {
1207 Debug.Log(string.Concat(new string[]
1208 {
1209 c_uniqueData.uidZone.ToString(),
1210 "/",
1211 EClass.game.spatials.map.ContainsKey(c_uniqueData.uidZone).ToString(),
1212 "/",
1213 c_uniqueData.x.ToString(),
1214 "/",
1215 c_uniqueData.y.ToString()
1216 }));
1217 }
1218 if (c_uniqueData != null && EClass.game.spatials.map.ContainsKey(c_uniqueData.uidZone))
1219 {
1220 c.MoveHome(EClass.game.spatials.map[c_uniqueData.uidZone] as Zone, c_uniqueData.x, c_uniqueData.y);
1221 return;
1222 }
1223 Zone zone = EClass.game.spatials.Find("somewhere");
1224 if (c.trait is TraitAdventurer)
1225 {
1226 zone = EClass.world.region.ListTowns().RandomItem<Zone>();
1227 c.SetHomeZone(zone);
1228 }
1229 c.MoveZone(zone, ZoneTransition.EnterState.RandomVisit);
1230 }
1231
1232 // Token: 0x0600030A RID: 778 RVA: 0x000178FC File Offset: 0x00015AFC
1233 public void RemoveMemeber(Chara c)
1234 {
1235 c.isSale = false;
1236 if (c.currentZone != null && c.currentZone.map != null)
1237 {
1238 c.ClearBed(c.currentZone.map);
1239 c.currentZone.map.props.sales.Remove(c);
1240 }
1241 c.RefreshWorkElements(null);
1242 c.RemoveGlobal();
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();
1248 }
1249
1250 // Token: 0x0600030B RID: 779 RVA: 0x000179A8 File Offset: 0x00015BA8
1251 public int GetHappiness(FactionMemberType type)
1252 {
1253 float num = 0f;
1254 if (this.members.Count == 0)
1255 {
1256 return 0;
1257 }
1258 foreach (Chara chara in this.members)
1259 {
1260 num += (float)chara.happiness;
1261 }
1262 return (int)(num / (float)this.members.Count);
1263 }
1264
1265 // Token: 0x0600030C RID: 780 RVA: 0x00017A24 File Offset: 0x00015C24
1266 public bool IsAllDead()
1267 {
1268 using (List<Chara>.Enumerator enumerator = this.members.GetEnumerator())
1269 {
1270 while (enumerator.MoveNext())
1271 {
1272 if (!enumerator.Current.isDead)
1273 {
1274 return false;
1275 }
1276 }
1277 }
1278 return true;
1279 }
1280
1281 // Token: 0x0600030D RID: 781 RVA: 0x00017A80 File Offset: 0x00015C80
1282 public void Recruit(Chara c)
1283 {
1284 this.RemoveRecruit(c);
1285 this.AddMemeber(c);
1286 if (c.currentZone != EClass._zone && !c.isDead)
1287 {
1288 Trait random = EClass._map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
1289 Point point = ((random != null) ? random.GetPoint() : null) ?? EClass.pc.pos;
1290 EClass._zone.AddCard(c, point);
1291 }
1292 c.RefreshWorkElements(null);
1293 this.RefreshEfficiency();
1294 Msg.Say("hire".langGame(c.Name, null, null, null));
1295 }
1296
1297 // Token: 0x0600030E RID: 782 RVA: 0x00017B18 File Offset: 0x00015D18
1298 public Chara GetMaid()
1299 {
1300 foreach (Chara chara in this.members)
1301 {
1302 if (chara.IsAliveInCurrentZone && chara.IsMaid)
1303 {
1304 return chara;
1305 }
1306 }
1307 return null;
1308 }
1309
1310 // Token: 0x0600030F RID: 783 RVA: 0x00017B7C File Offset: 0x00015D7C
1311 public string GetRandomName()
1312 {
1313 if (EClass.rnd(4) == 0 || this.members.Count == 0)
1314 {
1315 return EClass.player.title;
1316 }
1317 return this.members.RandomItem<Chara>().Name;
1318 }
1319
1320 // Token: 0x06000310 RID: 784 RVA: 0x00017BB0 File Offset: 0x00015DB0
1321 public int CountMembers(FactionMemberType type, bool onlyAlive = false)
1322 {
1323 int num = 0;
1324 foreach (Chara chara in this.members)
1325 {
1326 if (chara.memberType == type && !chara.IsUnique && (!onlyAlive || !chara.isDead))
1327 {
1328 num++;
1329 }
1330 }
1331 return num;
1332 }
1333
1334 // Token: 0x06000311 RID: 785 RVA: 0x00017C20 File Offset: 0x00015E20
1335 public int CountGuests()
1336 {
1337 int num = 0;
1338 using (List<Chara>.Enumerator enumerator = EClass._map.charas.GetEnumerator())
1339 {
1340 while (enumerator.MoveNext())
1341 {
1342 if (enumerator.Current.memberType == FactionMemberType.Guest)
1343 {
1344 num++;
1345 }
1346 }
1347 }
1348 return num;
1349 }
1350
1351 // Token: 0x06000312 RID: 786 RVA: 0x00017C80 File Offset: 0x00015E80
1352 public int CountWealthyGuests()
1353 {
1354 int num = 0;
1355 foreach (Chara chara in EClass._map.charas)
1356 {
1357 if (chara.memberType == FactionMemberType.Guest && chara.IsWealthy)
1358 {
1359 num++;
1360 }
1361 }
1362 return num;
1363 }
1364
1365 // Token: 0x06000313 RID: 787 RVA: 0x00017CE8 File Offset: 0x00015EE8
1366 public void UpdateReqruits(bool clear = false)
1367 {
1368 this.resources.Refresh();
1369 if (clear)
1370 {
1371 this.listRecruit.ForeachReverse(delegate(HireInfo i)
1372 {
1373 if (!i.chara.IsGlobal)
1374 {
1375 i.chara.Destroy();
1376 }
1377 if (i.chara.isDestroyed)
1378 {
1379 this.listRecruit.Remove(i);
1380 }
1381 });
1382 this.listRecruit.Clear();
1383 this.lastUpdateReqruit = -1;
1384 }
1385 else
1386 {
1387 this.listRecruit.ForeachReverse(delegate(HireInfo i)
1388 {
1389 if (i.Hours < 0)
1390 {
1391 if (!i.chara.IsGlobal)
1392 {
1393 i.chara.Destroy();
1394 }
1395 this.listRecruit.Remove(i);
1396 }
1397 });
1398 }
1399 if (this.lastUpdateReqruit == EClass.world.date.day)
1400 {
1401 return;
1402 }
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;
1406 if (num2 <= 0)
1407 {
1408 return;
1409 }
1410 new List<Chara>(EClass.game.cards.globalCharas.Values).Shuffle<Chara>();
1411 for (int j = 0; j < num2; j++)
1412 {
1413 Chara chara = CharaGen.CreateFromFilter("c_neutral", this.ContentLV + Mathf.Min(EClass.player.stats.days, 10), -1);
1414 if (chara.isBackerContent)
1415 {
1416 j--;
1417 }
1418 else
1419 {
1420 this.AddRecruit(chara);
1421 }
1422 }
1423 }
1424
1425 // Token: 0x06000314 RID: 788 RVA: 0x00017E24 File Offset: 0x00016024
1426 public void AddRecruit(Chara c)
1427 {
1428 HireInfo hireInfo = new HireInfo
1429 {
1430 chara = c,
1431 isNew = true
1432 };
1433 hireInfo.deadline = EClass.world.date.GetRaw(0) + (EClass.rnd(5) + 1) * 1440 + EClass.rnd(24) * 60;
1434 this.listRecruit.Add(hireInfo);
1435 }
1436
1437 // Token: 0x06000315 RID: 789 RVA: 0x00017E84 File Offset: 0x00016084
1438 public void RemoveRecruit(Chara c)
1439 {
1440 this.listRecruit.ForeachReverse(delegate(HireInfo i)
1441 {
1442 if (i.chara == c)
1443 {
1444 this.listRecruit.Remove(i);
1445 }
1446 });
1447 }
1448
1449 // Token: 0x06000316 RID: 790 RVA: 0x00017EBC File Offset: 0x000160BC
1450 public int CountNewRecruits()
1451 {
1452 int num = 0;
1453 using (List<HireInfo>.Enumerator enumerator = this.listRecruit.GetEnumerator())
1454 {
1455 while (enumerator.MoveNext())
1456 {
1457 if (enumerator.Current.isNew)
1458 {
1459 num++;
1460 }
1461 }
1462 }
1463 return num;
1464 }
1465
1466 // Token: 0x06000317 RID: 791 RVA: 0x00017F18 File Offset: 0x00016118
1467 public void ClearNewRecruits()
1468 {
1469 foreach (HireInfo hireInfo in this.listRecruit)
1470 {
1471 hireInfo.isNew = false;
1472 }
1473 }
1474
1475 // Token: 0x06000318 RID: 792 RVA: 0x00017F6C File Offset: 0x0001616C
1476 public bool IsRecruit(Chara c)
1477 {
1478 using (List<HireInfo>.Enumerator enumerator = this.listRecruit.GetEnumerator())
1479 {
1480 while (enumerator.MoveNext())
1481 {
1482 if (enumerator.Current.chara == c)
1483 {
1484 return true;
1485 }
1486 }
1487 }
1488 return false;
1489 }
1490
1491 // Token: 0x06000319 RID: 793 RVA: 0x00017FC8 File Offset: 0x000161C8
1492 public int CountPasture()
1493 {
1494 return EClass._map.Stocked.GetNum("pasture", true) + EClass._map.Installed.GetNum("pasture", false);
1495 }
1496
1497 // Token: 0x0600031A RID: 794 RVA: 0x00017FF5 File Offset: 0x000161F5
1498 public int GetPastureCost()
1499 {
1500 return this.CountMembers(FactionMemberType.Livestock, false);
1501 }
1502
1503 // Token: 0x0600031B RID: 795 RVA: 0x00018000 File Offset: 0x00016200
1504 public int GetCivility()
1505 {
1506 int num = 10 + this.Evalue(2203);
1507 if (this.Evalue(2701) > 0)
1508 {
1509 num += 10 + (int)Mathf.Sqrt((float)this.Evalue(2701));
1510 }
1511 if (this.Evalue(2702) > 0)
1512 {
1513 num -= 10 + (int)Mathf.Sqrt((float)this.Evalue(2702));
1514 }
1515 return num;
1516 }
1517
1518 // Token: 0x0600031C RID: 796 RVA: 0x0001806C File Offset: 0x0001626C
1519 public float GetHearthIncome()
1520 {
1521 float num = 0f;
1522 foreach (Element element in this.elements.dict.Values)
1523 {
1524 if (element.source.category == "culture")
1525 {
1526 num += this.GetHearthIncome(element.source.alias);
1527 }
1528 }
1529 return num;
1530 }
1531
1532 // Token: 0x0600031D RID: 797 RVA: 0x000180F4 File Offset: 0x000162F4
1533 public float GetHearthIncome(string id)
1534 {
1535 int num = 0;
1536 foreach (KeyValuePair<int, Element> keyValuePair in this.elements.dict)
1537 {
1538 if (keyValuePair.Value.source.aliasParent == id)
1539 {
1540 num++;
1541 }
1542 }
1543 return 0.2f * (float)num;
1544 }
1545
1546 // Token: 0x0600031E RID: 798 RVA: 0x0001816C File Offset: 0x0001636C
1547 public int GetTechUpgradeCost(Element e)
1548 {
1549 int num = e.ValueWithoutLink;
1550 num += e.CostLearn;
1551 if (e.source.max != 0 && e.ValueWithoutLink >= e.source.max)
1552 {
1553 return 0;
1554 }
1555 return num;
1556 }
1557
1558 // Token: 0x0600031F RID: 799 RVA: 0x000181AC File Offset: 0x000163AC
1559 public string Log(string idLang, string ref1 = null, string ref2 = null, string ref3 = null, string ref4 = null)
1560 {
1561 Msg.alwaysVisible = true;
1562 return this.LogRaw(Msg.GetRawText(idLang, ref1, ref2, ref3, ref4), EClass.sources.langGame.map[idLang].logColor);
1563 }
1564
1565 // Token: 0x06000320 RID: 800 RVA: 0x000181E0 File Offset: 0x000163E0
1566 public string Log(string idLang, Card c1, Card c2, string ref1 = null, string ref2 = null)
1567 {
1568 Msg.alwaysVisible = true;
1569 return this.LogRaw(Msg.GetRawText(idLang, c1, c2, ref1, ref2), EClass.sources.langGame.map[idLang].logColor);
1570 }
1571
1572 // Token: 0x06000321 RID: 801 RVA: 0x00018214 File Offset: 0x00016414
1573 public string Log(string idLang, Card c1, string ref1 = null, string ref2 = null, string ref3 = null)
1574 {
1575 Msg.alwaysVisible = true;
1576 return this.LogRaw(Msg.GetRawText(idLang, c1, ref1, ref2, ref3), EClass.sources.langGame.map[idLang].logColor);
1577 }
1578
1579 // Token: 0x06000322 RID: 802 RVA: 0x00018248 File Offset: 0x00016448
1580 public string LogRaw(string text, string col = null)
1581 {
1582 this.log.Add(text, col.IsEmpty() ? null : col);
1583 Msg.alwaysVisible = false;
1584 Msg.SetColor();
1585 return text;
1586 }
1587
1588 // Token: 0x06000324 RID: 804 RVA: 0x00018328 File Offset: 0x00016528
1589 [CompilerGenerated]
1590 private void <GenerateGarbage>g__Generate|72_0(Chara c, ref FactionBranch.<>c__DisplayClass72_0 A_2)
1591 {
1592 FactionBranch.<>c__DisplayClass72_1 CS$<>8__locals1;
1593 CS$<>8__locals1.c = c;
1594 if (CS$<>8__locals1.c != null && EClass.rnd(5) != 0)
1595 {
1596 return;
1597 }
1598 if (EClass.rnd(80) == 0)
1599 {
1600 this.<GenerateGarbage>g__Add|72_1(ThingGen.CreateFromCategory("junk", -1), ref A_2, ref CS$<>8__locals1);
1601 return;
1602 }
1603 if (EClass.rnd(40) == 0)
1604 {
1605 this.<GenerateGarbage>g__Add|72_1(ThingGen.CreateFromTag("garbage", -1), ref A_2, ref CS$<>8__locals1);
1606 return;
1607 }
1608 string id = "trash2";
1609 if (EClass.rnd(3) == 0)
1610 {
1611 id = "trash1";
1612 }
1613 if (EClass.rnd(10) == 0)
1614 {
1615 id = ((EClass.rnd(3) == 0) ? "529" : "1170");
1616 }
1617 if (EClass.rnd((CS$<>8__locals1.c != null && CS$<>8__locals1.c.memberType == FactionMemberType.Livestock) ? 2 : 50) == 0)
1618 {
1619 id = "_poop";
1620 }
1621 if (EClass.rnd(200000) == 0)
1622 {
1623 id = "goodness";
1624 }
1625 this.<GenerateGarbage>g__Add|72_1(ThingGen.Create(id, -1, -1), ref A_2, ref CS$<>8__locals1);
1626 }
1627
1628 // Token: 0x06000325 RID: 805 RVA: 0x0001840C File Offset: 0x0001660C
1629 [CompilerGenerated]
1630 private void <GenerateGarbage>g__Add|72_1(Thing t, ref FactionBranch.<>c__DisplayClass72_0 A_2, ref FactionBranch.<>c__DisplayClass72_1 A_3)
1631 {
1632 if (A_2.sortChance < EClass.rnd(100))
1633 {
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);
1635 return;
1636 }
1637 if (t.id == "_poop" && EClass.rnd(150) == 0)
1638 {
1639 t.ChangeMaterial((EClass.rnd(2) == 0) ? "silver" : "gold");
1640 }
1641 if (!this.TryTrash(t))
1642 {
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)
1647 {
1648 Tutorial.Reserve("garbage", null);
1649 }
1650 }
1651 }
1652
1653 // Token: 0x06000326 RID: 806 RVA: 0x00018504 File Offset: 0x00016704
1654 [CompilerGenerated]
1655 private void <GetDailyIncome>g__GetIncome|82_0(ref int n, ref int stat, string lang, bool tax)
1656 {
1657 if (tax && !this.IsTaxFree)
1658 {
1659 n = n * 10 / 100;
1660 }
1661 if (n == 0)
1662 {
1663 return;
1664 }
1665 Msg.Say(lang, Lang._currency(n, "money"), this.owner.Name, null, null);
1666 Thing t = ThingGen.Create("money", -1, -1).SetNum(n);
1667 EClass.pc.Pick(t, true, true);
1668 stat += n;
1669 n = 0;
1670 }
1671
1672 // Token: 0x06000327 RID: 807 RVA: 0x00018578 File Offset: 0x00016778
1673 [CompilerGenerated]
1674 internal static void <Upgrade>g__Set|87_0(int a, int f, ref FactionBranch.<>c__DisplayClass87_0 A_2)
1675 {
1676 A_2.admin = a;
1677 A_2.food = f;
1678 }
1679
1680 // Token: 0x04000543 RID: 1347
1681 [JsonProperty]
1682 public int lv = 1;
1683
1684 // Token: 0x04000544 RID: 1348
1685 [JsonProperty]
1686 public int rank;
1687
1688 // Token: 0x04000545 RID: 1349
1689 [JsonProperty]
1690 public int exp;
1691
1692 // Token: 0x04000546 RID: 1350
1693 [JsonProperty]
1694 public int seedPlan;
1695
1696 // Token: 0x04000547 RID: 1351
1697 [JsonProperty]
1698 public int temper;
1699
1700 // Token: 0x04000548 RID: 1352
1701 [JsonProperty]
1702 public int uidMaid;
1703
1704 // Token: 0x04000549 RID: 1353
1705 [JsonProperty]
1706 public int lastUpdateReqruit;
1707
1708 // Token: 0x0400054A RID: 1354
1709 [JsonProperty]
1710 public int incomeShop;
1711
1712 // Token: 0x0400054B RID: 1355
1713 [JsonProperty]
1714 public GStability stability = new GStability
1715 {
1716 value = 1
1717 };
1718
1719 // Token: 0x0400054C RID: 1356
1720 [JsonProperty]
1721 public HomeResourceManager resources = new HomeResourceManager();
1722
1723 // Token: 0x0400054D RID: 1357
1724 [JsonProperty]
1725 public ResearchManager researches = new ResearchManager();
1726
1727 // Token: 0x0400054E RID: 1358
1728 [JsonProperty]
1729 public PolicyManager policies = new PolicyManager();
1730
1731 // Token: 0x0400054F RID: 1359
1732 [JsonProperty]
1733 public HappinessManager happiness = new HappinessManager();
1734
1735 // Token: 0x04000550 RID: 1360
1736 [JsonProperty]
1737 public MeetingManager meetings = new MeetingManager();
1738
1739 // Token: 0x04000551 RID: 1361
1740 [JsonProperty]
1741 public Thing stash;
1742
1743 // Token: 0x04000552 RID: 1362
1744 [JsonProperty]
1745 public MsgLog log = new MsgLog
1746 {
1747 id = "log"
1748 };
1749
1750 // Token: 0x04000553 RID: 1363
1751 [JsonProperty]
1752 public Religion faith;
1753
1754 // Token: 0x04000554 RID: 1364
1755 [JsonProperty]
1756 public ExpeditionManager expeditions = new ExpeditionManager();
1757
1758 // Token: 0x04000555 RID: 1365
1759 [JsonProperty]
1760 public List<HireInfo> listRecruit = new List<HireInfo>();
1761
1762 // Token: 0x04000556 RID: 1366
1763 [JsonProperty]
1764 public int dateFound;
1765
1766 // Token: 0x04000557 RID: 1367
1767 [JsonProperty]
1768 public int tourism;
1769
1770 // Token: 0x04000558 RID: 1368
1771 [JsonProperty]
1772 public FactionBranch.Statistics statistics = new FactionBranch.Statistics();
1773
1774 // Token: 0x04000559 RID: 1369
1775 [JsonProperty]
1776 public FactionBranch.Statistics lastStatistics = new FactionBranch.Statistics();
1777
1778 // Token: 0x0400055A RID: 1370
1779 public Zone owner;
1780
1781 // Token: 0x0400055B RID: 1371
1782 public int incomeInn;
1783
1784 // Token: 0x0400055C RID: 1372
1785 public int incomeTourism;
1786
1787 // Token: 0x0400055D RID: 1373
1788 public int efficiency = 100;
1789
1790 // Token: 0x0400055E RID: 1374
1791 public List<Chara> members = new List<Chara>();
1792
1793 // Token: 0x020007D9 RID: 2009
1794 public class Statistics : EClass
1795 {
1796 // Token: 0x04002209 RID: 8713
1797 [JsonProperty]
1798 public int ship;
1799
1800 // Token: 0x0400220A RID: 8714
1801 [JsonProperty]
1802 public int inn;
1803
1804 // Token: 0x0400220B RID: 8715
1805 [JsonProperty]
1806 public int tourism;
1807
1808 // Token: 0x0400220C RID: 8716
1809 [JsonProperty]
1810 public int shop;
1811
1812 // Token: 0x0400220D RID: 8717
1813 [JsonProperty]
1814 public int numSold;
1815
1816 // Token: 0x0400220E RID: 8718
1817 [JsonProperty]
1818 public int visitor;
1819
1820 // Token: 0x0400220F RID: 8719
1821 [JsonProperty]
1822 public int tax;
1823 }
1824}
Definition Card.cs:13
Definition Cell.cs:10
Definition Chara.cs:12
Definition Hobby.cs:5
Definition Msg.cs:7
Definition Point.cs:11
Definition Steam.cs:11
Definition Thing.cs:10
Definition Trait.cs:9
Definition Zone.cs:14