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