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