Elin Decompiled Documentation EA 23.192 Nightly
Loading...
Searching...
No Matches
Zone.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using Dungen;
6using Ionic.Zip;
7using Newtonsoft.Json;
8using SFB;
9using UnityEngine;
10
12{
13 public class PortalReturnData
14 {
15 [JsonProperty]
16 public int uidZone;
17
18 [JsonProperty]
19 public int x;
20
21 [JsonProperty]
22 public int z;
23 }
24
25 public static bool forceRegenerate;
26
27 public static string forceSubset;
28
29 public static CardRow sourceHat;
30
31 public static int okaerinko = 0;
32
33 [JsonProperty]
35
36 [JsonProperty]
37 public HashSet<int> completedQuests = new HashSet<int>();
38
39 [JsonProperty]
41
42 [JsonProperty]
44
45 [JsonProperty]
47
48 [JsonProperty]
49 public Dictionary<int, string> dictCitizen = new Dictionary<int, string>();
50
51 [JsonProperty]
53
54 [JsonProperty]
55 public List<int> landFeats;
56
57 [JsonProperty]
59
60 public Map map;
61
63
65
66 public int fileVariation;
67
68 public bool dirtyElectricity;
69
70 public bool isStarted;
71
72 public bool isSimulating;
73
74 public int tempDist;
75
77
78 public static bool ignoreSpawnAnime;
79
80 public static List<Thing> Suckers = new List<Thing>();
81
82 public Chara Boss
83 {
84 get
85 {
86 return EClass._map.FindChara(base.uidBoss);
87 }
88 set
89 {
90 base.uidBoss = value?.uid ?? 0;
91 }
92 }
93
94 public override int ContentLv
95 {
96 get
97 {
98 if (branch == null)
99 {
100 return DangerLv;
101 }
102 return branch.ContentLV;
103 }
104 }
105
106 public override int DangerLv
107 {
108 get
109 {
110 if (GetTopZone() != this)
111 {
112 return GetTopZone().DangerLv + Mathf.Abs(base.lv) - 1;
113 }
114 return (int)Mathf.Max(1f, (branch != null) ? ((float)branch.DangerLV) : ((float)base._dangerLv + MathF.Abs(base.lv) + (float)DangerLvFix));
115 }
116 }
117
118 public virtual bool DisableRooms => false;
119
120 public int HourSinceLastActive => EClass.world.date.GetElapsedHour(base.lastActive);
121
122 public int MinsSinceLastActive => EClass.world.date.GetElapsedMins(base.lastActive);
123
124 public virtual string pathExport => CorePath.ZoneSave + idExport.IsEmpty("_new") + ".z";
125
127
128 public virtual string IdBiome => map.config.idBiome.IsEmpty(base.source.idBiome);
129
130 public virtual string IDGenerator => null;
131
132 public virtual string TextWidgetDate => "";
133
134 public MapGenerator Generator => ResourceCache.Load<MapGenerator>("DunGenProfile/Generator_" + GetDungenID());
135
136 public virtual string IdProfile => idProfile.IsEmpty(base.source.idProfile);
137
138 public virtual string IDPlayList => base.source.idPlaylist.IsEmpty((base.lv != 0) ? "Underground" : null);
139
140 public virtual string IDPlaylistOverwrite => null;
141
142 public virtual string IDHat => null;
143
144 public virtual string IDBaseLandFeat => base.Tile.source.trait[0];
145
146 public virtual string idExport
147 {
148 get
149 {
150 if (base.source.idFile.Length != 0)
151 {
152 return base.source.idFile[fileVariation] + ((base.lv == 0) ? "" : ("_F" + base.lv));
153 }
154 return "";
155 }
156 }
157
158 public string pathTemp => GameIO.pathTemp + base.uid + "/";
159
160 public Region Region => (this as Region) ?? (parent as Region);
161
163
165
166 public virtual bool BlockBorderExit => base.lv != 0;
167
169
171
172 public virtual ZoneFeatureType FeatureType => ZoneFeatureType.Default;
173
174 public virtual string IDAmbience
175 {
176 get
177 {
178 if (!IsRegion && !map.IsIndoor)
179 {
180 if (!IsTown)
181 {
182 return "forest";
183 }
184 return "town";
185 }
186 return null;
187 }
188 }
189
190 public virtual string IDSceneTemplate
191 {
192 get
193 {
194 if (!EClass._map.IsIndoor)
195 {
196 if (!IsSnowZone)
197 {
198 return "Default";
199 }
200 return "Snow";
201 }
202 return "Indoor";
203 }
204 }
205
206 public virtual bool IsFestival => false;
207
208 public virtual string IDSubset
209 {
210 get
211 {
212 if (!IsFestival)
213 {
214 return null;
215 }
216 return "festival";
217 }
218 }
219
220 public virtual bool IsTown => false;
221
222 public virtual bool CanBeDeliverDestination => IsTown;
223
224 public virtual bool CountDeepestLevel => false;
225
226 public virtual bool HasLaw => false;
227
228 public virtual bool MakeEnemiesNeutral
229 {
230 get
231 {
232 if (!IsTown)
233 {
234 return HasLaw;
235 }
236 return true;
237 }
238 }
239
240 public virtual bool MakeTownProperties => HasLaw;
241
242 public virtual bool AllowCriminal => !HasLaw;
243
244 public virtual bool AllowInvest
245 {
246 get
247 {
248 if (!IsTown && !IsPCFaction)
249 {
250 return Guild.GetCurrentGuild() != null;
251 }
252 return true;
253 }
254 }
255
256 public virtual bool AllowNewZone => true;
257
258 public virtual bool WillAutoSave => true;
259
260 public virtual bool RegenerateOnEnter => false;
261
262 public virtual bool IsSkyLevel => base.lv > 0;
263
264 public virtual bool IsUnderwater => false;
265
266 public virtual bool IsUserZone => false;
267
268 public virtual bool CanDigUnderground => false;
269
270 public virtual bool LockExit => true;
271
272 public virtual bool CanUnlockExit => !LockExit;
273
274 public virtual int MaxLv => 99999;
275
276 public virtual int MinLv => -99999;
277
278 public virtual bool AddPrefix => false;
279
280 public virtual bool IsNefia => false;
281
282 public virtual bool PetFollow => true;
283
284 public virtual bool RestrictBuild
285 {
286 get
287 {
288 if (this is Zone_Civilized)
289 {
290 return !IsPCFaction;
291 }
292 return false;
293 }
294 }
295
296 public virtual bool KeepAllyDistance
297 {
298 get
299 {
300 if (!HasLaw)
301 {
302 return IsPCFaction;
303 }
304 return true;
305 }
306 }
307
308 public virtual int MaxSpawn => map.bounds.Width * map.bounds.Height / 175 + 2;
309
310 public int MaxRespawn => (int)((float)MaxSpawn * RespawnRate) + 1;
311
312 public virtual float RuinChance => 0.1f;
313
314 public virtual float OreChance => 1f;
315
316 public virtual float BigDaddyChance => 0f;
317
318 public virtual float EvolvedChance => 0f;
319
320 public virtual float ShrineChance => 0f;
321
322 public virtual float PrespawnRate => 0f;
323
324 public virtual float RespawnRate => PrespawnRate * 0.5f;
325
327 {
328 get
329 {
330 if (instance != null)
331 {
333 }
334 return false;
335 }
336 }
337
338 public virtual int RespawnPerHour => MaxSpawn / 5 + 1;
339
340 public virtual float ChanceSpawnNeutral => 0.05f;
341
342 public virtual bool GrowPlant => base.mainFaction == EClass.pc.faction;
343
344 public virtual bool GrowWeed => GrowPlant;
345
346 public virtual bool IsExplorable => !base.isRandomSite;
347
348 public virtual bool IsReturnLocation
349 {
350 get
351 {
352 if (EClass.pc.homeZone != this)
353 {
354 return base.source.tag.Contains("return");
355 }
356 return true;
357 }
358 }
359
360 public virtual bool ShouldMakeExit
361 {
362 get
363 {
364 if (base.lv > MinLv)
365 {
366 return base.lv < MaxLv;
367 }
368 return false;
369 }
370 }
371
372 public virtual bool ShouldRegenerate => false;
373
374 public virtual bool ShouldAutoRevive
375 {
376 get
377 {
378 if (!ShouldRegenerate)
379 {
380 return IsPCFaction;
381 }
382 return true;
383 }
384 }
385
386 public virtual bool UseFog => base.lv < 0;
387
388 public virtual bool RevealRoom => false;
389
390 public virtual bool AlwaysLowblock => map.IsIndoor;
391
392 public virtual bool UseLight
393 {
394 get
395 {
396 if (base.mainFaction != EClass.pc.faction)
397 {
398 return base.source.tag.Contains("light");
399 }
400 return true;
401 }
402 }
403
404 public virtual int StartLV => 0;
405
406 public virtual ZoneScaleType ScaleType => ZoneScaleType.None;
407
408 public virtual bool HiddenInRegionMap => false;
409
410 public virtual FlockController.SpawnType FlockType => FlockController.SpawnType.Default;
411
412 public override string NameSuffix
413 {
414 get
415 {
416 if (!IsNefia || !GetTopZone().isConquered)
417 {
418 return "";
419 }
420 return "conquered".lang();
421 }
422 }
423
424 public string NameWithLevel => Name + TextLevel(base.lv);
425
426 public string TextDangerLv => "dangerLv".lang(DangerLv + ((DangerLvBoost == 0) ? "" : ("<size=15> +" + DangerLvBoost + "</size>")));
427
428 public string TextDeepestLv
429 {
430 get
431 {
432 if (GetDeepestLv() != 0)
433 {
434 return "zoneLevelMax".lang(TextLevel(GetDeepestLv()));
435 }
436 return "";
437 }
438 }
439
441 {
442 get
443 {
445 {
446 return base.mainFaction == EClass.pc.faction;
447 }
448 return true;
449 }
450 }
451
453 {
454 get
455 {
457 {
458 if (base.mainFaction == EClass.pc.faction)
459 {
460 return EClass.Branch.elements.Has(4003);
461 }
462 return false;
463 }
464 return true;
465 }
466 }
467
468 public bool IsPCFaction => base.mainFaction == EClass.pc.faction;
469
471 {
472 get
473 {
474 if (base.mainFaction != EClass.pc.faction)
475 {
476 return EClass._zone is Zone_Tent;
477 }
478 return true;
479 }
480 }
481
482 public bool IsStartZone => this == EClass.game.StartZone;
483
484 public bool IsInstance => instance != null;
485
486 public bool IsLoaded => map != null;
487
488 public virtual int BaseElectricity => 0;
489
490 public bool IsActiveZone => EClass.game.activeZone == this;
491
492 public bool CanInspect
493 {
494 get
495 {
496 if (!IsInstance)
497 {
498 return !HiddenInRegionMap;
499 }
500 return false;
501 }
502 }
503
504 public string InspectName => Name + ((IsTown || IsPCFaction || this is Zone_Civilized) ? "" : TextDangerLv);
505
506 public Point InspectPoint => null;
507
508 public Vector3 InspectPosition => default(Vector3);
509
510 public virtual int MaxSoil
511 {
512 get
513 {
514 if (branch == null)
515 {
516 return 99999;
517 }
518 return branch.MaxSoil;
519 }
520 }
521
522 public int Evalue(int ele)
523 {
524 return elements.Value(ele);
525 }
526
527 public int Evalue(string alias)
528 {
529 return elements.Value(EClass.sources.elements.alias[alias].id);
530 }
531
532 public virtual string GetDungenID()
533 {
534 return null;
535 }
536
537 public virtual bool ShouldScaleImportedChara(Chara c)
538 {
539 return false;
540 }
541
542 public virtual string GetNewZoneID(int level)
543 {
544 return base.source.id;
545 }
546
547 public override string ToString()
548 {
549 return Name + "(" + base.uid + ")(" + _regionPos?.ToString() + ") instance?" + IsInstance + "/" + EClass.world.date.GetRemainingHours(base.dateExpire) + "h";
550 }
551
552 public string TextLevel(int _lv)
553 {
554 if (_lv != 0)
555 {
556 if (base.lv <= 0)
557 {
558 return " " + "zoneLevelB".lang((_lv * -1).ToString() ?? "");
559 }
560 return " " + "zoneLevel".lang((_lv + 1).ToString() ?? "");
561 }
562 return "";
563 }
564
565 public override void OnCreate()
566 {
567 events.zone = this;
568 base.lv = StartLV;
569 }
570
571 public override void OnAfterCreate()
572 {
573 if (AddPrefix)
574 {
575 if (GetTopZone() == this)
576 {
577 base.idPrefix = EClass.sources.zoneAffixes.rows.RandomItem().id;
578 }
579 else
580 {
581 base.idPrefix = GetTopZone().idPrefix;
582 }
583 }
584 }
585
586 public void Activate()
587 {
588 if (IsRegion)
589 {
591 }
592 isStarted = (isSimulating = false);
593 base.isKnown = true;
594 EClass.game.config.reverseSnow = false;
596 {
597 Msg.Say("regenerateZone", Name);
598 ClearZones();
599 if (EClass.pc.global.transition != null)
600 {
601 EClass.pc.global.transition.uidLastZone = 0;
602 }
603 }
605 if (EClass.game.activeZone != null)
606 {
608 }
609 EClass.game.activeZone = this;
610 ZoneExportData zoneExportData = null;
611 Debug.Log(NameWithLevel + "/" + id + "/" + base.uid + "/" + base.isGenerated + "/" + IsLoaded + "/" + File.Exists(base.pathSave + "map"));
612 if (base.isGenerated && !IsLoaded && !File.Exists(base.pathSave + "map"))
613 {
614 Debug.Log("(Bug) File does not exist:" + destryoed + "/" + base.pathSave);
615 base.isGenerated = false;
616 }
617 bool flag = false;
618 Debug.Log(idCurrentSubset + "/" + IDSubset);
619 bool flag2 = idCurrentSubset != IDSubset || forceSubset != null;
620 if (flag2 && map != null)
621 {
622 UnloadMap();
623 }
624 Debug.Log(idExport + "/" + File.Exists(pathExport) + "/" + pathExport);
625 if (!base.isGenerated && (idExport.IsEmpty() || !File.Exists(pathExport)))
626 {
627 Debug.Log("generating random map");
628 flag = true;
629 base.dateExpire = EClass.world.date.GetRaw() + 1440 * ExpireDays;
630 Generate();
632 if (instance != null)
633 {
635 }
636 if (!UseFog)
637 {
638 map.ForeachCell(delegate(Cell c)
639 {
640 c.isSeen = true;
641 });
642 }
643 if (!(bp is GameBlueprint))
644 {
646 }
647 }
648 else if (IsLoaded)
649 {
650 Debug.Log("zone is already loaded");
651 map.SetZone(this);
652 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
654 }
655 else
656 {
657 subset = null;
658 bool flag3 = (base.isGenerated && flag2) || (base.isGenerated && !IsInstance && !IsPCFaction && ShouldRegenerate && EClass.world.date.IsExpired(base.dateRegenerate)) || forceRegenerate;
659 if (pathExport.IsEmpty() || !File.Exists(pathExport) || EClass.game.isLoading || EClass.player.simulatingZone)
660 {
661 flag3 = false;
662 flag2 = false;
663 }
664 Debug.Log(base.isGenerated + "/" + flag3 + "/" + flag2 + "/" + IDSubset);
665 if (!base.isGenerated || flag3 || flag2)
666 {
667 Debug.Log("importing map:" + pathExport);
668 flag = true;
669 base.dateRegenerate = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRegenerateZone;
670 if (!flag3)
671 {
672 IO.DeleteDirectory(pathTemp + "Texture Replace");
673 Debug.Log(pathTemp);
674 }
675 try
676 {
677 zoneExportData = Import(pathExport);
678 base.isGenerated = true;
679 isImported = true;
680 if (flag3)
681 {
682 zoneExportData.orgMap = GameIO.LoadFile<Map>(base.pathSave + "map");
683 }
684 }
685 catch (Exception message)
686 {
687 Debug.Log(message);
688 zoneExportData = Import(CorePath.ZoneSave + "fail.z");
689 base.isGenerated = true;
690 isImported = true;
691 }
692 }
694 Debug.Log("loading map: imported? " + isImported + " regenerate? " + flag3);
695 map = GameIO.LoadFile<Map>((isImported ? pathTemp : base.pathSave) + "map");
696 if (map == null)
697 {
698 EClass.ui.Say("System.IO.EndOfStreamException: Unexpected end of stream:" + Environment.NewLine + "File may be corrupted. Try replacing the following file if you have a backup:" + Environment.NewLine + (isImported ? pathTemp : base.pathSave) + "map");
699 return;
700 }
701 map.SetZone(this);
702 map.Load(isImported ? pathTemp : base.pathSave, isImported);
704 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
705 if (isImported)
706 {
707 map.deadCharas.Clear();
708 map.OnImport(zoneExportData);
709 if (UseFog && !flag3)
710 {
711 map.ForeachCell(delegate(Cell c)
712 {
713 c.isSeen = false;
714 });
715 }
716 if (zoneExportData.orgMap != null)
717 {
718 Map orgMap = zoneExportData.orgMap;
719 List<Chara> serializedCharas = map.serializedCharas;
720 map.charas = orgMap.charas;
721 map.serializedCharas = orgMap.serializedCharas;
722 map.deadCharas = orgMap.deadCharas;
723 byte[] array = orgMap.TryLoadFile(base.pathSave, "flags", EClass._map.Size * EClass._map.Size);
724 if (array != null && array.Length == EClass._map.Size * EClass._map.Size)
725 {
726 for (int i = 0; i < EClass._map.Size; i++)
727 {
728 for (int j = 0; j < EClass._map.Size; j++)
729 {
730 map.cells[i, j].isSeen = array[i * EClass._map.Size + j].GetBit(1);
731 }
732 }
733 }
734 foreach (Chara item in serializedCharas)
735 {
736 Debug.Log("Importing New Chara:" + item.id + "/" + item.Name + "/" + item.orgPos);
738 }
739 map.things.ForeachReverse(delegate(Thing t)
740 {
741 if (t.trait is TraitNewZone || t.trait is TraitPowerStatue)
742 {
743 foreach (Thing thing in orgMap.things)
744 {
745 if (t.id == thing.id && t.pos.Equals(thing.pos))
746 {
747 if (t.trait is TraitNewZone)
748 {
749 RemoveCard(t);
750 map.things.Insert(0, thing);
751 thing.stackOrder = 0;
752 }
753 else
754 {
755 t.ChangeMaterial(thing.material);
756 t.isOn = thing.isOn;
757 }
758 break;
759 }
760 }
761 return;
762 }
763 if (t.trait is TraitStairsLocked)
764 {
765 foreach (Thing thing2 in orgMap.things)
766 {
767 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
768 {
769 RemoveCard(t);
770 map.things.Add(thing2);
771 break;
772 }
773 }
774 return;
775 }
776 if (t.id == "medal" || t.id == "856")
777 {
778 foreach (Thing thing3 in orgMap.things)
779 {
780 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
781 {
782 return;
783 }
784 }
785 RemoveCard(t);
786 }
787 });
788 foreach (KeyValuePair<int, int> item2 in EClass._map.backerObjs.ToList())
789 {
790 EClass._map.GetCell(item2.Key);
791 SourceBacker.Row row = EClass.sources.backers.map[item2.Value];
793 {
794 map.backerObjs.Remove(item2.Key);
795 }
796 }
797 foreach (Chara serializedChara in map.serializedCharas)
798 {
799 if (serializedChara.orgPos != null && serializedChara.orgPos.IsValid)
800 {
801 serializedChara.pos.Set(serializedChara.orgPos);
802 }
803 }
804 foreach (Thing thing4 in orgMap.things)
805 {
806 if (thing4.trait is TraitTent && !thing4.isNPCProperty)
807 {
808 thing4.AddEditorTag(EditorTag.NoNpcProperty);
809 thing4.isSubsetCard = false;
810 map.things.Add(thing4);
811 Debug.Log(thing4);
812 }
813 }
814 }
815 }
816 foreach (Thing thing5 in map.things)
817 {
818 map.AddCardOnActivate(thing5);
819 }
820 foreach (Chara c3 in map.serializedCharas)
821 {
822 if (c3.c_uidMaster == 0 || EClass.player.listSummon.Find((Chara c2) => c2.uid == c3.uid) == null)
823 {
824 map.charas.Add(c3);
825 map.AddCardOnActivate(c3);
826 }
827 }
828 map.serializedCharas.Clear();
829 if (isImported && IsTown)
830 {
831 RefreshListCitizen();
832 }
833 map.RefreshAllTiles();
834 AddGlobalCharasOnActivate();
835 map.OnLoad();
836 if (flag3)
837 {
838 foreach (Card item3 in map.Cards.ToList())
839 {
840 if (item3.isSubsetCard)
841 {
842 item3.Destroy();
843 }
844 }
845 }
846 if (isImported)
847 {
848 idCurrentSubset = forceSubset ?? IDSubset;
849 if (idCurrentSubset != null)
850 {
851 subset = MapSubset.Load(idCurrentSubset);
852 subset.Apply();
853 }
854 }
855 if (isImported)
856 {
857 if (MakeTownProperties)
858 {
859 foreach (Thing thing6 in map.things)
860 {
861 thing6.isNPCProperty = !thing6.isHidden && !thing6.HasEditorTag(EditorTag.NoNpcProperty);
862 }
863 }
864 else
865 {
866 foreach (Thing thing7 in map.things)
867 {
868 thing7.isNPCProperty = false;
869 }
870 }
871 OnGenerateMap();
872 if (instance != null)
873 {
874 instance.OnGenerateMap();
875 }
876 }
877 if (isImported && !flag3 && !RevealRoom)
878 {
879 foreach (Room item4 in map.rooms.listRoom)
880 {
881 if (!item4.HasRoof || item4.data.atrium)
882 {
883 continue;
884 }
885 foreach (Point point2 in item4.points)
886 {
887 point2.cell.isSeen = false;
888 }
889 }
890 }
891 if (flag3)
892 {
893 OnRegenerate();
894 }
895 }
896 PathManager.Instance._pathfinder.PunishChangeDirection = false;
897 isImported = false;
898 if (this is Zone_Tent && IsUnderwater)
899 {
900 EClass._map.config.idSceneProfile = "indoor_water";
901 EClass.scene.profile = SceneProfile.Load(EClass._map.config.idSceneProfile);
902 }
903 if (flag && IsTown && base.lv == 0)
904 {
905 SpawnLostItems();
906 }
907 if (base.visitCount == 0)
908 {
909 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
910 }
911 map.ForeachCell(delegate(Cell c)
912 {
913 if (c.HasFire)
914 {
915 map.effectManager.GetOrCreate(c.GetSharedPoint());
916 }
917 if (IsRegion)
918 {
919 c.decal = 0;
920 }
921 });
923 {
924 RainWater();
925 }
927 {
928 map.ForeachCell(delegate(Cell c)
929 {
930 c.isSeen = true;
931 });
932 }
933 isStarted = true;
934 Map.isDirtySunMap = true;
935 map.RefreshAllTiles();
936 if (events.listPreEnter.Count > 0)
937 {
938 foreach (ZonePreEnterEvent item5 in events.listPreEnter)
939 {
940 item5.Execute();
941 }
942 events.listPreEnter.Clear();
943 }
944 foreach (Card card in map.Cards)
945 {
946 card.CalculateFOV();
947 if (card.isChara)
948 {
949 Chara chara = card.Chara;
950 chara.dirtySpeed = true;
951 if (!card.isDyed && card.HasTag(CTAG.random_color))
952 {
953 card.DyeRandom();
954 }
955 if (card.IsUnique && !card.IsPCFaction && !card.IsPCParty)
956 {
957 Point point = chara.orgPos ?? card.pos;
958 card.c_uniqueData = new UniqueData
959 {
960 x = point.x,
961 y = point.z,
962 uidZone = base.uid
963 };
964 }
965 int @int = card.GetInt(55);
966 if (@int != 0)
967 {
968 foreach (Chara chara2 in map.charas)
969 {
970 if (chara2.uid == @int)
971 {
972 if (chara.IsHostile(chara2))
973 {
974 chara.enemy = chara2;
975 chara.SetAI(new GoalCombat());
976 chara.calmCheckTurn = 20 + EClass.rnd(30);
977 }
978 break;
979 }
980 }
981 card.SetInt(55);
982 }
983 chara.SyncRide();
984 if (card.c_uidMaster != 0 && chara.master == null)
985 {
986 chara.FindMaster();
987 }
988 if (!EClass.game.isLoading)
989 {
990 chara.enemy = null;
991 if (chara.IsInCombat)
992 {
993 chara.SetNoGoal();
994 }
995 }
996 }
997 else if (card.IsInstalled && card.trait is TraitDoor traitDoor && card.pos.HasChara && !traitDoor.IsOpen())
998 {
999 traitDoor.ToggleDoor(sound: false, refresh: false);
1000 }
1001 }
1002 RefreshHat();
1003 forceRegenerate = false;
1004 forceSubset = null;
1005 EClass.ui.OnActivateZone();
1007 EClass.Sound.LoadAmbience(IDAmbience);
1008 if (EClass.Branch != null)
1009 {
1011 }
1012 OnVisit();
1013 if (flag)
1014 {
1015 OnVisitNewMapOrRegenerate();
1016 }
1018 if (IsPCFaction)
1019 {
1020 EClass.player.uidLastTown = 0;
1021 }
1022 else if (IsTown && base.lv == 0)
1023 {
1024 EClass.player.uidLastTown = base.uid;
1025 }
1026 RefreshBGM();
1027 Rand.InitBytes(map.seed + 1);
1028 RefreshElectricity();
1029 okaerinko = 0;
1030 if (EClass.debug.enable)
1031 {
1032 ModInfluence(2000);
1033 }
1034 if (this is Zone_TinkerCamp)
1035 {
1036 Tutorial.Reserve("tinker");
1037 }
1038 else if (this is Zone_Town && !(this is Zone_SubTown))
1039 {
1040 Tutorial.Reserve("town");
1041 }
1042 }
1043
1044 public void RefreshHat()
1045 {
1046 if (idHat != null && EClass.world.date.IsExpired(base.dateHat))
1047 {
1048 idHat = null;
1049 base.dateHat = 0;
1050 }
1051 sourceHat = ((idHat != null) ? EClass.sources.cards.map[idHat] : ((IDHat != null) ? EClass.sources.cards.map[IDHat] : null));
1052 }
1053
1054 public void OnVisit()
1055 {
1056 if (CountDeepestLevel && DangerLv > EClass.player.stats.deepest)
1057 {
1058 EClass.player.stats.deepest = DangerLv;
1059 }
1060 if (EClass.world.date.IsExpired(base.dateRevive))
1061 {
1062 ResetHostility();
1063 Revive();
1064 foreach (Chara chara in EClass._map.charas)
1065 {
1066 chara.TryRestock(onCreate: false);
1067 if (!chara.IsPCFaction)
1068 {
1069 chara.c_fur = 0;
1070 }
1071 }
1072 }
1073 RefreshCriminal();
1075 events.OnVisit();
1076 OnActivate();
1077 UpdateQuests();
1078 OnBeforeSimulate();
1079 isSimulating = true;
1080 Simulate();
1081 isSimulating = false;
1082 OnAfterSimulate();
1083 if (EClass.Branch != null)
1084 {
1086 }
1087 base.lastActive = EClass.world.date.GetRaw();
1088 if (!EClass.game.isLoading)
1089 {
1090 base.visitCount++;
1091 }
1092 base.version = EClass.core.version.GetInt();
1093 }
1094
1095 public void Revive()
1096 {
1097 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
1098 if (ShouldAutoRevive)
1099 {
1100 foreach (Chara deadChara in map.deadCharas)
1101 {
1102 if (deadChara.trait.CanAutoRevive && deadChara.CanRevive())
1103 {
1104 deadChara.Revive();
1106 {
1107 deadChara.RemoveBacker();
1108 }
1109 EClass._zone.AddCard(deadChara, (deadChara.orgPos != null && deadChara.orgPos.IsInBounds) ? deadChara.orgPos : deadChara.pos);
1110 }
1111 }
1112 }
1113 foreach (Chara value in EClass.game.cards.globalCharas.Values)
1114 {
1115 if (value.isDead && value.CanRevive() && value.homeZone == this)
1116 {
1117 value.Revive();
1118 Point point = GetSpawnPos(value);
1119 if (value.orgPos != null && value.orgPos.IsInBounds)
1120 {
1121 point = value.orgPos.GetNearestPoint() ?? point;
1122 }
1123 EClass._zone.AddCard(value, point);
1124 }
1125 }
1126 map.deadCharas.Clear();
1127 }
1128
1129 public virtual void OnRegenerate()
1130 {
1131 }
1132
1133 public virtual void OnActivate()
1134 {
1135 }
1136
1137 public virtual void OnBeforeDeactivate()
1138 {
1139 }
1140
1141 public virtual void OnDeactivate()
1142 {
1143 }
1144
1145 public virtual void OnBeforeSimulate()
1146 {
1147 }
1148
1149 public virtual void OnVisitNewMapOrRegenerate()
1150 {
1151 }
1152
1153 public virtual void OnAfterSimulate()
1154 {
1155 }
1156
1157 public virtual void OnAdvanceHour()
1158 {
1159 }
1160
1161 public void Simulate()
1162 {
1163 if (!EClass.game.isLoading && base.visitCount > 0)
1164 {
1165 if (Boss != null && IsNefia)
1166 {
1167 Msg.Say("bossLeave", Boss.Name.ToTitleCase(), EClass._zone.Name);
1170 }
1171 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1172 foreach (Chara chara2 in EClass._map.charas)
1173 {
1174 if (chara2.hp < 0)
1175 {
1176 chara2.hp = 0;
1177 }
1178 if (!chara2.IsPCParty)
1179 {
1180 if (chara2.mana.value < 0)
1181 {
1182 chara2.mana.value = 0;
1183 }
1184 if (chara2.stamina.value < 0)
1185 {
1186 chara2.stamina.value = 0;
1187 }
1188 }
1189 if (num > 60)
1190 {
1191 chara2.resistCon = null;
1192 }
1193 if (chara2.rarity >= Rarity.Legendary && !chara2.IsPCFaction && num > 0)
1194 {
1195 Msg.ignoreAll = true;
1196 chara2.Cure(CureType.Boss, 20 + num * 10);
1197 chara2.HealHP(Mathf.Max(1, chara2.MaxHP) * Mathf.Min(num, 20) / 20);
1198 chara2.mana.Mod(Mathf.Max(1, chara2.mana.max) * Mathf.Min(num, 20) / 20);
1199 chara2.stamina.Mod(Mathf.Max(1, chara2.stamina.max) * Mathf.Min(num, 20) / 20);
1200 Msg.ignoreAll = false;
1201 }
1202 }
1203 }
1204 Debug.Log("Last Active:" + base.lastActive);
1205 if (base.lastActive == 0 || HourSinceLastActive <= 1 || IsRegion)
1206 {
1207 return;
1208 }
1209 Debug.Log(Name + " Simulate:" + HourSinceLastActive + " hours");
1210 VirtualDate virtualDate = new VirtualDate(HourSinceLastActive);
1211 List<Chara> list = EClass._map.charas.ToList();
1212 int num2 = HourSinceLastActive / 24;
1213 int num3 = 0;
1214 if (num2 > 0)
1215 {
1216 foreach (Chara item in list)
1217 {
1218 if (!item.IsPCParty)
1219 {
1220 item.OnSleep(200, num2);
1221 if (item.conSleep != null)
1222 {
1223 item.conSleep.Kill();
1224 }
1225 if (EClass.rnd(EClass.world.date.IsNight ? 20 : 200) == 0 && !item.IsPCFaction)
1226 {
1227 item.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
1228 }
1229 if (item.things.Count > 20)
1230 {
1231 item.ClearInventory(ClearInventoryType.Purge);
1232 }
1233 }
1234 }
1235 }
1236 VirtualDate.current = virtualDate;
1237 for (int i = 0; i < HourSinceLastActive; i++)
1238 {
1239 virtualDate.SimulateHour();
1240 if (!virtualDate.IsWinter)
1241 {
1242 num3++;
1243 }
1244 }
1245 EClass._map.things.ForeachReverse(delegate(Thing t)
1246 {
1247 t.DecayNatural(HourSinceLastActive);
1248 });
1249 VirtualDate.current = null;
1250 if (!IsPCFaction)
1251 {
1252 return;
1253 }
1254 int num4 = 0;
1255 foreach (Chara item2 in list)
1256 {
1257 if (item2.IsPCParty)
1258 {
1259 continue;
1260 }
1261 if (!item2.IsHomeMember())
1262 {
1263 if (item2.id == "bee")
1264 {
1265 num4++;
1266 }
1267 if (num2 > 0 && item2.IsGuest())
1268 {
1269 item2.ChooseNewGoal();
1270 item2.ai.SimulateZone(num2);
1271 }
1272 continue;
1273 }
1274 if (num2 > 0)
1275 {
1276 Goal goalWork = item2.GetGoalWork();
1277 item2.SetAI(goalWork);
1278 if (goalWork is GoalWork)
1279 {
1280 (goalWork as GoalWork).FindWork(item2);
1281 }
1282 item2.ai.SimulateZone(num2);
1283 goalWork = item2.GetGoalHobby();
1284 item2.SetAI(goalWork);
1285 if (goalWork is GoalWork)
1286 {
1287 (goalWork as GoalWork).FindWork(item2);
1288 }
1289 item2.ai.SimulateZone(num2);
1290 }
1291 item2.ChooseNewGoal();
1292 if (item2.conSuspend == null)
1293 {
1294 item2.ai.OnSimulatePosition();
1295 }
1296 }
1297 List<Thing> list2 = new List<Thing>();
1298 foreach (Thing thing in map.things)
1299 {
1300 if (thing.IsInstalled && thing.trait is TraitBeekeep)
1301 {
1302 list2.Add(thing);
1303 }
1304 }
1305 if (num4 >= list2.Count)
1306 {
1307 return;
1308 }
1309 for (int j = num4; j < list2.Count; j++)
1310 {
1311 if (EClass.rnd(200) <= HourSinceLastActive)
1312 {
1313 Chara chara = CharaGen.Create("bee");
1314 AddCard(chara, list2.RandomItem().pos);
1315 Hostility c_originalHostility = (chara.hostility = Hostility.Neutral);
1316 chara.c_originalHostility = c_originalHostility;
1317 }
1318 }
1319 }
1320
1322 {
1323 ZoneTransition zoneTransition = c.global?.transition;
1324 Zone zone = zoneTransition?.lastZone;
1325 ZoneTransition.EnterState enterState = zoneTransition?.state ?? destState;
1326 bool flag = zone == null || zone.lv > base.lv;
1327 if (IsRegion)
1328 {
1329 if (zone != null && !EClass.player.simulatingZone)
1330 {
1331 Zone topZone = zone.GetTopZone();
1332 if (GetZoneAt(topZone.x, topZone.y) != null)
1333 {
1334 return new Point(topZone.mapX, topZone.mapY);
1335 }
1336 }
1337 }
1338 else if (c.IsPC && EClass.player.lastZonePos != null && zone != null && zone.IsRegion && (enterState == ZoneTransition.EnterState.Left || enterState == ZoneTransition.EnterState.Right || enterState == ZoneTransition.EnterState.Top || enterState == ZoneTransition.EnterState.Bottom))
1339 {
1340 return EClass.player.lastZonePos;
1341 }
1342 if (enterState == ZoneTransition.EnterState.Region)
1343 {
1344 enterState = RegionEnterState;
1345 }
1346 if (this is Zone_Kapul && enterState == ZoneTransition.EnterState.Left)
1347 {
1348 enterState = ZoneTransition.EnterState.Right;
1349 }
1350 float rate = zoneTransition?.ratePos ?? (-1f);
1351 if (IsPCFaction)
1352 {
1353 if ((uint)(enterState - 3) <= 4u || enterState == ZoneTransition.EnterState.Return)
1354 {
1356 if (spot != null)
1357 {
1358 Point nearestPoint = (spot.trait as TraitSpotGuidePC).GetRandomPoint((Point p) => !p.IsBlocked && !p.Equals(spot.pos)).GetNearestPoint();
1359 if (nearestPoint != null && nearestPoint.IsValid)
1360 {
1361 return nearestPoint;
1362 }
1363 }
1364 }
1365 }
1366 while (true)
1367 {
1368 switch (enterState)
1369 {
1370 case ZoneTransition.EnterState.UndergroundOrSky:
1371 return new Point(zoneTransition.x, zoneTransition.z);
1372 case ZoneTransition.EnterState.Teleport:
1373 {
1374 foreach (Thing thing2 in map.things)
1375 {
1376 if (thing2.IsInstalled)
1377 {
1378 TraitTeleporter traitTeleporter = thing2.trait as TraitTeleporter;
1379 if (traitTeleporter != null)
1380 {
1381 Debug.Log(zoneTransition.idTele + "/" + traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)) + "/" + traitTeleporter.GetParam(3));
1382 }
1383 if (traitTeleporter != null && !zoneTransition.idTele.IsEmpty() && zoneTransition.idTele == traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)))
1384 {
1385 return thing2.pos.GetNearestPoint();
1386 }
1387 }
1388 }
1389 foreach (Thing thing3 in map.things)
1390 {
1391 if (thing3.IsInstalled && thing3.trait is TraitTeleporter traitTeleporter2 && traitTeleporter2.IsFor(zoneTransition.lastZone))
1392 {
1393 return thing3.pos.GetNearestPoint();
1394 }
1395 }
1396 Thing randomThing2 = EClass._map.props.installed.traits.GetRandomThing<TraitTeleporter>();
1397 if (randomThing2 != null)
1398 {
1399 return randomThing2.pos.GetNearestPoint();
1400 }
1401 goto case ZoneTransition.EnterState.Return;
1402 }
1403 case ZoneTransition.EnterState.Return:
1404 case ZoneTransition.EnterState.Elevator:
1405 case ZoneTransition.EnterState.Moongate:
1406 {
1407 if (enterState == ZoneTransition.EnterState.Elevator)
1408 {
1409 foreach (Thing thing4 in map.things)
1410 {
1411 if (thing4.IsInstalled && thing4.trait is TraitElevator traitElevator && traitElevator.IsFor(zoneTransition.lastZone))
1412 {
1413 return thing4.pos.GetNearestPoint();
1414 }
1415 }
1416 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<TraitElevator>();
1417 if (randomThing != null)
1418 {
1419 return randomThing.pos.GetNearestPoint();
1420 }
1421 }
1422 Thing thing = null;
1423 thing = map.props.installed.traits.GetRandomThing<TraitWaystone>();
1424 if (thing != null)
1425 {
1426 return thing.pos.GetNearestPoint();
1427 }
1428 thing = map.props.installed.traits.GetRandomThing<TraitCoreZone>();
1429 if (thing != null)
1430 {
1431 return thing.pos.GetNearestPoint();
1432 }
1433 if (base.lv == 0)
1434 {
1435 goto IL_04a1;
1436 }
1437 flag = base.lv <= 0;
1438 break;
1439 }
1440 case ZoneTransition.EnterState.Center:
1441 case ZoneTransition.EnterState.Encounter:
1442 if (map.config.embarkX != 0)
1443 {
1444 return new Point(map.config.embarkX, map.config.embarkY);
1445 }
1446 return map.GetCenterPos().GetNearestPoint(allowBlock: false, allowChara: false);
1447 case ZoneTransition.EnterState.Top:
1448 return map.bounds.GetTopPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1449 case ZoneTransition.EnterState.Right:
1450 return map.bounds.GetRightPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1451 case ZoneTransition.EnterState.Bottom:
1452 return map.bounds.GetBottomPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1453 case ZoneTransition.EnterState.Left:
1454 return map.bounds.GetLeftPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1455 case ZoneTransition.EnterState.Dead:
1456 case ZoneTransition.EnterState.Exact:
1457 case ZoneTransition.EnterState.PortalReturn:
1458 case ZoneTransition.EnterState.Fall:
1459 if (zoneTransition.x == 0 && EClass._map.bounds.x != 0)
1460 {
1461 return new Point(map.config.embarkX, map.config.embarkY);
1462 }
1463 return new Point(zoneTransition.x, zoneTransition.z);
1464 case ZoneTransition.EnterState.RandomVisit:
1465 return GetRandomVisitPos(c);
1466 case ZoneTransition.EnterState.Down:
1467 flag = true;
1468 break;
1469 case ZoneTransition.EnterState.Up:
1470 flag = false;
1471 break;
1472 }
1473 break;
1474 IL_04a1:
1475 enterState = ZoneTransition.EnterState.Center;
1476 }
1477 foreach (Thing thing5 in map.things)
1478 {
1479 if (thing5.trait is TraitNewZone { zone: not null } traitNewZone && zone != null && traitNewZone.zone.uid == zone.uid)
1480 {
1481 if (c != null && enterState != 0)
1482 {
1483 c.SetDir(traitNewZone.owner.dir);
1484 }
1485 return traitNewZone.GetExitPos();
1486 }
1487 }
1488 foreach (Thing thing6 in map.things)
1489 {
1490 if (thing6.trait is TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1491 {
1492 if (c != null && enterState != 0)
1493 {
1494 c.SetDir(traitNewZone2.owner.dir);
1495 }
1496 return traitNewZone2.GetExitPos();
1497 }
1498 }
1499 return GetRandomVisitPos(c);
1500 }
1501
1503 {
1504 Point point = null;
1505 if (EClass.rnd(3) == 0 && map.rooms.listRoom.Count > 0)
1506 {
1507 point = map.rooms.listRoom.RandomItem().points.RandomItem();
1508 }
1509 if (point == null && EClass.rnd(4) != 0)
1510 {
1511 IEnumerable<Chara> ie = map.charas.Where((Chara t) => t.trait.ShopType != 0 && t.pos != null && t.pos.IsValid);
1512 if (ie.Count() > 0)
1513 {
1514 point = ie.RandomItem().pos.GetRandomPoint(3);
1515 }
1516 }
1517 if (point == null)
1518 {
1519 point = map.bounds.GetRandomSurface(centered: false, walkable: true, !IsPCFaction && !(this is Zone_Civilized)) ?? map.bounds.GetRandomPoint();
1520 }
1521 return point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false) ?? EClass._map.GetCenterPos();
1522 }
1523
1525 {
1526 Point spawnPosPC = null;
1527 if (EClass.pc.currentZone == this)
1528 {
1529 spawnPosPC = GetSpawnPos(EClass.pc);
1530 }
1531 if (spawnPosPC == null)
1532 {
1533 spawnPosPC = map.GetCenterPos();
1534 }
1535 if (spawnPosPC.IsValid && EClass.pc.global.transition != null && spawnPosPC.HasBlock)
1536 {
1537 spawnPosPC = spawnPosPC.GetNearestPoint();
1538 }
1539 spawnPosPC = spawnPosPC.Clamp(useBounds: true).GetNearestPoint();
1540 foreach (Chara c in EClass.game.cards.globalCharas.Values)
1541 {
1542 if (c.currentZone != this)
1543 {
1544 continue;
1545 }
1546 if (c.parent is Chara)
1547 {
1548 Chara chara = c.parent as Chara;
1549 c.currentZone = chara.currentZone;
1550 }
1551 else
1552 {
1553 if (c.isDead)
1554 {
1555 continue;
1556 }
1557 if (c.isRestrained && c.currentZone == EClass.pc.currentZone && (!c.pos.IsValid || c.pos.FindThing<TraitShackle>() == null))
1558 {
1559 c.isRestrained = false;
1560 }
1561 if (c.global.transition != null)
1562 {
1563 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true) : GetSpawnPos(c)));
1564 if (c.IsPCParty && !c.IsPC)
1565 {
1566 if (c.host == EClass.pc)
1567 {
1568 pos.Set(spawnPosPC);
1569 }
1570 else if (pos.Equals(spawnPosPC) || !PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
1571 {
1572 c.pos.Set(spawnPosPC);
1573 if (!spawnPosPC.ForeachNearestPoint(delegate(Point p)
1574 {
1575 if (PathManager.Instance.IsPathClear(spawnPosPC, p, c, 10) && !p.Equals(spawnPosPC))
1576 {
1577 pos.Set(p);
1578 return true;
1579 }
1580 return false;
1581 }, allowBlock: false, EClass.pc.party.members.Count >= 12, allowInstalled: true, ignoreCenter: true, EClass._zone.IsRegion ? 2 : 6))
1582 {
1583 pos.Set(spawnPosPC);
1584 }
1585 }
1586 }
1587 c.pos.Set(pos);
1588 c.global.transition = null;
1589 }
1590 map.charas.Add(c);
1591 map.AddCardOnActivate(c);
1592 }
1593 }
1594 foreach (Chara item in EClass.player.listSummon)
1595 {
1596 Point nearestPoint = spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true);
1597 item.enemy = null;
1598 item.pos.Set(nearestPoint);
1599 map.charas.Add(item);
1601 }
1602 EClass.player.listSummon.Clear();
1603 }
1604
1605 public void Deactivate()
1606 {
1607 if (!IsUserZone && !IsPCFaction && map != null)
1608 {
1609 List<Thing> list = new List<Thing>();
1610 foreach (Thing thing in map.things)
1611 {
1612 if (thing.rarity >= Rarity.Artifact && thing.HasTag(CTAG.godArtifact))
1613 {
1614 list.Add(thing);
1615 }
1616 }
1617 if (this is Zone_Tent)
1618 {
1619 foreach (Thing item in map.props.stocked.Things.Concat(map.props.roaming.Things))
1620 {
1621 if (item.IsContainer)
1622 {
1623 foreach (Thing thing2 in item.things)
1624 {
1625 if (thing2.trait is TraitTent)
1626 {
1627 list.Add(thing2);
1628 }
1629 }
1630 }
1631 if (item.trait is TraitTent)
1632 {
1633 list.Add(item);
1634 }
1635 }
1636 }
1637 if (list.Count > 0)
1638 {
1639 Msg.Say("pick_valuable");
1640 foreach (Thing item2 in list)
1641 {
1642 Msg.Say("pick_valuable2", item2);
1643 EClass.pc.AddCard(item2);
1644 }
1645 }
1646 }
1647 base.isPeace = false;
1648 OnBeforeDeactivate();
1649 if (IsPCFaction)
1650 {
1651 foreach (Chara member in branch.members)
1652 {
1653 member.ValidateWorks();
1654 }
1655 }
1656 EClass.game.lastActiveZone = EClass.game.activeZone;
1657 base.lastActive = EClass.world.date.GetRaw();
1658 map.OnDeactivate();
1659 EClass.scene.Clear();
1660 EClass.game.activeZone = null;
1661 if (IsInstance)
1662 {
1663 UnloadMap();
1664 base.isGenerated = false;
1665 }
1666 if (forceRegenerate)
1667 {
1668 UnloadMap();
1669 }
1670 OnDeactivate();
1671 }
1672
1673 public void OnKillGame()
1674 {
1675 foreach (Thing thing in map.things)
1676 {
1677 if (thing.renderer.hasActor)
1678 {
1679 thing.renderer.KillActor();
1680 }
1681 }
1682 }
1683
1684 public void UnloadMap()
1685 {
1686 map = null;
1687 if (bp != null)
1688 {
1689 bp.map = null;
1690 }
1691 if (branch != null)
1692 {
1693 branch.OnUnloadMap();
1694 }
1695 Debug.Log("Unloaded Map:" + this);
1696 }
1697
1698 public void ClaimZone(bool debug = false, Point pos = null)
1699 {
1701 SetMainFaction(EClass.pc.faction);
1702 branch = new FactionBranch();
1703 branch.OnCreate(this);
1704 if (base.icon == 0)
1705 {
1706 base.icon = 332;
1707 }
1708 instance = null;
1709 base.dateExpire = 0;
1710 SetInt(2, EClass.world.date.GetRaw());
1711 Register();
1712 foreach (Thing thing in map.things)
1713 {
1714 thing.isNPCProperty = false;
1715 }
1718 if (debug)
1719 {
1720 for (int i = 0; i < 7; i++)
1721 {
1722 Chara chara = CharaGen.CreateFromFilter("c_neutral");
1723 EClass._zone.AddCard(chara, EClass._map.bounds.GetRandomPoint().GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false));
1724 branch.AddMemeber(chara);
1725 }
1726 }
1727 else
1728 {
1729 Msg.Say("claimedZone");
1730 EClass.Branch.Log("claimedZone");
1731 EClass.Sound.Play("jingle_embark");
1732 EClass.pc.PlaySound("build");
1733 if (pos == null)
1734 {
1735 pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: true, allowInstalled: false);
1736 }
1737 Effect.Get("aura_heaven").Play(pos);
1738 EClass._zone.AddCard(ThingGen.Create("core_zone"), pos).SetPlaceState(PlaceState.installed);
1739 }
1740 base.idPrefix = 0;
1742 {
1743 EClass.player.spawnZone = EClass._zone;
1744 }
1746 {
1747 EClass._zone.SetBGM(new List<int> { 41, 90, 44, 43 });
1749 }
1750 }
1751
1752 public void AbandonZone()
1753 {
1754 FactionBranch destBranch = ((EClass.pc.homeBranch == branch) ? EClass.game.StartZone.branch : EClass.pc.homeBranch);
1755 branch.members.ForeachReverse(delegate(Chara m)
1756 {
1757 destBranch.AddMemeber(m);
1758 if (!m.IsPCParty)
1759 {
1760 m.MoveZone(destBranch.owner);
1761 }
1762 });
1764 SetMainFaction(null);
1765 base.dateExpire = EClass.world.date.GetRaw() + 10080;
1766 }
1767
1768 public bool CanDestroy()
1769 {
1770 if (IsActiveZone || IsPCFaction || EClass.player.simulatingZone)
1771 {
1772 return false;
1773 }
1774 if (IsInstance)
1775 {
1776 return true;
1777 }
1778 bool flag = false;
1779 if (id == "cave_yeek" && !(this is Zone_DungeonYeek))
1780 {
1781 flag = true;
1782 }
1783 Zone topZone = GetTopZone();
1784 if (!flag)
1785 {
1786 if (base.dateExpire == 0 || !EClass.world.date.IsExpired(base.dateExpire))
1787 {
1788 return false;
1789 }
1790 if (!base.isRandomSite && !(this is Zone_Field) && (topZone == null || topZone == this || topZone.FindDeepestZone() == this))
1791 {
1792 return false;
1793 }
1794 }
1795 if (EClass.pc.currentZone == null || EClass.pc.currentZone is Zone_Tent || topZone == EClass.pc.currentZone.GetTopZone() || (EClass.player.nextZone != null && topZone == EClass.player.nextZone.GetTopZone()))
1796 {
1797 return false;
1798 }
1800 {
1802 if (zone != null && zone.GetTopZone() == this)
1803 {
1804 return false;
1805 }
1806 }
1807 return true;
1808 }
1809
1810 public override void _OnBeforeSave()
1811 {
1812 if (CanDestroy())
1813 {
1814 Debug.Log("Deleting Zone:" + this);
1815 if (!destryoed)
1816 {
1817 Destroy();
1818 }
1819 }
1820 else if (map != null)
1821 {
1822 Debug.Log("Saving Zone:" + this);
1823 map.Save(base.pathSave);
1824 if (!base.isMapSaved)
1825 {
1826 base.isMapSaved = true;
1827 IO.DeleteDirectory(base.pathSave + "Texture Replace");
1828 IO.CopyDir(pathTemp + "Texture Replace", base.pathSave + "/Texture Replace");
1829 }
1830 if (!IsActiveZone)
1831 {
1832 UnloadMap();
1833 }
1834 }
1835 }
1836
1837 public override void OnLoad()
1838 {
1839 if (branch != null)
1840 {
1841 branch.SetOwner(this);
1842 }
1843 events.OnLoad(this);
1844 }
1845
1846 public override void Destroy()
1847 {
1848 children.ForeachReverse(delegate(Spatial z)
1849 {
1850 z.Destroy();
1851 });
1852 if (map != null)
1853 {
1854 UnloadMap();
1855 }
1856 if (parent != null && parent.IsRegion && instance == null)
1857 {
1858 EClass.scene.elomap.SetZone(base.x, base.y, null, updateMesh: true);
1859 }
1860 EClass.game.spatials.Remove(this);
1861 destryoed = true;
1862 base.isGenerated = false;
1863 }
1864
1865 public void ClearZones(Zone current = null)
1866 {
1867 if (map != null)
1868 {
1869 UnloadMap();
1870 }
1871 base.isGenerated = false;
1872 Zone topZone = GetTopZone();
1873 if (topZone != this)
1874 {
1875 topZone.ClearZones(this);
1876 return;
1877 }
1878 children.ForeachReverse(delegate(Spatial c)
1879 {
1880 if (c != current)
1881 {
1882 c.Destroy();
1883 }
1884 });
1885 }
1886
1887 public void OnChildNumChange(Card c)
1888 {
1889 }
1890
1892 {
1893 return this;
1894 }
1895
1897 {
1898 if (parent == null || parent.IsRegion)
1899 {
1900 return this;
1901 }
1902 return parent as Zone;
1903 }
1904
1905 public Card AddCardSplinkle(Card t, Point center, int radius = 4)
1906 {
1907 Point point = new Point(center);
1908 for (int i = 0; i < 1000; i++)
1909 {
1910 point.x = center.x + EClass.rnd(radius) - EClass.rnd(radius);
1911 point.z = center.z + EClass.rnd(radius) - EClass.rnd(radius);
1912 if (point.IsValid && !point.IsBlocked && !point.HasChara)
1913 {
1914 return AddCard(t, point);
1915 }
1916 }
1917 return AddCard(t, center);
1918 }
1919
1920 public Chara AddChara(string id, int x, int z)
1921 {
1922 return AddCard(CharaGen.Create(id), x, z) as Chara;
1923 }
1924
1925 public Card AddThing(string id, int x, int z)
1926 {
1927 return AddCard(ThingGen.Create(id), x, z);
1928 }
1929
1930 public Card AddThing(string id, Point p)
1931 {
1932 return AddThing(id, p.x, p.z);
1933 }
1934
1935 public Card AddCard(Card t, Point point)
1936 {
1937 return AddCard(t, point.x, point.z);
1938 }
1939
1941 {
1942 return AddCard(t, 0, 0);
1943 }
1944
1945 public Card AddCard(Card t, int x, int z)
1946 {
1947 if (t.parent != null)
1948 {
1949 t.parent.RemoveCard(t);
1950 }
1951 t.parent = this;
1952 Chara chara = t.Chara;
1953 if (chara != null)
1954 {
1955 chara.currentZone = this;
1956 chara.SetAI(new NoGoal());
1957 }
1958 if (IsActiveZone)
1959 {
1960 map.OnCardAddedToZone(t, x, z);
1961 if (isStarted && t.isThing && t.placeState == PlaceState.roaming && !ignoreSpawnAnime)
1962 {
1963 t.PlayAnimeLoot();
1964 }
1965 ignoreSpawnAnime = false;
1966 }
1967 if (chara != null && EClass.player != null && !chara.hasSpawned)
1968 {
1969 EClass.player.codex.AddSpawn(chara.id);
1970 chara.hasSpawned = true;
1971 }
1972 return t;
1973 }
1974
1975 public void RemoveCard(Card t)
1976 {
1977 if (IsActiveZone)
1978 {
1979 map.OnCardRemovedFromZone(t);
1980 }
1981 t.parent = null;
1982 if (t.isChara)
1983 {
1984 t.Chara.currentZone = null;
1985 }
1986 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
1987 {
1989 }
1990 if (t.renderer.hasActor)
1991 {
1993 }
1994 }
1995
1996 public T GetRandomSpot<T>() where T : Trait
1997 {
1998 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
1999 }
2000
2001 public bool TryAddThingInSpot<T>(Thing t, bool useContainer = true) where T : Trait
2002 {
2003 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<T>();
2004 if (randomThing == null)
2005 {
2006 AddCard(t, EClass._map.bounds.GetRandomSurface());
2007 return false;
2008 }
2009 if (useContainer && (!t.IsContainer || t.things.Count == 0))
2010 {
2011 List<Thing> list = new List<Thing>();
2012 foreach (Point item in randomThing.trait.ListPoints(null, onlyPassable: false))
2013 {
2014 foreach (Card item2 in item.ListCards())
2015 {
2016 if (item2.IsContainer && !(item2.trait is TraitDeliveryChest))
2017 {
2018 list.Add(item2.Thing);
2019 }
2020 }
2021 }
2022 if (TryAddThingInSharedContainer(t, list, add: true, msg: false, null, sharedOnly: false))
2023 {
2024 return true;
2025 }
2026 }
2027 AddCard(t, randomThing.trait.GetRandomPoint());
2028 return true;
2029 }
2030
2031 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func = null) where T : TraitSpot
2032 {
2033 List<T> list = new List<T>();
2034 List<Thing> list2 = new List<Thing>();
2035 foreach (Thing thing in EClass._map.things)
2036 {
2037 if (thing.IsInstalled && thing.trait is T)
2038 {
2039 list.Add(thing.trait as T);
2040 }
2041 }
2042 foreach (T item in list)
2043 {
2044 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2045 {
2046 foreach (Thing thing2 in item2.Things)
2047 {
2048 if (!thing2.IsInstalled)
2049 {
2050 continue;
2051 }
2052 if (thing2.things.Count == 0)
2053 {
2054 if (IsValid(thing2))
2055 {
2056 list2.Add(thing2);
2057 }
2058 continue;
2059 }
2060 foreach (Thing item3 in thing2.things.List((Thing _t) => IsValid(_t)))
2061 {
2062 list2.Add(item3);
2063 }
2064 }
2065 }
2066 }
2067 return list2;
2068 bool IsValid(Thing t)
2069 {
2070 if (func != null && !func(t))
2071 {
2072 return false;
2073 }
2074 return true;
2075 }
2076 }
2077
2078 public bool TryAddThingInSharedContainer(Thing t, List<Thing> containers = null, bool add = true, bool msg = false, Chara chara = null, bool sharedOnly = true)
2079 {
2080 Thing dest = null;
2081 int priority = -1;
2082 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
2083 if (flag == ContainerFlag.none)
2084 {
2085 flag = ContainerFlag.other;
2086 }
2087 if (containers == null)
2088 {
2089 containers = EClass._map.props.installed.containers;
2090 }
2091 if (SearchDest() != null)
2092 {
2093 return true;
2094 }
2095 if (dest == null)
2096 {
2097 return false;
2098 }
2099 if (add)
2100 {
2101 if (msg)
2102 {
2103 chara.Say("putSharedItem", chara, t, dest.GetName(NameStyle.Full));
2104 }
2105 dest.AddThing(t);
2106 }
2107 return true;
2108 Thing SearchDest()
2109 {
2110 foreach (Thing container in containers)
2111 {
2112 Thing thing = container;
2113 if (thing.trait is TraitShippingChest)
2114 {
2116 }
2117 if ((!sharedOnly || thing.IsSharedContainer) && thing.c_lockLv <= 0 && (thing.things.Count < thing.things.MaxCapacity || thing.things.CanStack(t) != t))
2118 {
2119 Window.SaveData windowSaveData = thing.GetWindowSaveData();
2120 if (windowSaveData != null)
2121 {
2122 if (windowSaveData.priority <= priority || (windowSaveData.noRotten && t.IsDecayed) || (windowSaveData.onlyRottable && t.trait.Decay == 0))
2123 {
2124 continue;
2125 }
2127 if (windowSaveData.userFilter)
2128 {
2129 filterResult = windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1));
2130 if (filterResult == Window.SaveData.FilterResult.Block)
2131 {
2132 continue;
2133 }
2134 }
2135 if (filterResult != Window.SaveData.FilterResult.PassWithoutFurtherTest)
2136 {
2137 if (windowSaveData.advDistribution)
2138 {
2139 bool flag2 = false;
2140 foreach (int cat in windowSaveData.cats)
2141 {
2142 if (t.category.uid == cat)
2143 {
2144 flag2 = true;
2145 break;
2146 }
2147 }
2148 if (!flag2)
2149 {
2150 continue;
2151 }
2152 }
2153 else if (windowSaveData.flag.HasFlag(flag))
2154 {
2155 continue;
2156 }
2157 }
2158 priority = windowSaveData.priority;
2159 }
2160 else
2161 {
2162 if (priority != -1)
2163 {
2164 continue;
2165 }
2166 priority = 0;
2167 }
2168 dest = thing;
2169 }
2170 }
2171 return null;
2172 }
2173 }
2174
2175 public bool TryAddThing(Thing target, Point p, bool destroyIfFail = false)
2176 {
2177 int num = 0;
2178 if (p.cell.detail != null)
2179 {
2180 foreach (Thing thing in p.cell.detail.things)
2181 {
2182 if (thing.placeState == PlaceState.roaming)
2183 {
2184 if (target.TryStackTo(thing))
2185 {
2186 return true;
2187 }
2188 num++;
2189 }
2190 }
2191 }
2192 if (num == 0 || !destroyIfFail)
2193 {
2194 EClass._zone.AddCard(target, p);
2195 return true;
2196 }
2197 target.Destroy();
2198 return false;
2199 }
2200
2201 public Thing TryGetThingFromSharedContainer(Func<Thing, bool> func)
2202 {
2203 foreach (Thing container in EClass._map.props.installed.containers)
2204 {
2205 if (container.IsSharedContainer)
2206 {
2207 Thing thing = container.things.Find(func);
2208 if (thing != null)
2209 {
2210 return thing;
2211 }
2212 }
2213 }
2214 return null;
2215 }
2216
2217 public Thing TryGetRestock<T>(string idCat) where T : TraitSpot
2218 {
2219 List<T> list = new List<T>();
2220 foreach (Thing thing2 in EClass._map.things)
2221 {
2222 if (thing2.IsInstalled && thing2.trait is T)
2223 {
2224 list.Add(thing2.trait as T);
2225 }
2226 }
2227 foreach (T item in list)
2228 {
2229 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2230 {
2231 foreach (Thing thing3 in item2.Things)
2232 {
2233 if (!thing3.IsInstalled || thing3.isSale)
2234 {
2235 continue;
2236 }
2237 if (thing3.things.Count == 0)
2238 {
2239 if (IsValid(thing3, insideContainer: false))
2240 {
2241 return thing3;
2242 }
2243 continue;
2244 }
2245 Thing thing = thing3.things.Find((Thing _t) => IsValid(_t, insideContainer: true));
2246 if (thing != null)
2247 {
2248 return thing;
2249 }
2250 }
2251 }
2252 }
2253 return null;
2254 bool IsValid(Thing t, bool insideContainer)
2255 {
2256 if (t.category.id != idCat || !TraitSalesTag.CanTagSale(t, insideContainer))
2257 {
2258 return false;
2259 }
2260 return true;
2261 }
2262 }
2263
2265 {
2266 string text = IdProfile;
2267 if (text.IsEmpty())
2268 {
2269 Region region = parent as Region;
2270 if (base.lv != 0)
2271 {
2272 text = ((base.lv < 0) ? "Underground" : "Sky");
2273 }
2274 else if (region != null)
2275 {
2277 text = EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2278 if (bp != null)
2279 {
2280 name = Lang.GetList("zone_" + text.Split('/')[1]).RandomItem();
2281 bp.surrounding = new EloMap.TileInfo[3, 3];
2282 for (int i = 0; i < 3; i++)
2283 {
2284 for (int j = 0; j < 3; j++)
2285 {
2286 bp.surrounding[j, i] = EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2287 }
2288 }
2289 if (text == "Random/R_Shore")
2290 {
2291 base.isBeach = true;
2292 }
2293 }
2294 }
2295 else
2296 {
2297 text = "Random";
2298 }
2299 idProfile = text;
2300 }
2301 return ZoneProfile.Load(text);
2302 }
2303
2304 public void CreateBP()
2305 {
2306 bp = new ZoneBlueprint();
2307 bp.Create();
2308 bp.genSetting.seed = base.Seed;
2309 OnCreateBP();
2310 }
2311
2312 public virtual void OnCreateBP()
2313 {
2314 }
2315
2316 public void Generate()
2317 {
2318 base.isGenerated = true;
2319 if (bp == null)
2320 {
2321 CreateBP();
2322 }
2323 if (bp.map == null)
2324 {
2325 bp.GenerateMap(this);
2326 }
2327 map.SetZone(this);
2328 Zone_Field zone_Field = this as Zone_Field;
2329 if (IdBiome == "Sand" || IdBiome == "Water" || IsUnderwater)
2330 {
2331 int num = 1 + EClass.rnd((IdBiome == "Water") ? 3 : 2);
2332 for (int i = 0; i < num; i++)
2333 {
2334 Point randomSurface = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2335 if (!randomSurface.HasObj && !randomSurface.HasThing)
2336 {
2337 Thing t = ThingGen.Create("pearl_oyster", new string[3] { "wood_birch", "poplar", "coralwood" }.RandomItem(), ContentLv);
2338 EClass._zone.AddCard(t, randomSurface).Install();
2339 }
2340 }
2341 num = 4 + EClass.rnd(5);
2342 for (int j = 0; j < num; j++)
2343 {
2344 Point randomSurface2 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2345 if (!randomSurface2.HasObj && !randomSurface2.HasThing && (IsUnderwater || randomSurface2.cell.IsTopWaterAndNoSnow || EClass.rnd(6) == 0))
2346 {
2347 EClass._zone.AddCard(ThingGen.Create("70", -1, ContentLv), randomSurface2);
2348 }
2349 }
2350 }
2351 if (IsUnderwater)
2352 {
2353 for (int k = 0; k < 30 + EClass.rnd(30); k++)
2354 {
2355 SpawnMob(null, SpawnSetting.Fish());
2356 }
2357 Crawler crawler = Crawler.Create("pasture");
2358 int num2 = (EClass.debug.enable ? 3 : EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(5) + 1) + 1) + 1));
2359 bool flag = this is Zone_Field;
2360 Thing seed = null;
2361 if (IsNefia)
2362 {
2363 int num3 = Mathf.Min(EClass._zone.DangerLv, EClass.pc.Evalue(286) * 2 / 3);
2364 if (num3 > 0)
2365 {
2367 Rand.SetSeed(EClass._zone.uid * 10 + num3);
2368 TraitSeed.LevelSeed(seed, (seed.trait as TraitSeed).row, num3);
2369 Rand.SetSeed();
2370 seed.elements.SetBase(2, EClass.curve(seed.encLV, 50, 10, 80));
2371 }
2372 }
2373 crawler.CrawlUntil(EClass._map, () => EClass._map.GetRandomPoint(), num2 + (flag ? 4 : 0), delegate(Crawler.Result r)
2374 {
2375 int num6 = 137;
2376 foreach (Point point in r.points)
2377 {
2378 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
2379 {
2380 map.SetObj(point.x, point.z, num6);
2381 int idx = 3 + ((EClass.rnd(3) == 0) ? 1 : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0);
2382 point.growth.SetStage(idx);
2383 if (seed != null)
2384 {
2385 EClass._map.AddPlant(point, seed);
2386 }
2387 }
2388 }
2389 return false;
2390 });
2391 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(5) + 1) + 1 + (flag ? 20 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2392 {
2393 int num5 = 136;
2394 foreach (Point point2 in r.points)
2395 {
2396 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
2397 {
2398 map.SetObj(point2.x, point2.z, num5, 1, EClass.rnd(4));
2399 }
2400 }
2401 return false;
2402 });
2403 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(10) + 1) + 3 + (flag ? 40 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2404 {
2405 int idFloor = 121;
2406 foreach (Point point3 in r.points)
2407 {
2408 map.SetFloor(point3.x, point3.z, 97, idFloor, Mathf.Clamp(4 - r.startPos.Distance(point3) + EClass.rnd(3) - EClass.rnd(3), 0, 3));
2409 }
2410 return false;
2411 });
2412 }
2413 if (zone_Field != null)
2414 {
2415 if (EClass.rnd(3) == 0)
2416 {
2417 int num4 = EClass.rnd(2);
2418 for (int l = 0; l < num4; l++)
2419 {
2420 Point randomSurface3 = EClass._map.bounds.GetRandomSurface();
2421 if (!randomSurface3.HasObj && !randomSurface3.HasThing)
2422 {
2423 Card t2 = ThingGen.Create("chest3").ChangeMaterial(biome.style.matDoor);
2424 EClass._zone.AddCard(t2, randomSurface3).Install();
2425 }
2426 }
2427 }
2428 if (EClass.rnd(8) == 0)
2429 {
2430 SpawnAltar();
2431 }
2432 TrySpawnFollower();
2433 }
2434 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList) ?? EClass.Sound.GetPlaylist("Day"));
2435 }
2436
2437 public void TrySpawnFollower()
2438 {
2439 bool flag = EClass.pc.HasCondition<ConDrawBacker>();
2440 if (!EClass.debug.enable && EClass.rnd(flag ? 3 : 20) != 0)
2441 {
2442 return;
2443 }
2444 Point randomSurface = EClass._map.bounds.GetRandomSurface();
2445 if (!randomSurface.IsValid)
2446 {
2447 return;
2448 }
2449 Chara c = CharaGen.Create("follower");
2450 EClass._zone.AddCard(c, randomSurface);
2451 (EClass._zone.AddThing("gallows", randomSurface).Install().trait as TraitShackle).Restrain(c);
2452 c.c_rescueState = RescueState.WaitingForRescue;
2453 if (EClass.rnd(flag ? 1 : 2) == 0 || EClass.debug.enable)
2454 {
2456 if (row != null)
2457 {
2458 c.ApplyBacker(row.id);
2459 }
2460 }
2461 Religion faith = EClass.game.religions.dictAll.Values.Where((Religion a) => a != c.faith).RandomItem();
2462 for (int i = 0; i < 3 + EClass.rnd(4); i++)
2463 {
2464 Chara chara = CharaGen.Create("fanatic");
2465 chara.SetFaith(faith);
2466 Point point = randomSurface.GetRandomPoint(4) ?? randomSurface.GetNearestPoint();
2467 EClass._zone.AddCard(chara, point);
2468 }
2469 }
2470
2471 public void SpawnAltar()
2472 {
2474 {
2475 if (r.points.Count <= 4)
2476 {
2477 return false;
2478 }
2479 map.poiMap.OccyupyPOI(r.points[0]);
2480 List<Point> points = r.points;
2481 Religion randomReligion = EClass.game.religions.GetRandomReligion();
2482 "altarPoint".lang(randomReligion.NameDomain.lang());
2483 Thing thing = ThingGen.Create("altar");
2484 (thing.trait as TraitAltar).SetDeity(randomReligion.id);
2485 Chara t = CharaGen.Create("twintail");
2486 EClass._zone.AddCard(t, points.RandomItem());
2487 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2488 {
2489 Chara t2 = CharaGen.Create("twintail");
2490 EClass._zone.AddCard(t2, points.RandomItem());
2491 }
2492 if (points[0].Installed == null)
2493 {
2494 EClass._zone.AddCard(thing, points[0]).Install();
2495 }
2496 foreach (Point item in points)
2497 {
2498 if (item.x % 3 == 0 && item.z % 2 == 0 && item != points[0] && !item.Equals(points[0].Front) && item.Installed == null)
2499 {
2500 thing = ThingGen.Create("pillar1");
2501 EClass._zone.AddCard(thing, item).Install();
2502 }
2503 item.SetObj();
2504 item.SetFloor(3, 6);
2505 }
2506 return true;
2507 });
2508 }
2509
2510 public virtual void OnGenerateMap()
2511 {
2512 if (MakeEnemiesNeutral)
2513 {
2514 foreach (Chara chara in EClass._map.charas)
2515 {
2516 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral && chara.OriginalHostility < Hostility.Friend)
2517 {
2518 Hostility hostility2 = (chara.c_originalHostility = Hostility.Neutral);
2519 chara.hostility = hostility2;
2520 }
2521 }
2522 }
2523 if (PrespawnRate != 0f && !IsSkyLevel)
2524 {
2525 for (int i = 0; i < (int)((float)MaxSpawn * PrespawnRate); i++)
2526 {
2527 SpawnMob();
2528 }
2529 }
2530 TryGenerateOre();
2531 TryGenerateBigDaddy();
2532 TryGenerateEvolved();
2533 TryGenerateShrine();
2534 }
2535
2536 public void TryGenerateOre()
2537 {
2538 if (OreChance <= 0f)
2539 {
2540 return;
2541 }
2542 Crawler.Create("ore").CrawlUntil(tries: EClass.rnd((int)((float)(map.bounds.Width * map.bounds.Height / 200 + 1) * OreChance + 2f)), map: EClass._map, onStart: () => EClass._map.bounds.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2543 {
2544 byte b = 18;
2545 string group = "ore";
2546 if (EClass.rnd(5) == 0)
2547 {
2548 b++;
2549 group = "gem";
2550 }
2551 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(DangerLv, group);
2552 foreach (Point point in r.points)
2553 {
2554 if (point.sourceBlock.ContainsTag("ore"))
2555 {
2556 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2557 }
2558 }
2559 return false;
2560 });
2561 }
2562
2563 public Chara TryGenerateEvolved(bool force = false, Point p = null)
2564 {
2565 if (!force && EvolvedChance <= EClass.rndf(1f))
2566 {
2567 return null;
2568 }
2569 Chara chara = SpawnMob(p, SpawnSetting.Evolved());
2570 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2571 {
2572 chara.ability.AddRandom();
2573 }
2574 chara.AddThing(chara.MakeGene(DNA.Type.Default));
2575 if (EClass.rnd(2) == 0)
2576 {
2577 chara.AddThing(chara.MakeGene(DNA.Type.Superior));
2578 }
2579 return chara;
2580 }
2581
2583 {
2584 if (!(BigDaddyChance <= EClass.rndf(1f)))
2585 {
2586 int num = DangerLv * 125 / 100;
2587 if (num >= 30)
2588 {
2590 {
2591 lv = num
2592 });
2593 }
2594 Chara t = CharaGen.Create("big_daddy");
2595 EClass._zone.AddCard(t, GetSpawnPos(SpawnPosition.Random, 10000));
2596 Msg.Say("sign_bigdaddy");
2597 }
2598 }
2599
2600 public void TryGenerateShrine()
2601 {
2602 for (int i = 0; i < 3; i++)
2603 {
2604 Rand.SetSeed(base.uid + i);
2605 if (ShrineChance <= EClass.rndf(1f))
2606 {
2607 continue;
2608 }
2609 Point randomSpace = EClass._map.GetRandomSpace(3, 3);
2610 if (randomSpace == null)
2611 {
2612 continue;
2613 }
2614 randomSpace.x++;
2615 randomSpace.z++;
2616 if (randomSpace.HasThing || randomSpace.HasChara)
2617 {
2618 continue;
2619 }
2620 randomSpace.SetObj();
2623 if (EClass.rnd(EClass.debug.test ? 2 : 15) == 0)
2624 {
2625 EClass._zone.AddCard(ThingGen.Create("pedestal_power"), randomSpace).Install();
2626 EClass._zone.AddCard(ThingGen.Create(EClass.gamedata.godStatues.RandomItemWeighted((GodStatueData a) => a.chance).idThing, -1, DangerLv), randomSpace).Install();
2627 }
2628 else
2629 {
2630 EClass._zone.AddCard(ThingGen.Create("statue_power", -1, DangerLv), randomSpace).Install().SetRandomDir();
2631 }
2632 }
2633 Rand.SetSeed();
2634 }
2635
2636 public void ResetHostility()
2637 {
2638 foreach (Chara chara in EClass._map.charas)
2639 {
2640 if (!chara.source.hostility.IsEmpty() && chara.source.hostility.ToEnum<Hostility>() >= Hostility.Friend && !chara.IsPCFactionOrMinion)
2641 {
2642 chara.c_originalHostility = (Hostility)0;
2643 }
2644 chara.hostility = chara.OriginalHostility;
2645 if (chara.enemy != null && (chara.enemy.IsPCFaction || chara.IsPCFaction))
2646 {
2647 chara.SetEnemy();
2648 }
2649 }
2650 }
2651
2652 public virtual void OnGenerateRooms(BaseMapGen gen)
2653 {
2654 }
2655
2656 public Point GetSpawnPos(SpawnPosition type, int tries = 100)
2657 {
2658 Point point = new Point();
2659 for (int i = 0; i < tries; i++)
2660 {
2661 point = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2662 if (!point.IsValid || point.cell.hasDoor || point.IsSync)
2663 {
2664 continue;
2665 }
2666 switch (type)
2667 {
2668 case SpawnPosition.Guest:
2669 {
2670 Room room = point.cell.room;
2671 if (room != null && room.data.accessType != 0)
2672 {
2673 continue;
2674 }
2675 break;
2676 }
2677 case SpawnPosition.Outside:
2678 if (point.cell.HasRoof || point.cell.light > 0)
2679 {
2680 continue;
2681 }
2682 break;
2683 }
2684 return point;
2685 }
2686 return null;
2687 }
2688
2689 public Chara SpawnMob(Point pos = null, SpawnSetting setting = null)
2690 {
2691 if (setting == null)
2692 {
2693 setting = SpawnSetting.Default;
2694 }
2695 if (pos == null)
2696 {
2697 pos = GetSpawnPos(setting.position, setting.tries);
2698 if (pos == null)
2699 {
2700 pos = GetSpawnPos(SpawnPosition.Random, setting.tries);
2701 if (pos == null)
2702 {
2703 return null;
2704 }
2705 }
2706 }
2707 BiomeProfile biome = pos.cell.biome;
2708 if (IsUnderwater && EClass.rnd(15) != 0)
2709 {
2710 biome = ((EClass.rnd(4) != 0) ? EClass.core.refs.biomes.Water : EClass.core.refs.biomes.Sand);
2711 }
2712 SpawnList spawnList = null;
2713 spawnList = ((setting.idSpawnList != null) ? SpawnList.Get(setting.idSpawnList) : ((EClass._zone is Zone_DungeonYeek) ? SpawnListChara.Get("dungeon_yeek", (SourceChara.Row r) => r.race == "yeek") : ((setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) < ChanceSpawnNeutral)) ? SpawnList.Get("c_neutral") : ((biome.spawn.chara.Count <= 0) ? SpawnList.Get(biome.name, "chara", new CharaFilter
2714 {
2715 ShouldPass = delegate(SourceChara.Row s)
2716 {
2717 if (s.hostility != "")
2718 {
2719 return false;
2720 }
2721 return s.biome == biome.name || s.biome.IsEmpty();
2722 }
2723 }) : SpawnList.Get(biome.spawn.GetRandomCharaId())))));
2724 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
2725 CardBlueprint cardBlueprint = new CardBlueprint
2726 {
2727 rarity = Rarity.Normal,
2728 idEle = setting.idEle
2729 };
2730 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
2731 if (ScaleType == ZoneScaleType.Void)
2732 {
2733 num2 = ((num - 1) % 50 + 5) * 150 / 100;
2734 if (num2 >= 20 && EClass.rnd(100) < num2)
2735 {
2736 num2 = num;
2737 }
2738 }
2739 CardRow cardRow = (setting.id.IsEmpty() ? spawnList.Select(num2, setting.levelRange) : EClass.sources.cards.map[setting.id]);
2740 int num3 = ((setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv);
2741 if (ScaleType == ZoneScaleType.Void)
2742 {
2743 num3 = (50 + cardRow.LV) * Mathf.Max(1, (num - 1) / 50);
2744 }
2745 num3 += DangerLvBoost;
2746 if (setting.rarity == Rarity.Random)
2747 {
2748 if (EClass.rnd(100) == 0)
2749 {
2750 cardBlueprint.rarity = Rarity.Legendary;
2751 num3 = num3 * 125 / 100;
2752 }
2753 }
2754 else
2755 {
2756 cardBlueprint.rarity = setting.rarity;
2757 }
2758 if (setting.isBoss)
2759 {
2760 num3 = num3 * 150 / 100;
2761 }
2762 if (setting.isEvolved)
2763 {
2764 num3 = num3 * 2 + 20;
2765 }
2766 if (num3 != cardRow.LV)
2767 {
2768 cardBlueprint.lv = num3;
2769 }
2770 CardBlueprint.Set(cardBlueprint);
2771 Chara chara = CharaGen.Create(cardRow.id, num2);
2772 AddCard(chara, pos);
2773 if (setting.forcedHostility.HasValue)
2774 {
2775 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
2776 chara.c_originalHostility = c_originalHostility;
2777 }
2778 if (setting.isBoss)
2779 {
2780 chara.c_bossType = BossType.Boss;
2781 }
2782 if (setting.isEvolved)
2783 {
2784 chara.c_bossType = BossType.Evolved;
2785 }
2786 return chara;
2787 }
2788
2790 {
2791 dirtyElectricity = false;
2792 bool flag = GetSoilCost() > MaxSoil;
2793 base.electricity = elements.Value(2201) * 10 + BaseElectricity;
2794 foreach (Thing thing in EClass._map.things)
2795 {
2796 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
2797 {
2798 base.electricity += thing.trait.Electricity;
2799 }
2800 }
2801 if (!flag)
2802 {
2803 EClass._map.bounds.ForeachCell(delegate(Cell c)
2804 {
2805 if (c.sourceObj.id == 118 && c.growth.IsMature)
2806 {
2807 base.electricity += 20;
2808 }
2809 });
2810 }
2811 foreach (Thing thing2 in EClass._map.things)
2812 {
2813 if (thing2.IsInstalled)
2814 {
2815 thing2.trait.TryToggle();
2816 }
2817 }
2818 }
2819
2820 public int GetElectricity(bool cost = false)
2821 {
2822 bool flag = GetSoilCost() > MaxSoil;
2823 int sum = 0;
2824 foreach (Thing thing in EClass._map.things)
2825 {
2826 if (!thing.IsInstalled || thing.trait.Electricity == 0)
2827 {
2828 continue;
2829 }
2830 if (cost)
2831 {
2832 if (thing.trait.Electricity < 0)
2833 {
2834 sum += -thing.trait.Electricity;
2835 }
2836 }
2837 else if (thing.trait.Electricity > 0)
2838 {
2839 sum += thing.trait.Electricity;
2840 }
2841 }
2842 if (!cost)
2843 {
2844 sum += elements.Value(2201) * 10 + BaseElectricity;
2845 if (!flag)
2846 {
2847 EClass._map.bounds.ForeachCell(delegate(Cell c)
2848 {
2849 if (c.sourceObj.id == 118 && c.growth.IsMature)
2850 {
2851 sum += 20;
2852 }
2853 });
2854 }
2855 }
2856 return sum;
2857 }
2858
2859 public void SetBGM(List<int> ids, bool refresh = true)
2860 {
2861 map._plDay.Clear();
2862 if (ids.Count > 0)
2863 {
2864 foreach (int id in ids)
2865 {
2866 if (id != -1)
2867 {
2868 map._plDay.Add(id);
2869 }
2870 }
2871 }
2872 UnityEngine.Object.DestroyImmediate(map.plDay);
2873 map.plDay = null;
2874 RefreshPlaylist();
2875 if (refresh)
2876 {
2877 EClass.Sound.StopBGM();
2878 RefreshBGM();
2879 }
2880 }
2881
2882 public void SetBGM(int id = -1, bool refresh = true)
2883 {
2884 SetBGM(new List<int> { id }, refresh);
2885 }
2886
2887 public void RefreshPlaylist()
2888 {
2889 if (map.plDay == null)
2890 {
2891 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList));
2892 }
2893 }
2894
2895 public void RefreshBGM()
2896 {
2898 {
2899 return;
2900 }
2901 RefreshPlaylist();
2902 Playlist playlist = map.plDay;
2903 foreach (ZoneEvent item in events.list)
2904 {
2905 if (item.playlist != null)
2906 {
2907 playlist = item.playlist;
2908 }
2909 }
2910 if (IDPlaylistOverwrite != null)
2911 {
2912 playlist = EClass.Sound.GetPlaylist(IDPlaylistOverwrite);
2913 }
2915 {
2916 Room room = EClass.pc.pos.cell.room;
2917 if (room != null && room.lot != null && room.lot.idBGM != 0)
2918 {
2919 playlist = EClass.Sound.plLot;
2920 if (playlist.list[0].data?.id != room.lot.idBGM)
2921 {
2922 playlist.list[0].data = EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM);
2923 playlist.Reset();
2924 if (!LayerDrama.keepBGM)
2925 {
2926 EClass.Sound.StopBGM(1f);
2927 }
2928 }
2929 }
2930 }
2932 EClass.Sound.SwitchPlaylist(playlist, !LayerDrama.keepBGM);
2933 }
2934
2935 public Playlist CreatePlaylist(ref List<int> list, Playlist mold = null)
2936 {
2937 Playlist playlist = EClass.Sound.plBlank.Instantiate();
2938 if (list.Count == 0 && (bool)mold)
2939 {
2940 list = mold.ToInts();
2941 playlist.shuffle = mold.shuffle;
2942 playlist.minSwitchTime = mold.minSwitchTime;
2943 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
2944 playlist.ignoreLoop = mold.ignoreLoop;
2945 playlist.keepBGMifSamePlaylist = mold.keepBGMifSamePlaylist;
2946 playlist.name = mold.name;
2947 }
2948 foreach (int item in list)
2949 {
2950 playlist.list.Add(new Playlist.Item
2951 {
2952 data = EClass.core.refs.dictBGM[item]
2953 });
2954 }
2955 return playlist;
2956 }
2957
2958 public Chara FindChara(string id)
2959 {
2960 return map.charas.Find((Chara c) => c.id == id);
2961 }
2962
2963 public Chara FindChara(int uid)
2964 {
2965 return map.charas.Find((Chara c) => c.uid == uid);
2966 }
2967
2968 public int GetDeepestLv()
2969 {
2970 int max = base.lv;
2971 return GetDeepestLv(ref max);
2972 }
2973
2974 public int GetDeepestLv(ref int max)
2975 {
2976 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
2977 {
2978 max = base.lv;
2979 }
2980 foreach (Spatial child in children)
2981 {
2982 (child as Zone).GetDeepestLv(ref max);
2983 }
2984 return max;
2985 }
2986
2987 public List<Element> ListLandFeats()
2988 {
2989 if (landFeats == null)
2990 {
2991 landFeats = new List<int>();
2993 string[] listBase = IDBaseLandFeat.Split(',');
2994 string[] array = listBase;
2995 foreach (string text in array)
2996 {
2997 if (!text.IsEmpty())
2998 {
2999 landFeats.Add(EClass.sources.elements.alias[text].id);
3000 }
3001 }
3002 if (listBase.Length == 1)
3003 {
3004 List<SourceElement.Row> list = EClass.sources.elements.rows.Where(delegate(SourceElement.Row e)
3005 {
3006 if (e.category != "landfeat" || e.chance == 0)
3007 {
3008 return false;
3009 }
3010 bool flag = true;
3011 string[] tag = e.tag;
3012 foreach (string text2 in tag)
3013 {
3014 if (text2.StartsWith("bf"))
3015 {
3016 flag = false;
3017 if (listBase[0] == text2)
3018 {
3019 flag = true;
3020 break;
3021 }
3022 }
3023 }
3024 return flag ? true : false;
3025 }).ToList();
3026 SourceElement.Row row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3027 landFeats.Add(row.id);
3028 list.Remove(row);
3029 row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3030 landFeats.Add(row.id);
3031 }
3032 Rand.SetSeed();
3033 }
3034 List<Element> list2 = new List<Element>();
3035 foreach (int landFeat in landFeats)
3036 {
3037 list2.Add(Element.Create(landFeat, 1));
3038 }
3039 return list2;
3040 }
3041
3042 public ZoneExportData Import(string path)
3043 {
3044 ZipFile zipFile = ZipFile.Read(path);
3045 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3046 zipFile.ExtractAll(pathTemp);
3047 zipFile.Dispose();
3048 return IO.LoadFile<ZoneExportData>(pathTemp + "export") ?? new ZoneExportData();
3049 }
3050
3051 public void Export(string path, PartialMap partial = null, bool usermap = false)
3052 {
3053 if (subset != null)
3054 {
3055 SE.Beep();
3056 return;
3057 }
3058 try
3059 {
3060 ZoneExportData zoneExportData = new ZoneExportData
3061 {
3062 name = name,
3063 usermap = usermap
3064 };
3065 IO.CreateTempDirectory();
3066 if (!map.config.retainDecal)
3067 {
3068 map.ClearRainAndDecal();
3069 }
3070 map.Save(IO.TempPath + "/", zoneExportData, partial);
3071 map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(path), partial);
3072 if (partial == null)
3073 {
3074 IO.CopyDir(base.pathSave + "Texture Replace", IO.TempPath + "/Texture Replace");
3075 }
3076 IO.SaveFile(IO.TempPath + "/export", zoneExportData, compress: true);
3077 using (ZipFile zipFile = new ZipFile())
3078 {
3079 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3080 zipFile.AddDirectory(IO.TempPath);
3081 zipFile.Save(path);
3082 zipFile.Dispose();
3083 }
3084 IO.DeleteTempDirectory();
3085 }
3086 catch (Exception ex)
3087 {
3088 EClass.ui.Say(ex.Message + ":" + path);
3089 }
3090 }
3091
3092 public void ExportDialog(string dir = null)
3093 {
3095 {
3096 string text = StandaloneFileBrowser.SaveFilePanel("Export Zone", dir ?? CorePath.ZoneSave, "new zone", "z");
3097 if (!string.IsNullOrEmpty(text))
3098 {
3099 Export(text);
3100 Msg.SayRaw("Exported Zone");
3101 }
3102 });
3103 }
3104
3105 public void ImportDialog(string dir = null)
3106 {
3108 {
3109 string[] array = StandaloneFileBrowser.OpenFilePanel("Import Zone", dir ?? CorePath.ZoneSave, "z", multiselect: false);
3110 if (array.Length != 0)
3111 {
3112 Zone_User zone_User = SpatialGen.Create("user", EClass.world.region, register: true) as Zone_User;
3113 zone_User.path = array[0];
3114 Thing thing = ThingGen.Create("teleporter");
3115 thing.c_uidZone = zone_User.uid;
3116 EClass._zone.AddCard(thing, EClass.pc.pos);
3117 }
3118 });
3119 }
3120
3121 public static bool IsImportValid(string path)
3122 {
3123 try
3124 {
3125 return Map.GetMetaData(path)?.IsValidVersion() ?? false;
3126 }
3127 catch (Exception ex)
3128 {
3129 EClass.ui.Say(ex.Message);
3130 return false;
3131 }
3132 }
3133
3134 public void Export()
3135 {
3137 string text = pathExport;
3138 IO.Copy(text, CorePath.ZoneSave + "Backup/");
3139 Export(text);
3140 Msg.Say("Exported Map:" + text);
3141 }
3142
3143 public void WriteNote(UINote n, Action<UINote> onWriteNote = null, IInspect.NoteMode mode = IInspect.NoteMode.Default, Recipe recipe = null)
3144 {
3145 }
3146
3147 public void OnInspect()
3148 {
3149 }
3150
3151 public int GetSortVal()
3152 {
3153 if (IsPCFaction)
3154 {
3155 return -100000 + base.uid;
3156 }
3157 if (this is Zone_Civilized)
3158 {
3159 return -90000 + base.uid;
3160 }
3161 return base.uid;
3162 }
3163
3164 public Chara AddRandomVisitor(bool guest = false)
3165 {
3166 Trait random = map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
3167 if (random == null)
3168 {
3169 return null;
3170 }
3171 Point point = random.GetPoint();
3172 Chara chara = null;
3173 if (guest)
3174 {
3175 Zone z = EClass.world.FindZone("wilds");
3176 chara = EClass.game.cards.ListGlobalChara(z).RandomItem();
3177 if (chara != null)
3178 {
3179 AddCard(chara, point);
3180 Msg.Say("guestArrive", chara);
3181 chara.visitorState = VisitorState.Arrived;
3182 }
3183 }
3184 else
3185 {
3186 chara = CharaGen.CreateFromFilter("c_wilds");
3187 AddCard(chara, point);
3188 chara.goalListType = GoalListType.Enemy;
3189 }
3190 return chara;
3191 }
3192
3193 public void OnSimulateHour(VirtualDate date)
3194 {
3195 if (base.IsPlayerFaction)
3196 {
3197 branch.OnSimulateHour(date);
3198 }
3199 events.OnSimulateHour();
3200 if (date.IsRealTime)
3201 {
3202 foreach (Thing thing in EClass._map.things)
3203 {
3204 if (thing.IsInstalled)
3205 {
3206 thing.trait.TryToggle();
3207 }
3208 }
3210 }
3211 EClass._map.things.ForeachReverse(delegate(Thing t)
3212 {
3213 t.OnSimulateHour(date);
3214 });
3215 foreach (Thing sucker in Suckers)
3216 {
3217 sucker.Destroy();
3218 }
3219 Suckers.Clear();
3220 if (RespawnRate != 0f)
3221 {
3222 int num = 0;
3223 foreach (Chara chara in map.charas)
3224 {
3225 if (!chara.IsGlobal)
3226 {
3227 num++;
3228 }
3229 }
3230 if (num < MaxRespawn)
3231 {
3232 for (int i = 0; i < RespawnPerHour; i++)
3233 {
3234 SpawnMob();
3235 }
3236 }
3237 }
3238 if (!date.IsRealTime && EClass.rnd(24) == 0)
3239 {
3240 RainWater();
3241 }
3242 if (date.hour == 6)
3243 {
3244 GrowPlants(date);
3245 }
3246 }
3247
3248 public void OnSimulateDay(VirtualDate date)
3249 {
3250 if (base.IsPlayerFaction)
3251 {
3252 branch.OnSimulateDay(date);
3253 }
3254 }
3255
3257 {
3258 if (base.IsPlayerFaction)
3259 {
3260 branch.OnSimulateMonth(date);
3261 }
3262 if (date.IsRealTime)
3263 {
3265 }
3266 }
3267
3268 public void RainWater()
3269 {
3270 if (EClass._map.IsIndoor || !IsPCFaction)
3271 {
3272 return;
3273 }
3274 EClass._map.bounds.ForeachCell(delegate(Cell c)
3275 {
3276 if (c.IsFarmField && !c.HasRoof)
3277 {
3278 c.isWatered = true;
3279 }
3280 });
3281 }
3282
3283 public void GrowPlants(VirtualDate date)
3284 {
3285 bool num = (EClass.player.isAutoFarming = IsPCFaction && EClass.Branch.policies.IsActive(2707));
3286 int weedChance = 1;
3287 if (IsPCFaction && EClass.Branch.policies.IsActive(2703))
3288 {
3289 weedChance += (EClass.debug.enable ? 100000 : 20) + EClass.Branch.Evalue(2703) * 10;
3290 }
3291 if (date.sunMap == null)
3292 {
3293 date.BuildSunMap();
3294 }
3295 if (num)
3296 {
3297 HashSet<int> hashSet = new HashSet<int>();
3298 foreach (Thing thing in EClass._map.things)
3299 {
3300 if (!thing.IsInstalled || !(thing.trait is TraitSpotFarm traitSpotFarm))
3301 {
3302 continue;
3303 }
3304 foreach (Point item in traitSpotFarm.ListPoints(null, onlyPassable: false))
3305 {
3306 hashSet.Add(item.index);
3307 }
3308 }
3309 Perform(hashSet);
3310 EClass.player.isAutoFarming = false;
3311 Perform(hashSet);
3312 }
3313 else
3314 {
3315 Perform(null);
3316 }
3317 void Perform(HashSet<int> farmMap)
3318 {
3319 bool isWinter = date.IsWinter;
3320 EClass._map.bounds.ForeachCell(delegate(Cell c)
3321 {
3322 if (farmMap != null)
3323 {
3325 {
3326 if (!farmMap.Contains(c.index))
3327 {
3328 return;
3329 }
3330 }
3331 else if (farmMap.Contains(c.index))
3332 {
3333 return;
3334 }
3335 }
3336 if (c.decal != 0 && EClass.rnd(3) == 0)
3337 {
3338 c.decal = 0;
3339 }
3340 if (GrowPlant)
3341 {
3342 if (c.growth != null)
3343 {
3344 bool flag = false;
3345 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3346 {
3347 flag = true;
3348 }
3349 PlantData plantData = map.TryGetPlant(c);
3350 if (!flag && (plantData == null || plantData.fert >= 0))
3351 {
3352 c.TryGrow(date);
3353 }
3354 if (isWinter && plantData != null && c.growth != null && c.growth.NeedSunlight && plantData.fert >= 0 && (EClass.rnd(4) == 0 || c.growth.stage.idx == 0))
3355 {
3356 if (date.sunMap == null)
3357 {
3358 date.BuildSunMap();
3359 }
3360 if (!date.sunMap.Contains(c.index) && !c.growth.CanGrow(date))
3361 {
3362 c.growth.Perish();
3363 }
3364 }
3365 }
3366 else if (c.detail != null)
3367 {
3368 c.Things.ForeachReverse(delegate(Thing t)
3369 {
3370 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3371 {
3372 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3373 }
3374 });
3375 }
3376 else if (EClass.rnd(20) == 0 && GrowWeed && c.CanGrowWeed && EClass.rnd(weedChance) == 0)
3377 {
3378 biome.Populate(c.GetPoint());
3379 if (c.growth != null)
3380 {
3381 c.growth.SetStage(0);
3382 }
3383 }
3384 }
3385 c.isWatered = false;
3386 });
3387 }
3388 }
3389
3390 public Zone GetZoneAt(int _x, int _y)
3391 {
3392 if (IsRegion)
3393 {
3394 foreach (Spatial child in children)
3395 {
3396 if (!(child is Zone_Field) && _x == child.x && _y == child.y)
3397 {
3398 return child as Zone;
3399 }
3400 }
3401 }
3402 foreach (Spatial child2 in children)
3403 {
3404 if (_x == child2.x && _y == child2.y)
3405 {
3406 return child2 as Zone;
3407 }
3408 }
3409 return null;
3410 }
3411
3412 public bool IsCrime(Chara c, Act act)
3413 {
3414 if (act.IsHostileAct && HasLaw && !IsPCFaction && c.IsPC)
3415 {
3416 return true;
3417 }
3418 return false;
3419 }
3420
3421 public void RefreshCriminal()
3422 {
3423 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3424 Hostility hostility = (flag ? Hostility.Neutral : Hostility.Friend);
3425 foreach (Chara chara in EClass._map.charas)
3426 {
3427 if (chara.trait is TraitGuard)
3428 {
3429 chara.hostility = hostility;
3430 if (!flag && chara.enemy != null && chara.enemy.IsPCParty)
3431 {
3432 chara.SetEnemy();
3433 }
3434 }
3435 }
3436 }
3437
3439 {
3440 if (base.lv != 0)
3441 {
3442 return;
3443 }
3444 dictCitizen.Clear();
3445 foreach (Chara item in map.charas.Concat(map.deadCharas))
3446 {
3447 if (item.trait.IsCitizen && !item.IsGlobal && !item.isSubsetCard)
3448 {
3449 dictCitizen[item.uid] = item.Name;
3450 }
3451 }
3452 }
3453
3454 public void ModInfluence(int a)
3455 {
3456 base.influence += a;
3457 if (a > 0)
3458 {
3459 Msg.Say("gainInfluence", Name, a.ToString() ?? "");
3460 }
3461 Tutorial.Reserve("influence");
3462 }
3463
3464 public void ModDevelopment(int a)
3465 {
3466 base.development += a;
3467 if (a > 0)
3468 {
3469 Msg.Say("gainDevelopment", Name, a.ToString() ?? "");
3470 }
3471 }
3472
3473 public void UpdateQuests(bool force = false)
3474 {
3475 if (!IsPCFaction && (!(this is Zone_Town) || base.lv != 0))
3476 {
3477 return;
3478 }
3479 Debug.Log("Updating Quest:" + force);
3480 List<SourceQuest.Row> list = EClass.sources.quests.rows.Where((SourceQuest.Row a) => a.group == "random").ToList();
3481 int num = 0;
3482 foreach (Chara item in map.charas.Concat(map.deadCharas))
3483 {
3484 if (item.quest != null && !EClass.game.quests.list.Contains(item.quest))
3485 {
3486 if (item.quest.IsExpired || completedQuests.Contains(item.quest.uid) || force)
3487 {
3488 item.quest = null;
3489 }
3490 else
3491 {
3492 num++;
3493 }
3494 }
3495 }
3496 if (EClass._zone.dateQuest > EClass.world.date.GetRaw() && !force)
3497 {
3498 return;
3499 }
3500 EClass._zone.dateQuest = EClass.world.date.GetRaw() + 1440;
3501 int maxQuest = 3;
3502 Rand.UseSeed(base.uid + EClass.player.stats.days / 7 % 100, delegate
3503 {
3504 maxQuest = 4 + EClass.rnd(4);
3505 });
3506 completedQuests.Clear();
3507 List<Zone> list2 = Quest.ListDeliver();
3508 List<Tuple<string, int>> listTag = new List<Tuple<string, int>>();
3509 string[] array = EClass._zone.source.questTag;
3511 {
3512 array = new string[9] { "supply/8", "deliver/7", "food/8", "escort/4", "deliver/4", "monster/0", "war/0", "farm/0", "music/0" };
3513 }
3514 string[] array2 = array;
3515 for (int i = 0; i < array2.Length; i++)
3516 {
3517 string[] array3 = array2[i].Split('/');
3518 listTag.Add(new Tuple<string, int>(array3[0], array3[1].ToInt()));
3519 }
3520 for (int j = 0; j < map.charas.Count * 2; j++)
3521 {
3522 if (num > maxQuest)
3523 {
3524 break;
3525 }
3526 if (num > 15)
3527 {
3528 break;
3529 }
3530 Chara chara = map.charas.RandomItem();
3531 if (!chara.trait.CanGiveRandomQuest || chara.isSubsetCard || chara.homeZone != EClass._zone || chara.IsGuest() || chara.memberType == FactionMemberType.Livestock || (chara.quest != null && !force))
3532 {
3533 continue;
3534 }
3535 SourceQuest.Row row = list.RandomItemWeighted(delegate(SourceQuest.Row a)
3536 {
3537 int num2 = 1;
3538 foreach (Tuple<string, int> item2 in listTag)
3539 {
3540 if (a.tags.Contains(item2.Item1))
3541 {
3542 num2 = item2.Item2;
3543 break;
3544 }
3545 }
3546 if (!EClass._zone.IsPCFaction && a.tags.Contains("bulk"))
3547 {
3548 num2 = 0;
3549 }
3550 return a.chance * num2;
3551 });
3552 if ((!row.tags.Contains("needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame < EClass.player.fame || EClass.debug.enable))
3553 {
3554 Quest.Create(row.id, null, chara);
3555 num++;
3556 }
3557 }
3558 }
3559
3560 public List<Chara> ListMinions(Chara c)
3561 {
3562 List<Chara> list = new List<Chara>();
3563 foreach (Chara chara in EClass._map.charas)
3564 {
3565 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3566 {
3567 list.Add(chara);
3568 }
3569 }
3570 return list;
3571 }
3572
3573 public int CountMinions(Chara c)
3574 {
3575 int num = 0;
3576 foreach (Chara chara in EClass._map.charas)
3577 {
3578 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3579 {
3580 num++;
3581 }
3582 }
3583 return num;
3584 }
3585
3586 public int GetSoilCost()
3587 {
3588 int i = 0;
3589 EClass._map.bounds.ForeachCell(delegate(Cell c)
3590 {
3591 i += c.sourceObj.costSoil;
3592 });
3593 return i / 10;
3594 }
3595
3596 public void SpawnLostItems()
3597 {
3598 for (int i = 0; i < 2 + EClass.rnd(4); i++)
3599 {
3600 Point point = GetPos();
3601 if (point == null)
3602 {
3603 continue;
3604 }
3605 if (EClass.rnd(30) == 0)
3606 {
3607 Thing thing = ThingGen.Create("purse");
3608 thing.isLostProperty = true;
3609 thing.things.DestroyAll();
3610 int num2 = (thing.c_lockLv = EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3611 thing.Add("money", EClass.rndHalf(num2 * 60 + 1000));
3612 if (EClass.rnd(2) == 0)
3613 {
3614 thing.Add("plat", EClass.rnd(4));
3615 }
3616 else
3617 {
3618 thing.Add("medal", EClass.rnd(2));
3619 }
3620 EClass._zone.AddCard(thing, point);
3621 }
3622 else
3623 {
3625 }
3626 }
3627 static Point GetPos()
3628 {
3629 for (int j = 0; j < 10; j++)
3630 {
3631 Point randomPoint = EClass._zone.bounds.GetRandomPoint();
3632 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
3633 {
3634 return randomPoint;
3635 }
3636 }
3637 return null;
3638 }
3639 }
3640
3641 public void ApplyBackerPet(bool draw)
3642 {
3643 bool flag = this is Zone_Yowyn && base.lv == -1;
3644 IList<SourceBacker.Row> list = EClass.sources.backers.listPet.Copy();
3645 list.Shuffle();
3647 {
3648 list.ForeachReverse(delegate(SourceBacker.Row a)
3649 {
3650 if (EClass.player.doneBackers.Contains(a.id))
3651 {
3652 list.Remove(a);
3653 }
3654 });
3655 }
3656 foreach (Chara chara in EClass._map.charas)
3657 {
3658 if (chara.IsGlobal || chara.IsMinion)
3659 {
3660 continue;
3661 }
3662 if (chara.isBackerContent)
3663 {
3664 if (chara.sourceBacker.isStatic != 0)
3665 {
3666 continue;
3667 }
3668 if (chara.id != "follower")
3669 {
3670 chara.RemoveBacker();
3671 }
3672 }
3673 if ((flag && chara.race.id != "cat") || EClass.rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0)
3674 {
3675 continue;
3676 }
3677 foreach (SourceBacker.Row item in list)
3678 {
3679 if (item.chara == chara.id)
3680 {
3681 chara.ApplyBacker(item.id);
3682 list.Remove(item);
3683 break;
3684 }
3685 }
3686 }
3687 }
3688
3690 {
3691 if (fortuneRoll == null)
3692 {
3693 fortuneRoll = new FortuneRollData();
3694 fortuneRoll.seed = EClass._zone.uid * 100 + EClass.game.seed;
3695 }
3696 if (refresh || fortuneRoll.count == 0)
3697 {
3698 fortuneRoll.Refresh();
3699 }
3700 return fortuneRoll;
3701 }
3702}
BossType
Definition: BossType.cs:2
CTAG
Definition: CTAG.cs:2
@ seed
ClearInventoryType
ContainerFlag
Definition: ContainerFlag.cs:5
CureType
Definition: CureType.cs:2
EditorTag
Definition: EditorTag.cs:2
GoalListType
Definition: GoalListType.cs:2
Hostility
Definition: Hostility.cs:2
MinionType
Definition: MinionType.cs:2
NameStyle
Definition: NameStyle.cs:2
PlaceState
Definition: PlaceState.cs:2
Rarity
Definition: Rarity.cs:2
RescueState
Definition: RescueState.cs:2
SpawnHostility
SpawnPosition
Definition: SpawnPosition.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
VisitorState
Definition: VisitorState.cs:2
ZoneFeatureType
ZoneScaleType
Definition: ZoneScaleType.cs:2
virtual void OnSimulatePosition()
Definition: AIAct.cs:590
void SimulateZone(int days)
Definition: AIAct.cs:578
void Add(Act a, string s="")
Definition: ActPlan.cs:11
Definition: ACT.cs:62
virtual bool IsHostileAct
Definition: ACT.cs:129
static AM_Adv Adv
Definition: ActionMode.cs:15
BaseArea.AccessType accessType
Definition: AreaData.cs:42
bool atrium
Definition: AreaData.cs:66
static int indexFollower
AreaData data
Definition: BaseArea.cs:29
PointList points
Definition: BaseArea.cs:26
void WaitForEndOfFrame(Action action)
Definition: BaseCore.cs:61
Version version
Definition: BaseCore.cs:17
string GetRandomCharaId()
void Populate(Point point, bool interior=false, float mtpDensity=1f)
static void Set(CardBlueprint _bp)
Thing container_shipping
Definition: CardManager.cs:52
GlobalCharaList globalCharas
Definition: CardManager.cs:46
List< Chara > ListGlobalChara(Zone z)
Definition: CardManager.cs:103
override void OnLeaveScreen()
void KillActor()
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
MinionType c_minionType
Definition: Card.cs:962
bool IsPCFactionOrMinion
Definition: Card.cs:2234
bool IsDecayed
Definition: Card.cs:2249
virtual bool isThing
Definition: Card.cs:2043
virtual Chara Chara
Definition: Card.cs:2032
virtual void OnSimulateHour(VirtualDate date)
Definition: Card.cs:6318
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3645
string id
Definition: Card.cs:33
bool isNPCProperty
Definition: Card.cs:540
SourceBacker.Row sourceBacker
Definition: Card.cs:902
bool isSubsetCard
Definition: Card.cs:732
bool isRestrained
Definition: Card.cs:552
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5897
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2994
int c_lockLv
Definition: Card.cs:938
virtual void HealHP(int a, HealSource origin=HealSource.None)
Definition: Card.cs:3901
Card AddCard(Card c)
Definition: Card.cs:3043
bool isSale
Definition: Card.cs:852
int c_uidMaster
Definition: Card.cs:1423
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3057
int hp
Definition: Card.cs:228
Rarity rarity
Definition: Card.cs:300
ICardParent parent
Definition: Card.cs:53
bool hasSpawned
Definition: Card.cs:888
void AddEditorTag(EditorTag tag)
Definition: Card.cs:2567
PlaceState placeState
Definition: Card.cs:81
bool HasTag(CTAG tag)
Definition: Card.cs:2557
Point pos
Definition: Card.cs:57
void DecayNatural(int hour=1)
Definition: Card.cs:6327
int uid
Definition: Card.cs:120
Trait trait
Definition: Card.cs:51
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2478
void RemoveBacker()
Definition: Card.cs:6756
int c_idBacker
Definition: Card.cs:1411
void PlayAnimeLoot()
Definition: Card.cs:5926
void Destroy()
Definition: Card.cs:4895
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2562
ThingContainer things
Definition: Card.cs:36
bool IsInstalled
Definition: Card.cs:2343
virtual bool isChara
Definition: Card.cs:2045
virtual Thing Thing
Definition: Card.cs:2020
int Evalue(int ele)
Definition: Card.cs:2533
bool isOn
Definition: Card.cs:528
bool TryStackTo(Thing to)
Definition: Card.cs:3295
Card Install()
Definition: Card.cs:3639
void ApplyBacker(int bid)
Definition: Card.cs:6720
void SetRandomDir()
Definition: Card.cs:5959
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3034
SourceCategory.Row category
Definition: Card.cs:2011
bool IsContainer
Definition: Card.cs:2051
CardRenderer renderer
Definition: Card.cs:59
bool isBackerContent
Definition: Card.cs:899
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6544
List< Thing > things
Definition: CellDetail.cs:11
Definition: Cell.cs:7
Room room
Definition: Cell.cs:102
byte decal
Definition: Cell.cs:44
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712
bool IsFarmField
Definition: Cell.cs:730
bool isModified
Definition: Cell.cs:438
byte light
Definition: Cell.cs:60
GrowSystem growth
Definition: Cell.cs:225
CellDetail detail
Definition: Cell.cs:92
bool HasRoof
Definition: Cell.cs:648
bool isSeen
Definition: Cell.cs:282
SourceObj.Row sourceObj
Definition: Cell.cs:1072
bool HasFire
Definition: Cell.cs:676
Point GetPoint()
Definition: Cell.cs:1101
bool CanGrowWeed
Definition: Cell.cs:742
int index
Definition: Cell.cs:114
bool hasDoor
Definition: Cell.cs:258
void AddRandom()
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
Definition: CharaGen.cs:22
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Definition: Chara.cs:10
new TraitChara trait
Definition: Chara.cs:501
Hostility OriginalHostility
Definition: Chara.cs:469
AIAct ai
Definition: Chara.cs:200
void ValidateWorks()
Definition: Chara.cs:8819
ConSuspend conSuspend
Definition: Chara.cs:104
bool CanRevive()
Definition: Chara.cs:4925
Faction faction
Definition: Chara.cs:425
override bool IsPC
Definition: Chara.cs:610
Chara host
Definition: Chara.cs:33
AIAct SetNoGoal()
Definition: Chara.cs:8473
override bool IsGlobal
Definition: Chara.cs:608
override bool IsPCParty
Definition: Chara.cs:613
bool IsInCombat
Definition: Chara.cs:862
bool HasCondition(string alias)
Definition: Chara.cs:9005
AIAct SetAI(AIAct g)
Definition: Chara.cs:8478
override bool IsMinion
Definition: Chara.cs:625
Point orgPos
Definition: Chara.cs:21
override bool IsPCFaction
Definition: Chara.cs:669
Goal GetGoalWork()
Definition: Chara.cs:8413
override int MaxHP
Definition: Chara.cs:706
Zone currentZone
Definition: Chara.cs:253
Goal GetGoalHobby()
Definition: Chara.cs:8426
SourceChara.Row source
Definition: Chara.cs:156
Stats mana
Definition: Chara.cs:1136
Stats stamina
Definition: Chara.cs:1128
void TryRestock(bool onCreate)
Definition: Chara.cs:4571
GlobalData global
Definition: Chara.cs:76
bool IsHomeMember()
Definition: Chara.cs:6312
Chara master
Definition: Chara.cs:88
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:4951
Zone homeZone
Definition: Chara.cs:265
bool IsGuest()
Definition: Chara.cs:6337
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:7808
Religion faith
Definition: Chara.cs:437
Chara enemy
Definition: Chara.cs:86
CharaAbility ability
Definition: Chara.cs:422
bool IsInActiveZone
Definition: Chara.cs:836
Chara FindMaster()
Definition: Chara.cs:2332
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6028
void SyncRide()
Definition: Chara.cs:3826
FactionBranch homeBranch
Definition: Chara.cs:1052
void ChooseNewGoal()
Definition: Chara.cs:8349
Hostility hostility
Definition: Chara.cs:289
bool IsHostile()
Definition: Chara.cs:6254
bool isDead
Definition: Chara.cs:387
void SetFaith(string id)
Definition: Chara.cs:1688
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:9084
void MoveZone(string alias)
Definition: Chara.cs:3265
SourceRace.Row race
Definition: Chara.cs:462
void AddSpawn(string id)
Definition: CodexManager.cs:65
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:555
void SetBGMInterval()
Definition: CoreConfig.cs:999
bool test
Definition: CoreDebug.cs:170
bool revealMap
Definition: CoreDebug.cs:154
bool enable
Definition: CoreDebug.cs:286
bool godBuild
Definition: CoreDebug.cs:304
bool ignoreBuildRule
Definition: CoreDebug.cs:185
static string ZoneSave
Definition: CorePath.cs:196
UD_Biome dict
Definition: CoreRef.cs:146
BiomeProfile Water
Definition: CoreRef.cs:152
BiomeProfile Sand
Definition: CoreRef.cs:150
Crawler start
Definition: CoreRef.cs:214
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:385
Biomes biomes
Definition: CoreRef.cs:341
Crawlers crawlers
Definition: CoreRef.cs:343
CoreRef refs
Definition: Core.cs:51
TextureManager textures
Definition: Core.cs:45
CoreConfig config
Definition: Core.cs:70
static Crawler Create(string id)
Definition: Crawler.cs:193
bool CrawlUntil(Map map, Func< Point > onStart, int tries, Func< Result, bool > canComplete, Action onFail=null)
Definition: Crawler.cs:59
Definition: DNA.cs:8
Type
Definition: DNA.cs:10
int GetElapsedHour(int rawDate)
Definition: Date.cs:352
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
bool IsExpired(int time)
Definition: Date.cs:332
bool IsNight
Definition: Date.cs:112
bool IsWinter
Definition: Date.cs:186
int GetElapsedMins(int rawDate)
Definition: Date.cs:347
int GetRemainingHours(int rawDeadLine)
Definition: Date.cs:337
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Scene scene
Definition: EClass.cs:30
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:68
static GameData gamedata
Definition: EClass.cs:36
static Core core
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:20
static World world
Definition: EClass.cs:40
static Map _map
Definition: EClass.cs:18
static int rnd(long a)
Definition: EClass.cs:58
static SourceManager sources
Definition: EClass.cs:42
static float rndf(float a)
Definition: EClass.cs:92
static FactionBranch Branch
Definition: EClass.cs:22
static int rndHalf(int a)
Definition: EClass.cs:87
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static SoundManager Sound
Definition: EClass.cs:46
static UI ui
Definition: EClass.cs:16
static GameSetting setting
Definition: EClass.cs:34
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:85
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
bool Has(int ele)
int Value(int ele)
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1100
void Initialize(EloMap _elomap)
Definition: EloMapActor.cs:28
EloMap elomap
Definition: EloMapActor.cs:7
string idZoneProfile
Definition: EloMap.cs:68
Definition: EloMap.cs:8
void SetZone(int gx, int gy, Zone z, bool updateMesh=false)
Definition: EloMap.cs:234
TileInfo GetTileInfo(int gx, int gy)
Definition: EloMap.cs:286
void OnAfterSimulate()
void OnSimulateMonth(VirtualDate date)
void OnActivateZone()
int Evalue(int ele)
void OnCreate(Zone zone)
void OnUnclaimZone()
void OnSimulateDay(VirtualDate date)
List< Chara > members
void SetOwner(Zone zone)
void OnSimulateHour(VirtualDate date)
PolicyManager policies
void OnUnloadMap()
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
ElementContainerZone elements
void AddMemeber(Chara c)
List< GodStatueData > godStatues
Definition: GameData.cs:9
Definition: GameIO.cs:10
BalanceSetting balance
Definition: GameSetting.cs:309
bool isLoading
Definition: Game.cs:238
ReligionManager religions
Definition: Game.cs:158
int countLoadedMaps
Definition: Game.cs:232
SpatialManager spatials
Definition: Game.cs:152
CardManager cards
Definition: Game.cs:155
Zone activeZone
Definition: Game.cs:248
QuestManager quests
Definition: Game.cs:179
int seed
Definition: Game.cs:197
Zone StartZone
Definition: Game.cs:274
ZoneTransition transition
Definition: GlobalData.cs:6
Definition: Goal.cs:4
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:432
virtual bool IsMature
Definition: GrowSystem.cs:103
Stage stage
Definition: GrowSystem.cs:101
virtual bool NeedSunlight
Definition: GrowSystem.cs:93
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:268
Definition: Guild.cs:2
void RefreshDevelopment()
Definition: Guild.cs:95
static Guild GetCurrentGuild()
Definition: Guild.cs:74
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
static bool keepBGM
Definition: LayerDrama.cs:10
int idBGM
Definition: Lot.cs:16
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:52
Point GetLeftPos(float rate=-1f)
Definition: MapBounds.cs:92
int Size
Definition: MapBounds.cs:20
void ForeachCell(Action< Cell > action)
Definition: MapBounds.cs:279
Point GetBottomPos(float rate=-1f)
Definition: MapBounds.cs:87
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Definition: MapBounds.cs:182
int Width
Definition: MapBounds.cs:26
int x
Definition: MapBounds.cs:8
Point GetTopPos(float rate=-1f)
Definition: MapBounds.cs:77
Point GetRandomSpace(int width, int height, int tries=100)
Definition: MapBounds.cs:246
Point GetCenterPos()
Definition: MapBounds.cs:52
int Height
Definition: MapBounds.cs:28
Point GetRightPos(float rate=-1f)
Definition: MapBounds.cs:82
Point GetRandomPoint()
Definition: MapBounds.cs:97
string idSceneProfile
Definition: MapConfig.cs:8
bool retainDecal
Definition: MapConfig.cs:44
string idBiome
Definition: MapConfig.cs:26
int embarkY
Definition: MapConfig.cs:86
int embarkX
Definition: MapConfig.cs:83
bool IsValidVersion()
Definition: MapMetaData.cs:31
void Apply()
Definition: MapSubset.cs:60
static MapSubset Load(string id)
Definition: MapSubset.cs:33
Definition: Map.cs:13
bool IsIndoor
Definition: Map.cs:131
new void ForeachCell(Action< Cell > action)
Definition: Map.cs:2346
void ResetEditorPos()
Definition: Map.cs:357
Cell GetCell(int index)
Definition: Map.cs:887
PlantData TryGetPlant(Point p)
Definition: Map.cs:1942
void ExportMetaData(string _path, string id, PartialMap partial=null)
Definition: Map.cs:720
Chara FindChara(string id)
Definition: Map.cs:2568
IEnumerable< Card > Cards
Definition: Map.cs:135
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
Definition: Map.cs:2215
void Save(string path, ZoneExportData export=null, PartialMap partial=null)
Definition: Map.cs:376
PropsInstalled Installed
Definition: Map.cs:123
void AddCardOnActivate(Card c)
Definition: Map.cs:783
void OnDeactivate()
Definition: Map.cs:205
void OnCardRemovedFromZone(Card t)
Definition: Map.cs:825
void SetZone(Zone _zone)
Definition: Map.cs:181
List< Thing > things
Definition: Map.cs:49
byte[] TryLoadFile(string path, string s, int size)
Definition: Map.cs:535
Dictionary< int, int > backerObjs
Definition: Map.cs:67
List< int > _plDay
Definition: Map.cs:55
Playlist plDay
Definition: Map.cs:77
List< Chara > deadCharas
Definition: Map.cs:46
PropsManager props
Definition: Map.cs:91
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:957
int seed
Definition: Map.cs:19
PlantData AddPlant(Point pos, Thing seed)
Definition: Map.cs:1952
RoomManager rooms
Definition: Map.cs:31
void SetReference()
Definition: Map.cs:195
POIMap poiMap
Definition: Map.cs:97
void ClearRainAndDecal()
Definition: Map.cs:1526
void OnLoad()
Definition: Map.cs:708
void OnImport(ZoneExportData data)
Definition: Map.cs:714
List< Chara > serializedCharas
Definition: Map.cs:43
Cell[,] cells
Definition: Map.cs:85
static MapMetaData GetMetaData(string pathZip)
Definition: Map.cs:738
void OnCardAddedToZone(Card t, int x, int z)
Definition: Map.cs:806
MapConfig config
Definition: Map.cs:37
void Load(string path, bool import=false, PartialMap partial=null)
Definition: Map.cs:546
List< Chara > charas
Definition: Map.cs:81
void RevealAll(bool reveal=true)
Definition: Map.cs:905
void RefreshAllTiles()
Definition: Map.cs:2108
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1535
MapBounds bounds
Definition: Map.cs:52
Definition: Msg.cs:5
static string SayRaw(string text)
Definition: Msg.cs:113
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: NoGoal.cs:4
Point GetCenter()
Definition: POIMap.cs:13
Cell GetCenterCell(int radius=1)
Definition: POIMap.cs:65
void OccyupyPOI(Point p, int radius=0)
Definition: POIMap.cs:99
static PathManager Instance
Definition: PathManager.cs:16
bool IsPathClear(Point origin, Point dest, IPathfindWalker walker, int radius)
Definition: PathManager.cs:47
int deepest
Definition: Player.cs:111
int days
Definition: Player.cs:75
CodexManager codex
Definition: Player.cs:1035
Stats stats
Definition: Player.cs:936
bool isAutoFarming
Definition: Player.cs:1101
HashSet< int > doneBackers
Definition: Player.cs:993
Zone nextZone
Definition: Player.cs:1145
Point lastZonePos
Definition: Player.cs:1023
int seedShrine
Definition: Player.cs:864
List< Chara > listSummon
Definition: Player.cs:1141
int fame
Definition: Player.cs:804
bool simulatingZone
Definition: Player.cs:1099
Definition: Point.cs:9
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:912
override string ToString()
Definition: Point.cs:512
Point Set(int _x, int _z)
Definition: Point.cs:491
bool IsBlocked
Definition: Point.cs:351
List< Thing > Things
Definition: Point.cs:326
int x
Definition: Point.cs:36
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:607
int z
Definition: Point.cs:39
bool IsSync
Definition: Point.cs:332
bool HasThing
Definition: Point.cs:239
bool Equals(int _x, int _z)
Definition: Point.cs:944
bool IsValid
Definition: Point.cs:88
bool HasObj
Definition: Point.cs:137
Point Clamp(bool useBounds=false)
Definition: Point.cs:992
bool HasBlock
Definition: Point.cs:141
bool IsInBounds
Definition: Point.cs:104
Cell cell
Definition: Point.cs:51
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1124
GrowSystem growth
Definition: Point.cs:77
bool HasChara
Definition: Point.cs:226
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:757
bool IsActive(int id, int days=-1)
PropsInstalled installed
Definition: PropsManager.cs:8
PropsRoaming roaming
Definition: PropsManager.cs:10
PropsStocked stocked
Definition: PropsManager.cs:6
TraitManager traits
Definition: Props.cs:18
List< Thing > Things
Definition: Props.cs:37
Thing Find(int uid)
Definition: Props.cs:389
List< Thing > containers
Definition: Props.cs:22
List< Quest > list
Definition: QuestManager.cs:11
Definition: Quest.cs:7
static List< Zone > ListDeliver()
Definition: Quest.cs:259
static Quest Create(string _id, string _idPerson=null, Chara c=null)
Definition: Quest.cs:241
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:42
static void InitBytes(int a)
Definition: Rand.cs:11
static void UseSeed(int seed, Action action)
Definition: Rand.cs:22
static void SetSeed(int a=-1)
Definition: Rand.cs:37
Definition: Recipe.cs:7
Definition: Region.cs:7
EloMap elomap
Definition: Region.cs:8
Dictionary< string, Religion > dictAll
Religion GetRandomReligion(bool onlyJoinable=true, bool includeMinor=false)
int LV
Definition: RenderRow.cs:22
List< Room > listRoom
Definition: RoomManager.cs:13
void AssignCharas()
Definition: RoomManager.cs:39
Definition: Room.cs:4
bool HasRoof
Definition: Room.cs:29
Lot lot
Definition: Room.cs:21
static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect)
static string SaveFilePanel(string title, string directory, string defaultName, string extension)
static SceneProfile Load(string id)
Definition: SceneProfile.cs:18
void RebuildActorEx()
Definition: Scene.cs:986
EloMapActor elomapActor
Definition: Scene.cs:101
void Clear()
Definition: Scene.cs:353
void RemoveActorEx(Card c)
Definition: Scene.cs:1027
EloMap elomap
Definition: Scene.cs:149
List< Row > listFollower
Definition: SourceBacker.cs:82
List< Row > listPet
Definition: SourceBacker.cs:76
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
SourceCard cards
SourceObj objs
SourceZoneAffix zoneAffixes
SourceBacker backers
SourceElement elements
SourceQuest quests
string[] tags
Definition: SourceQuest.cs:22
void Remove(Spatial s)
Zone Find(string id)
int mapX
Definition: Spatial.cs:448
int lv
Definition: Spatial.cs:142
virtual bool IsSnowZone
Definition: Spatial.cs:530
int uid
Definition: Spatial.cs:70
Spatial parent
Definition: Spatial.cs:10
string idCurrentSubset
Definition: Spatial.cs:28
virtual int DangerLvFix
Definition: Spatial.cs:475
virtual bool IsRegion
Definition: Spatial.cs:503
virtual string Name
Definition: Spatial.cs:497
virtual int DangerLvBoost
Definition: Spatial.cs:477
int dateQuest
Definition: Spatial.cs:286
virtual void Destroy()
Definition: Spatial.cs:678
Point _regionPos
Definition: Spatial.cs:55
SourceZone.Row source
Definition: Spatial.cs:441
bool destryoed
Definition: Spatial.cs:45
int idPrefix
Definition: Spatial.cs:130
bool isImported
Definition: Spatial.cs:47
bool isConquered
Definition: Spatial.cs:382
string idProfile
Definition: Spatial.cs:25
int y
Definition: Spatial.cs:106
Zone FindDeepestZone()
Definition: Spatial.cs:703
int mapY
Definition: Spatial.cs:460
int x
Definition: Spatial.cs:94
Zone FindZone(int lv)
Definition: Spatial.cs:716
static SpawnList Get(string id, Func< SourceChara.Row, bool > func)
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
Definition: SpawnList.cs:18
static SpawnSetting Default
Definition: SpawnSetting.cs:31
static SpawnSetting Fish()
static SpawnSetting Evolved(int fixedLv=-1)
Definition: SpawnSetting.cs:35
virtual void Mod(int a)
Definition: Stats.cs:135
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
void ApplyLocalReplace(string path)
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
void DestroyAll(Func< Thing, bool > funcExclude=null)
Thing Find(int uid)
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:523
bool IsSharedContainer
Definition: Thing.cs:112
virtual bool CanGiveRandomQuest
Definition: TraitChara.cs:116
virtual bool CanAutoRevive
Definition: TraitChara.cs:20
TraitSet GetTraitSet(Type t)
Definition: TraitManager.cs:94
virtual bool IsFor(Zone z)
static bool CanTagSale(Card t, bool insideContainer=false)
Definition: TraitSalesTag.cs:9
static Thing MakeSeed(SourceObj.Row obj, PlantData plant=null)
Definition: TraitSeed.cs:88
static void LevelSeed(Thing t, SourceObj.Row obj, int num)
Definition: TraitSeed.cs:140
Definition: Trait.cs:7
virtual string IDActorEx
Definition: Trait.cs:174
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
Definition: Trait.cs:748
virtual void TryToggle()
Definition: Trait.cs:1125
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:730
virtual ShopType ShopType
Definition: Trait.cs:514
string GetParam(int i, string def=null)
Definition: Trait.cs:556
Point GetPoint()
Definition: Trait.cs:725
virtual int Electricity
Definition: Trait.cs:102
virtual int Decay
Definition: Trait.cs:120
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
Definition: UINote.cs:6
bool IsRealTime
Definition: VirtualDate.cs:7
void SimulateHour()
Definition: VirtualDate.cs:66
void BuildSunMap()
Definition: VirtualDate.cs:54
HashSet< int > sunMap
Definition: VirtualDate.cs:9
bool IsRaining
Definition: Weather.cs:117
FilterResult IsFilterPass(string text)
Definition: Window.cs:498
ContainerFlag flag
Definition: Window.cs:267
HashSet< int > cats
Definition: Window.cs:119
bool userFilter
Definition: Window.cs:132
bool noRotten
Definition: Window.cs:439
bool onlyRottable
Definition: Window.cs:451
bool advDistribution
Definition: Window.cs:427
Definition: Window.cs:13
GameDate date
Definition: World.cs:6
Weather weather
Definition: World.cs:12
void GenerateMap(Zone zone)
EloMap.TileInfo[,] surrounding
List< ZoneEvent > list
List< ZonePreEnterEvent > listPreEnter
void OnLoad(Zone _zone)
virtual void OnGenerateMap()
Definition: ZoneInstance.cs:32
virtual bool ShowEnemyOnMinimap
Definition: ZoneInstance.cs:30
virtual void Execute()
static ZoneProfile Load(string id)
Definition: ZoneProfile.cs:73
EnterState state
Definition: Zone.cs:12
void SetBGM(int id=-1, bool refresh=true)
Definition: Zone.cs:2882
virtual string GetNewZoneID(int level)
Definition: Zone.cs:542
string TextDangerLv
Definition: Zone.cs:426
Vector3 InspectPosition
Definition: Zone.cs:508
void OnChildNumChange(Card c)
Definition: Zone.cs:1887
int GetSortVal()
Definition: Zone.cs:3151
virtual bool CanDigUnderground
Definition: Zone.cs:268
bool isSimulating
Definition: Zone.cs:72
virtual int BaseElectricity
Definition: Zone.cs:488
virtual string IDPlayList
Definition: Zone.cs:138
Dictionary< int, string > dictCitizen
Definition: Zone.cs:49
void SetBGM(List< int > ids, bool refresh=true)
Definition: Zone.cs:2859
override string ToString()
Definition: Zone.cs:547
List< Chara > ListMinions(Chara c)
Definition: Zone.cs:3560
void RefreshElectricity()
Definition: Zone.cs:2789
ZoneExportData Import(string path)
Definition: Zone.cs:3042
override int ContentLv
Definition: Zone.cs:95
virtual string IDBaseLandFeat
Definition: Zone.cs:144
virtual bool LockExit
Definition: Zone.cs:270
void Generate()
Definition: Zone.cs:2316
virtual string GetDungenID()
Definition: Zone.cs:532
void Revive()
Definition: Zone.cs:1095
virtual bool BlockBorderExit
Definition: Zone.cs:166
ZoneEventManager events
Definition: Zone.cs:40
void Simulate()
Definition: Zone.cs:1161
BiomeProfile _biome
Definition: Zone.cs:76
ZoneProfile GetProfile()
Definition: Zone.cs:2264
static string forceSubset
Definition: Zone.cs:27
virtual float PrespawnRate
Definition: Zone.cs:322
virtual int MaxSpawn
Definition: Zone.cs:308
FortuneRollData GetOrCreateFortuneRollData(bool refresh=true)
Definition: Zone.cs:3689
void SpawnAltar()
Definition: Zone.cs:2471
virtual bool UseLight
Definition: Zone.cs:393
virtual bool RegenerateOnEnter
Definition: Zone.cs:260
int MinsSinceLastActive
Definition: Zone.cs:122
virtual void OnAfterSimulate()
Definition: Zone.cs:1153
static int okaerinko
Definition: Zone.cs:31
override void OnLoad()
Definition: Zone.cs:1837
virtual string idExport
Definition: Zone.cs:147
void OnSimulateDay(VirtualDate date)
Definition: Zone.cs:3248
virtual int StartLV
Definition: Zone.cs:404
virtual float OreChance
Definition: Zone.cs:314
Playlist CreatePlaylist(ref List< int > list, Playlist mold=null)
Definition: Zone.cs:2935
static bool IsImportValid(string path)
Definition: Zone.cs:3121
virtual bool IsNefia
Definition: Zone.cs:280
virtual string IDGenerator
Definition: Zone.cs:130
int CountMinions(Chara c)
Definition: Zone.cs:3573
bool CanDestroy()
Definition: Zone.cs:1768
virtual bool MakeTownProperties
Definition: Zone.cs:240
Thing TryGetThingFromSharedContainer(Func< Thing, bool > func)
Definition: Zone.cs:2201
void Activate()
Definition: Zone.cs:586
void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
Definition: Zone.cs:3143
virtual void OnRegenerate()
Definition: Zone.cs:1129
bool isStarted
Definition: Zone.cs:70
virtual bool CountDeepestLevel
Definition: Zone.cs:224
virtual ZoneScaleType ScaleType
Definition: Zone.cs:406
void OnKillGame()
Definition: Zone.cs:1673
virtual string pathExport
Definition: Zone.cs:124
void RefreshCriminal()
Definition: Zone.cs:3421
virtual void OnBeforeDeactivate()
Definition: Zone.cs:1137
MapSubset subset
Definition: Zone.cs:62
int tempDist
Definition: Zone.cs:74
virtual ZoneTransition.EnterState RegionEnterState
Definition: Zone.cs:170
virtual bool ShouldAutoRevive
Definition: Zone.cs:375
Zone GetTopZone()
Definition: Zone.cs:1896
BiomeProfile biome
Definition: Zone.cs:126
HashSet< int > completedQuests
Definition: Zone.cs:37
virtual bool IsSkyLevel
Definition: Zone.cs:262
bool IsPCFactionOrTent
Definition: Zone.cs:471
virtual bool DisableRooms
Definition: Zone.cs:118
Chara TryGenerateEvolved(bool force=false, Point p=null)
Definition: Zone.cs:2563
FactionBranch branch
Definition: Zone.cs:34
void ImportDialog(string dir=null)
Definition: Zone.cs:3105
virtual string IDSubset
Definition: Zone.cs:209
void ClaimZone(bool debug=false, Point pos=null)
Definition: Zone.cs:1698
Chara AddChara(string id, int x, int z)
Definition: Zone.cs:1920
Card AddThing(string id, int x, int z)
Definition: Zone.cs:1925
ZoneBlueprint bp
Definition: Zone.cs:64
int GetDeepestLv()
Definition: Zone.cs:2968
override void OnCreate()
Definition: Zone.cs:565
void RefreshBGM()
Definition: Zone.cs:2895
void Deactivate()
Definition: Zone.cs:1605
virtual bool ShouldScaleImportedChara(Chara c)
Definition: Zone.cs:537
ElementContainerZone elements
Definition: Zone.cs:43
virtual bool IsReturnLocation
Definition: Zone.cs:349
void RefreshPlaylist()
Definition: Zone.cs:2887
void AbandonZone()
Definition: Zone.cs:1752
Chara AddRandomVisitor(bool guest=false)
Definition: Zone.cs:3164
void ExportDialog(string dir=null)
Definition: Zone.cs:3092
virtual void OnBeforeSimulate()
Definition: Zone.cs:1145
int GetElectricity(bool cost=false)
Definition: Zone.cs:2820
virtual FlockController.SpawnType FlockType
Definition: Zone.cs:410
virtual bool GrowWeed
Definition: Zone.cs:344
void SpawnLostItems()
Definition: Zone.cs:3596
virtual bool HasLaw
Definition: Zone.cs:226
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
Definition: Zone.cs:2689
virtual bool CanUnlockExit
Definition: Zone.cs:272
int GetDeepestLv(ref int max)
Definition: Zone.cs:2974
virtual int RespawnPerHour
Definition: Zone.cs:338
Chara FindChara(int uid)
Definition: Zone.cs:2963
int Evalue(string alias)
Definition: Zone.cs:527
virtual int MaxSoil
Definition: Zone.cs:511
bool IsStartZone
Definition: Zone.cs:482
virtual float RespawnRate
Definition: Zone.cs:324
virtual bool IsUserZone
Definition: Zone.cs:266
void ApplyBackerPet(bool draw)
Definition: Zone.cs:3641
bool CanEnterBuildModeAnywhere
Definition: Zone.cs:453
Card AddCardSplinkle(Card t, Point center, int radius=4)
Definition: Zone.cs:1905
override string NameSuffix
Definition: Zone.cs:413
virtual string IdProfile
Definition: Zone.cs:136
void TryGenerateShrine()
Definition: Zone.cs:2600
virtual string TextWidgetDate
Definition: Zone.cs:132
void AddGlobalCharasOnActivate()
Definition: Zone.cs:1524
void OnSimulateMonth(VirtualDate date)
Definition: Zone.cs:3256
virtual float RuinChance
Definition: Zone.cs:312
virtual bool AddPrefix
Definition: Zone.cs:278
virtual float ChanceSpawnNeutral
Definition: Zone.cs:340
virtual string IDSceneTemplate
Definition: Zone.cs:191
virtual bool CanBeDeliverDestination
Definition: Zone.cs:222
MapBounds bounds
Definition: Zone.cs:46
bool IsInstance
Definition: Zone.cs:484
void ClearZones(Zone current=null)
Definition: Zone.cs:1865
Chara Boss
Definition: Zone.cs:83
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2078
virtual bool IsFestival
Definition: Zone.cs:206
virtual void OnDeactivate()
Definition: Zone.cs:1141
void OnVisit()
Definition: Zone.cs:1054
virtual ActionMode DefaultActionMode
Definition: Zone.cs:164
virtual bool AllowInvest
Definition: Zone.cs:245
string InspectName
Definition: Zone.cs:504
virtual string IDHat
Definition: Zone.cs:142
virtual bool IsTown
Definition: Zone.cs:220
void OnInspect()
Definition: Zone.cs:3147
void TryGenerateOre()
Definition: Zone.cs:2536
virtual void OnActivate()
Definition: Zone.cs:1133
Card AddCard(Card t, int x, int z)
Definition: Zone.cs:1945
void OnSimulateHour(VirtualDate date)
Definition: Zone.cs:3193
override void _OnBeforeSave()
Definition: Zone.cs:1810
void RainWater()
Definition: Zone.cs:3268
Point InspectPoint
Definition: Zone.cs:506
override void OnAfterCreate()
Definition: Zone.cs:571
static List< Thing > Suckers
Definition: Zone.cs:80
Card AddThing(string id, Point p)
Definition: Zone.cs:1930
virtual int MaxLv
Definition: Zone.cs:274
override void Destroy()
Definition: Zone.cs:1846
virtual bool UseFog
Definition: Zone.cs:386
virtual bool GrowPlant
Definition: Zone.cs:342
virtual string IDAmbience
Definition: Zone.cs:175
virtual string IDPlaylistOverwrite
Definition: Zone.cs:140
virtual string IdBiome
Definition: Zone.cs:128
bool dirtyElectricity
Definition: Zone.cs:68
void RemoveCard(Card t)
Definition: Zone.cs:1975
Point GetSpawnPos(SpawnPosition type, int tries=100)
Definition: Zone.cs:2656
bool TryAddThing(Thing target, Point p, bool destroyIfFail=false)
Definition: Zone.cs:2175
void GrowPlants(VirtualDate date)
Definition: Zone.cs:3283
Chara FindChara(string id)
Definition: Zone.cs:2958
virtual bool ShouldMakeExit
Definition: Zone.cs:361
void RefreshHat()
Definition: Zone.cs:1044
virtual bool AllowCriminal
Definition: Zone.cs:242
virtual bool AlwaysLowblock
Definition: Zone.cs:390
static CardRow sourceHat
Definition: Zone.cs:29
MapGenerator Generator
Definition: Zone.cs:134
virtual bool AllowNewZone
Definition: Zone.cs:256
bool ShowEnemyOnMinimap
Definition: Zone.cs:327
bool IsActiveZone
Definition: Zone.cs:490
void ModInfluence(int a)
Definition: Zone.cs:3454
int HourSinceLastActive
Definition: Zone.cs:120
virtual bool RestrictBuild
Definition: Zone.cs:285
virtual void OnGenerateRooms(BaseMapGen gen)
Definition: Zone.cs:2652
Point GetRandomVisitPos(Chara c)
Definition: Zone.cs:1502
void Export()
Definition: Zone.cs:3134
void UnloadMap()
Definition: Zone.cs:1684
virtual void OnGenerateMap()
Definition: Zone.cs:2510
List< Element > ListLandFeats()
Definition: Zone.cs:2987
int fileVariation
Definition: Zone.cs:66
virtual bool PetFollow
Definition: Zone.cs:282
override int DangerLv
Definition: Zone.cs:107
static bool forceRegenerate
Definition: Zone.cs:25
Zone ParentZone
Definition: Zone.cs:162
virtual int MinLv
Definition: Zone.cs:276
bool IsPCFaction
Definition: Zone.cs:468
void ResetHostility()
Definition: Zone.cs:2636
virtual bool MakeEnemiesNeutral
Definition: Zone.cs:229
virtual bool IsUnderwater
Definition: Zone.cs:264
virtual void OnCreateBP()
Definition: Zone.cs:2312
void Export(string path, PartialMap partial=null, bool usermap=false)
Definition: Zone.cs:3051
void TrySpawnFollower()
Definition: Zone.cs:2437
virtual bool ShouldRegenerate
Definition: Zone.cs:372
virtual float BigDaddyChance
Definition: Zone.cs:316
string NameWithLevel
Definition: Zone.cs:424
void TryGenerateBigDaddy()
Definition: Zone.cs:2582
virtual float EvolvedChance
Definition: Zone.cs:318
static bool ignoreSpawnAnime
Definition: Zone.cs:78
string TextDeepestLv
Definition: Zone.cs:429
ICardParent GetRoot()
Definition: Zone.cs:1891
int GetSoilCost()
Definition: Zone.cs:3586
void CreateBP()
Definition: Zone.cs:2304
string pathTemp
Definition: Zone.cs:158
virtual void OnAdvanceHour()
Definition: Zone.cs:1157
FortuneRollData fortuneRoll
Definition: Zone.cs:58
ZoneInstance instance
Definition: Zone.cs:52
void ModDevelopment(int a)
Definition: Zone.cs:3464
virtual bool WillAutoSave
Definition: Zone.cs:258
virtual bool IsExplorable
Definition: Zone.cs:346
virtual bool RevealRoom
Definition: Zone.cs:388
void UpdateQuests(bool force=false)
Definition: Zone.cs:3473
Region Region
Definition: Zone.cs:160
virtual bool KeepAllyDistance
Definition: Zone.cs:297
virtual bool HiddenInRegionMap
Definition: Zone.cs:408
bool IsLoaded
Definition: Zone.cs:486
bool IsCrime(Chara c, Act act)
Definition: Zone.cs:3412
bool CanEnterBuildMode
Definition: Zone.cs:441
void RefreshListCitizen()
Definition: Zone.cs:3438
Card AddCard(Card t)
Definition: Zone.cs:1940
Zone GetZoneAt(int _x, int _y)
Definition: Zone.cs:3390
List< int > landFeats
Definition: Zone.cs:55
Card AddCard(Card t, Point point)
Definition: Zone.cs:1935
string TextLevel(int _lv)
Definition: Zone.cs:552
int Evalue(int ele)
Definition: Zone.cs:522
virtual ZoneFeatureType FeatureType
Definition: Zone.cs:172
virtual float ShrineChance
Definition: Zone.cs:320
Map map
Definition: Zone.cs:60
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
Definition: Zone.cs:1321
int MaxRespawn
Definition: Zone.cs:310
virtual int ExpireDays
Definition: Zone.cs:168
virtual void OnVisitNewMapOrRegenerate()
Definition: Zone.cs:1149
bool CanInspect
Definition: Zone.cs:493
void RemoveCard(Card c)
NoteMode
Definition: IInspect.cs:7
int GetInt()
Definition: Version.cs:21