Elin Decompiled Documentation EA 23.360.1 Nightly
Loading...
Searching...
No Matches
Zone Class Reference
Inheritance diagram for Zone:
Spatial ICardParent IInspect EClass Region Zone_Arena Zone_CaveElona Zone_Civilized Zone_Dungeon Zone_Field Zone_Hospital Zone_LumiestRuin Zone_Shelter Zone_SnowGrave Zone_StartCave Zone_StartSite Zone_Tent Zone_TestMap Zone_TestRoom Zone_TruceGround Zone_Underground Zone_User Zone_Wilds Zone_WindRest

Classes

class  PortalReturnData
 

Public Member Functions

Zone FindOrCreateLevel (int destLv, string subId="")
 
int Evalue (int ele)
 
int Evalue (string alias)
 
virtual string GetDungenID ()
 
virtual bool ShouldScaleImportedChara (Chara c)
 
virtual string GetNewZoneID (int level)
 
override string ToString ()
 
string TextLevel (int _lv)
 
override void OnCreate ()
 
override void OnAfterCreate ()
 
void Activate ()
 
void RefreshHat ()
 
void OnVisit ()
 
void RefreshDeathSentense ()
 
void Revive ()
 
virtual void OnRegenerate ()
 
virtual void OnActivate ()
 
virtual void OnBeforeDeactivate ()
 
virtual void OnDeactivate ()
 
virtual void OnBeforeSimulate ()
 
virtual void OnVisitNewMapOrRegenerate ()
 
virtual void OnAfterSimulate ()
 
virtual void OnAdvanceHour ()
 
void Simulate ()
 
Point GetSpawnPos (Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
 
Point GetRandomVisitPos (Chara c)
 
void AddGlobalCharasOnActivate ()
 
void Deactivate ()
 
void OnKillGame ()
 
void UnloadMap ()
 
void ClaimZone (bool debug=false, Point pos=null)
 
void AbandonZone ()
 
bool CanDestroy ()
 
override void _OnBeforeSave ()
 
override void OnLoad ()
 
override void Destroy ()
 
void ClearZones (Zone current=null)
 
void OnChildNumChange (Card c)
 
ICardParent GetRoot ()
 
Zone GetTopZone ()
 
Card AddCardSplinkle (Card t, Point center, int radius=4)
 
Chara AddChara (string id, int x, int z)
 
Chara AddChara (string id, Point p)
 
Card AddThing (string id, int x, int z)
 
Card AddThing (string id, Point p)
 
Card AddCard (Card t, Point point)
 
Card AddCard (Card t)
 
Card AddCard (Card t, int x, int z)
 
void RemoveCard (Card t)
 
T GetRandomSpot< T > ()
 
bool TryAddThingInSpot< T > (Thing t, bool useContainer=true)
 
List< Thing > TryListThingsInSpot< T > (Func< Thing, bool > func=null)
 
bool TryAddThingInSharedContainer (Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
 
Thing FindSharedContainer (Thing t, List< Thing > containers=null, bool sharedOnly=true)
 
bool TryAddThing (Thing target, Point p, bool destroyIfFail=false)
 
Thing TryGetThingFromSharedContainer (Func< Thing, bool > func)
 
Thing TryGetRestock< T > (string idCat)
 
ZoneProfile GetProfile ()
 
void CreateBP ()
 
virtual void OnCreateBP ()
 
void Generate ()
 
void TrySpawnFollower ()
 
void SpawnAltar ()
 
virtual void OnGenerateMap ()
 
void TryGenerateOre ()
 
Chara TryGenerateEvolved (bool force=false, Point p=null)
 
void TryGenerateBigDaddy ()
 
void TryGenerateShrine ()
 
void ResetHostility ()
 
virtual void OnGenerateRooms (BaseMapGen gen)
 
Point GetSpawnPos (SpawnPosition type, int tries=100)
 
Chara SpawnMob (string id, Point pos=null)
 
Chara SpawnMob (Point pos=null, SpawnSetting setting=null)
 
bool HasField (int idEle)
 
void SetFieldEffect (int idEle, int a, int duration=0)
 
void RemoveFieldEffect (int idEle)
 
void RefreshElectricity ()
 
int GetElectricity (bool cost=false)
 
void SetBGM (List< int > ids, bool refresh=true, float fadeDuration=0f)
 
void SetBGM (int id=-1, bool refresh=true, float fadeDuration=0f)
 
void RefreshPlaylist ()
 
void ResetPlaylist ()
 
void RefreshBGM ()
 
Playlist CreatePlaylist (ref List< int > list, Playlist mold=null)
 
Chara FindChara (string id)
 
Chara FindChara (int uid)
 
Chara FindDeadChara (string id)
 
int GetDeepestLv ()
 
int GetDeepestLv (ref int max)
 
int GetCostSkyTravel ()
 
List< Element > ListLandFeats ()
 
ZoneExportData Import (string path)
 
void Export (string path, PartialMap partial=null, bool usermap=false)
 
void ExportDialog (string dir=null)
 
void ImportDialog (string dir=null)
 
void Export ()
 
void WriteNote (UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
 
void OnInspect ()
 
int GetSortVal ()
 
Chara AddRandomVisitor (bool guest=false)
 
void OnSimulateHour (VirtualDate date)
 
void OnSimulateDay (VirtualDate date)
 
void OnSimulateMonth (VirtualDate date)
 
void RainWater ()
 
void GrowPlants (VirtualDate date)
 
Zone GetZoneAt (int _x, int _y)
 
bool IsCrime (Chara c, Act act)
 
void RefreshCriminal ()
 
void RefreshListCitizen ()
 
virtual void SetAlarm (bool enable)
 
void ModInfluence (int a)
 
void ModDevelopment (int a)
 
void UpdateQuests (bool force=false)
 
List< Chara > ListMinions (Chara c)
 
int CountMinions (Chara c)
 
int GetSoilCost ()
 
void SpawnLostItems ()
 
void ApplyBackerPet (bool draw)
 
FortuneRollData GetOrCreateFortuneRollData (bool refresh=true)
 
- Public Member Functions inherited from Spatial
int GetInt (int id, int? defaultInt=null)
 
void AddInt (int id, int value)
 
void SetInt (int id, int value=0)
 
override string ToString ()
 
void Create (string _id, int _x, int _y, int _icon)
 
void Register ()
 
virtual void OnCreate ()
 
virtual void OnAfterCreate ()
 
virtual void SetMainFaction (Faction f)
 
Zone GetFirstZone ()
 
void OnBeforeSave ()
 
virtual void _OnBeforeSave ()
 
void _OnLoad ()
 
virtual void OnLoad ()
 
virtual void Destroy ()
 
void DeleteMapRecursive ()
 
virtual void AddChild (Spatial child)
 
void RemoveChild (Spatial child)
 
Zone FindDeepestZone ()
 
Zone FindZone (int lv)
 
Zone FindZone (string _id)
 
virtual bool CanKill ()
 
int Dist (Point p)
 
int Dist (Spatial s)
 
void MakeGameObject (GameObject parentGo)
 
ICardParent GetRoot ()
 
void RemoveCard (Card c)
 
void OnChildNumChange (Card c)
 
void WriteNote (UINote n, Action< UINote > onWriteNote=null, NoteMode mode=NoteMode.Default, Recipe recipe=null)
 
void OnInspect ()
 

Static Public Member Functions

static string string int zoneLv ParseZoneFullName (string zoneFullName)
 
static bool IsImportValid (string path)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

FactionBranch branch
 
int pendingSimHours
 
HashSet< int > completedQuests = new HashSet<int>()
 
ZoneEventManager events = new ZoneEventManager()
 
ElementContainerZone elements = new ElementContainerZone()
 
ElementContainerField fieldElements = new ElementContainerField()
 
MapBounds bounds
 
Dictionary< int, string > dictCitizen = new Dictionary<int, string>()
 
ZoneInstance instance
 
List< int > landFeats
 
Map map
 
MapSubset subset
 
ZoneBlueprint bp
 
int fileVariation
 
bool dirtyElectricity
 
bool isStarted
 
bool isSimulating
 
int tempDist
 
BiomeProfile _biome
 
- Public Attributes inherited from Spatial
Spatial parent
 
string id
 
string idUser
 
string name
 
string idMainFaction
 
string idProfile
 
string idCurrentSubset
 
string idHat
 
int[] _ints = new int[30]
 
List< Spatial > children = new List<Spatial>()
 
List< Spatial > connections = new List<Spatial>()
 
Dictionary< int, int > mapInt = new Dictionary<int, int>()
 
bool destryoed
 
bool isImported
 
BitArray32 bits
 

Static Public Attributes

static bool forceRegenerate
 
static string forceSubset
 
static CardRow sourceHat
 
static int okaerinko = 0
 
static bool ignoreSpawnAnime
 
static List< Thing > Suckers = new List<Thing>()
 
static string zoneType
 
static string string zoneId
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

string ZoneFullName [get]
 
Chara Boss [get, set]
 
override int ContentLv [get]
 
override int DangerLv [get]
 
virtual bool DisableRooms [get]
 
int HourSinceLastActive [get]
 
int MinsSinceLastActive [get]
 
virtual string pathExport [get]
 
BiomeProfile biome [get]
 
virtual string IdBiome [get]
 
virtual int SightRadiusBonus [get]
 
virtual string IDGenerator [get]
 
virtual string TextWidgetDate [get]
 
MapGenerator Generator [get]
 
virtual string IdProfile [get]
 
virtual string IDPlayList [get]
 
virtual string IDPlaylistOverwrite [get]
 
virtual string IDHat [get]
 
virtual string IDBaseLandFeat [get]
 
virtual string idExport [get]
 
string pathTemp [get]
 
Region Region [get]
 
Zone ParentZone [get]
 
virtual ActionMode DefaultActionMode [get]
 
virtual bool BlockBorderExit [get]
 
virtual int ExpireDays [get]
 
virtual ZoneTransition.EnterState RegionEnterState [get]
 
virtual ZoneFeatureType FeatureType [get]
 
virtual string IDAmbience [get]
 
virtual string IDSceneTemplate [get]
 
virtual bool IsFestival [get]
 
virtual string IDSubset [get]
 
virtual bool IsTown [get]
 
virtual bool CanBeDeliverDestination [get]
 
virtual bool CountDeepestLevel [get]
 
virtual bool HasLaw [get]
 
virtual bool SetAlarmOnBreakLaw [get]
 
virtual bool MakeEnemiesNeutral [get]
 
virtual bool MakeTownProperties [get]
 
virtual bool AllowCriminal [get]
 
virtual bool AllowInvest [get]
 
virtual bool AllowNewZone [get]
 
virtual bool WillAutoSave [get]
 
virtual bool RegenerateOnEnter [get]
 
virtual bool IsSkyLevel [get]
 
virtual bool IsUnderwater [get]
 
virtual bool IsUserZone [get]
 
virtual bool CanDigUnderground [get]
 
virtual bool LockExit [get]
 
virtual bool CanUnlockExit [get]
 
virtual int MaxLv [get]
 
virtual int MinLv [get]
 
virtual bool AddPrefix [get]
 
virtual bool IsNefia [get]
 
virtual bool PetFollow [get]
 
virtual bool RestrictBuild [get]
 
virtual bool KeepAllyDistance [get]
 
virtual int MaxSpawn [get]
 
int MaxRespawn [get]
 
virtual float RuinChance [get]
 
virtual float OreChance [get]
 
virtual float BigDaddyChance [get]
 
virtual float EvolvedChance [get]
 
virtual float ShrineChance [get]
 
virtual float PrespawnRate [get]
 
virtual float RespawnRate [get]
 
bool ShowEnemyOnMinimap [get]
 
virtual int RespawnPerHour [get]
 
virtual float ChanceSpawnNeutral [get]
 
virtual bool GrowPlant [get]
 
virtual bool GrowWeed [get]
 
virtual bool IsExplorable [get]
 
virtual bool IsReturnLocation [get]
 
virtual bool ShouldMakeExit [get]
 
virtual bool ShouldRegenerate [get]
 
virtual bool ShouldAutoRevive [get]
 
virtual bool UseFog [get]
 
virtual bool RevealRoom [get]
 
virtual bool AlwaysLowblock [get]
 
virtual bool UseLight [get]
 
virtual int StartLV [get]
 
virtual ZoneScaleType ScaleType [get]
 
virtual bool HiddenInRegionMap [get]
 
virtual FlockController.SpawnType FlockType [get]
 
override string NameSuffix [get]
 
string NameWithLevel [get]
 
string TextDangerLv [get]
 
string TextDeepestLv [get]
 
bool CanEnterBuildMode [get]
 
bool CanEnterBuildModeAnywhere [get]
 
bool IsPCFaction [get]
 
bool IsPCFactionOrTent [get]
 
bool IsStartZone [get]
 
bool IsInstance [get]
 
bool IsLoaded [get]
 
virtual int BaseElectricity [get]
 
bool IsActiveZone [get]
 
bool CanInspect [get]
 
string InspectName [get]
 
Point InspectPoint [get]
 
Vector3 InspectPosition [get]
 
virtual int MaxSoil [get]
 
- Properties inherited from Spatial
int _bits [get, set]
 
int uid [get, set]
 
int icon [get, set]
 
int x [get, set]
 
int y [get, set]
 
int lastActive [get, set]
 
int idPrefix [get, set]
 
int lv [get, set]
 
int visitCount [get, set]
 
int dateExpire [get, set]
 
int dateRevive [get, set]
 
int _dangerLv [get, set]
 
int dateRegenerate [get, set]
 
int influence [get, set]
 
int investment [get, set]
 
int development [get, set]
 
int electricity [get, set]
 
int dateHat [get, set]
 
int uidBoss [get, set]
 
int dateQuest [get, set]
 
int version [get, set]
 
bool isGenerated [get, set]
 
bool isShore [get, set]
 
bool isRandomSite [get, set]
 
bool isKnown [get, set]
 
bool isMapSaved [get, set]
 
bool isExternalZone [get, set]
 
bool isConquered [get, set]
 
bool isBeach [get, set]
 
bool isPeace [get, set]
 
bool isDeathLocation [get, set]
 
bool isAlarmSet [get, set]
 
Faction mainFaction [get, set]
 
SourceZone.Row source [get]
 
bool IsPlayerFaction [get]
 
bool IsClosed [get]
 
int mapX [get]
 
int mapY [get]
 
virtual int ContentLv [get]
 
virtual int DangerLv [get]
 
virtual int DangerLvFix [get]
 
virtual int DangerLvBoost [get]
 
virtual float VolumeSea [get]
 
virtual bool ShowDangerLv [get]
 
virtual bool CanSpawnAdv [get]
 
string pathSave [get]
 
virtual string Name [get]
 
string NameWithDangerLevel [get]
 
virtual string NameSuffix [get]
 
virtual bool IsRegion [get]
 
virtual bool CanFastTravel [get]
 
EloMap.TileInfo Tile [get]
 
virtual bool IsSnowZone [get]
 
virtual bool IsSnowCovered [get]
 
virtual Point RegionPos [get]
 
virtual bool isClaimable [get]
 
int Seed [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
- Properties inherited from IInspect
bool CanInspect [get]
 
string InspectName [get]
 
Point InspectPoint [get]
 
Vector3 InspectPosition [get]
 

Private Attributes

FortuneRollData fortuneRoll
 

Additional Inherited Members

- Public Types inherited from IInspect
enum  NoteMode { Default , Recipe , Product , Info }
 
- Protected Member Functions inherited from Spatial
Zone _FindZone (string _id)
 
- Protected Attributes inherited from Spatial
Point _regionPos = new Point()
 

Detailed Description

Definition at line 11 of file Zone.cs.

Member Function Documentation

◆ _OnBeforeSave()

override void Zone._OnBeforeSave ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 2032 of file Zone.cs.

2033 {
2034 if (CanDestroy())
2035 {
2036 Debug.Log("Deleting Zone:" + this);
2037 if (!destryoed)
2038 {
2039 Destroy();
2040 }
2041 }
2042 else if (map != null)
2043 {
2044 Debug.Log("Saving Zone:" + this);
2045 map.Save(base.pathSave);
2046 if (!base.isMapSaved)
2047 {
2048 base.isMapSaved = true;
2049 IO.DeleteDirectory(base.pathSave + "Texture Replace");
2050 IO.CopyDir(pathTemp + "Texture Replace", base.pathSave + "/Texture Replace");
2051 }
2052 if (!IsActiveZone)
2053 {
2054 UnloadMap();
2055 }
2056 }
2057 }
Definition: IO.cs:10
static void DeleteDirectory(string path)
Definition: IO.cs:395
static void CopyDir(string sourceDirectory, string targetDirectory, Func< string, bool > funcExclude=null)
Definition: IO.cs:279
void Save(string path, ZoneExportData export=null, PartialMap partial=null)
Definition: Map.cs:384
bool destryoed
Definition: Spatial.cs:45
bool CanDestroy()
Definition: Zone.cs:1961
override void Destroy()
Definition: Zone.cs:2068
bool IsActiveZone
Definition: Zone.cs:502
void UnloadMap()
Definition: Zone.cs:1877
string pathTemp
Definition: Zone.cs:168
Map map
Definition: Zone.cs:66

References Debug, and Map.Save().

◆ AbandonZone()

void Zone.AbandonZone ( )
inline

Definition at line 1945 of file Zone.cs.

1946 {
1947 FactionBranch destBranch = ((EClass.pc.homeBranch == branch) ? EClass.game.StartZone.branch : EClass.pc.homeBranch);
1948 branch.members.ForeachReverse(delegate(Chara m)
1949 {
1950 destBranch.AddMemeber(m);
1951 if (!m.IsPCParty)
1952 {
1953 m.MoveZone(destBranch.owner);
1954 }
1955 });
1957 SetMainFaction(null);
1958 base.dateExpire = EClass.world.date.GetRaw() + 10080;
1959 }
Definition: Chara.cs:10
override bool IsPCParty
Definition: Chara.cs:635
FactionBranch homeBranch
Definition: Chara.cs:1122
void MoveZone(string alias)
Definition: Chara.cs:3622
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static World world
Definition: EClass.cs:41
static FactionBranch Branch
Definition: EClass.cs:23
static Chara pc
Definition: EClass.cs:15
void OnUnclaimZone()
List< Chara > members
void AddMemeber(Chara c)
Zone StartZone
Definition: Game.cs:278
virtual void SetMainFaction(Faction f)
Definition: Spatial.cs:646
GameDate date
Definition: World.cs:6
FactionBranch branch
Definition: Zone.cs:34

References FactionBranch.AddMemeber(), EClass.Branch, branch, World.date, EClass.game, Date.GetRaw(), Chara.homeBranch, Chara.IsPCParty, FactionBranch.members, Chara.MoveZone(), FactionBranch.OnUnclaimZone(), FactionBranch.owner, EClass.pc, Game.StartZone, and EClass.world.

◆ Activate()

void Zone.Activate ( )
inline

Definition at line 639 of file Zone.cs.

640 {
641 if (IsRegion)
642 {
644 }
645 isStarted = (isSimulating = false);
646 base.isKnown = true;
647 EClass.game.config.reverseSnow = false;
649 {
650 Msg.Say("regenerateZone", Name);
651 ClearZones();
652 if (EClass.pc.global.transition != null)
653 {
654 EClass.pc.global.transition.uidLastZone = 0;
655 }
656 }
658 if (EClass.game.activeZone != null)
659 {
661 }
662 EClass.game.activeZone = this;
663 ZoneExportData zoneExportData = null;
664 Debug.Log(NameWithLevel + "/" + id + "/" + base.uid + "/" + base.isGenerated + "/" + IsLoaded + "/" + File.Exists(base.pathSave + "map"));
665 if (base.isGenerated && !IsLoaded && !File.Exists(base.pathSave + "map"))
666 {
667 Debug.Log("(Bug) File does not exist:" + destryoed + "/" + base.pathSave);
668 base.isGenerated = false;
669 }
670 bool flag = false;
671 Debug.Log(idCurrentSubset + "/" + IDSubset);
672 bool flag2 = idCurrentSubset != IDSubset || forceSubset != null;
673 string fullName = pathExport;
674 string lhs = CorePath.ZoneSave + "_new.z";
675 bool flag3 = File.Exists(fullName) && !PathComparer.Default.Equals(lhs, fullName);
676 bool flag4 = !idExport.IsEmpty();
677 Debug.Log(idExport + "/" + flag3 + "/" + fullName);
678 if (!flag3 && (base.source.tag.Contains("addMap") || flag4))
679 {
680 string[] array = new string[4]
681 {
682 "Maps/" + idExport + ".z",
683 "Maps/" + ZoneFullName + ".z",
684 "Map/" + idExport + ".z",
685 "Map/" + ZoneFullName + ".z"
686 };
687 for (int i = 0; i < array.Length; i++)
688 {
689 FileInfo fileInfo = PackageIterator.GetFiles(array[i]).LastOrDefault();
690 if (fileInfo != null)
691 {
692 fullName = fileInfo.FullName;
693 flag3 = true;
694 flag4 = true;
695 break;
696 }
697 }
698 }
699 if (!base.isGenerated && (!flag4 || !flag3))
700 {
701 Debug.Log("generating random map");
702 flag = true;
703 base.dateExpire = EClass.world.date.GetRaw() + 1440 * ExpireDays;
704 Generate();
706 if (instance != null)
707 {
709 }
710 if (!UseFog)
711 {
712 map.ForeachCell(delegate(Cell cell)
713 {
714 cell.isSeen = true;
715 });
716 }
717 if (!(bp is GameBlueprint))
718 {
720 }
721 }
722 else if (IsLoaded && !flag2)
723 {
724 Debug.Log("zone is already loaded");
725 map.SetZone(this);
726 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
728 }
729 else
730 {
731 subset = null;
732 bool flag5 = (base.isGenerated && flag2) || (base.isGenerated && !IsInstance && !IsPCFaction && ShouldRegenerate && EClass.world.date.IsExpired(base.dateRegenerate)) || forceRegenerate;
734 {
735 flag5 = false;
736 flag2 = false;
737 }
738 Debug.Log(base.isGenerated + "/" + flag5 + "/" + flag2 + "/" + IDSubset);
739 if (!base.isGenerated || flag5 || flag2)
740 {
741 Debug.Log("importing map:" + fullName);
742 flag = true;
743 base.dateRegenerate = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRegenerateZone;
744 if (!flag5)
745 {
746 IO.DeleteDirectory(pathTemp + "Texture Replace");
747 Debug.Log(pathTemp);
748 }
749 try
750 {
751 zoneExportData = Import(fullName);
752 base.isGenerated = true;
753 isImported = true;
754 if (flag5)
755 {
756 if (IsLoaded)
757 {
758 zoneExportData.orgMap = IO.DeepCopy(map);
759 }
760 else
761 {
762 zoneExportData.orgMap = GameIO.LoadFile<Map>(base.pathSave + "map");
763 }
764 }
765 }
766 catch (Exception message)
767 {
768 Debug.Log(message);
769 zoneExportData = Import(CorePath.ZoneSave + "fail.z");
770 base.isGenerated = true;
771 isImported = true;
772 }
773 }
774 if (map != null)
775 {
776 UnloadMap();
777 }
779 Debug.Log("loading map: imported? " + isImported + " regenerate? " + flag5);
780 string text = (isImported ? pathTemp : base.pathSave) + "map";
781 try
782 {
783 map = GameIO.LoadFile<Map>(text);
784 }
785 catch (Exception message2)
786 {
787 EClass.ui.Say($"Can't load map '{base.uid}/{Name}'; File may be corrupted.\n" + "Try replacing the following file if you have a backup:\n" + text + "\nDefault file is at:\n" + fullName);
788 Debug.LogError(message2);
789 return;
790 }
791 map.SetZone(this);
792 map.Load(isImported ? pathTemp : base.pathSave, isImported);
794 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
795 if (isImported)
796 {
797 map.deadCharas.Clear();
798 map.deadCharasShort.Clear();
799 map.OnImport(zoneExportData);
800 if (UseFog && !flag5)
801 {
802 map.ForeachCell(delegate(Cell cell)
803 {
804 cell.isSeen = false;
805 });
806 }
807 if (zoneExportData.orgMap != null)
808 {
809 Map orgMap = zoneExportData.orgMap;
810 List<Chara> serializedCharas = map.serializedCharas;
811 map.charas = orgMap.charas;
812 map.serializedCharas = orgMap.serializedCharas;
813 map.deadCharas = orgMap.deadCharas;
814 byte[] array2 = orgMap.TryLoadFile(base.pathSave, "flags", EClass._map.Size * EClass._map.Size);
815 if (array2 != null && array2.Length == EClass._map.Size * EClass._map.Size)
816 {
817 for (int num = 0; num < EClass._map.Size; num++)
818 {
819 for (int num2 = 0; num2 < EClass._map.Size; num2++)
820 {
821 map.cells[num, num2].isSeen = array2[num * EClass._map.Size + num2].GetBit(1);
822 }
823 }
824 }
825 foreach (Chara item in serializedCharas)
826 {
827 Debug.Log("Importing New Chara:" + item.id + "/" + item.Name + "/" + item.orgPos);
829 }
830 bool resetMedal = GetInt(4) != 0;
831 map.things.ForeachReverse(delegate(Thing t)
832 {
833 if (t.trait is TraitNewZone || t.trait is TraitPowerStatue)
834 {
835 foreach (Thing thing in orgMap.things)
836 {
837 if (t.id == thing.id && t.pos.Equals(thing.pos))
838 {
839 if (t.trait is TraitNewZone)
840 {
841 RemoveCard(t);
842 map.things.Insert(0, thing);
843 thing.stackOrder = 0;
844 }
845 else
846 {
847 t.ChangeMaterial(thing.material);
848 t.isOn = thing.isOn;
849 }
850 break;
851 }
852 }
853 return;
854 }
855 if (t.trait is TraitStairsLocked)
856 {
857 foreach (Thing thing2 in orgMap.things)
858 {
859 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
860 {
861 RemoveCard(t);
862 map.things.Add(thing2);
863 break;
864 }
865 }
866 return;
867 }
868 if (!resetMedal && (t.id == "medal" || t.id == "856"))
869 {
870 foreach (Thing thing3 in orgMap.things)
871 {
872 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
873 {
874 return;
875 }
876 }
877 RemoveCard(t);
878 }
879 });
880 SetInt(4);
881 foreach (KeyValuePair<int, int> item2 in EClass._map.backerObjs.ToList())
882 {
883 EClass._map.GetCell(item2.Key);
884 SourceBacker.Row row = EClass.sources.backers.map[item2.Value];
886 {
887 map.backerObjs.Remove(item2.Key);
888 }
889 }
890 foreach (Chara serializedChara in map.serializedCharas)
891 {
892 if (serializedChara.orgPos != null && serializedChara.orgPos.IsValid)
893 {
894 serializedChara.pos.Set(serializedChara.orgPos);
895 }
896 }
897 foreach (Thing thing4 in orgMap.things)
898 {
899 if (thing4.trait is TraitTent && !thing4.isNPCProperty)
900 {
901 thing4.AddEditorTag(EditorTag.NoNpcProperty);
902 thing4.isSubsetCard = false;
903 map.things.Add(thing4);
904 Debug.Log(thing4);
905 }
906 }
907 }
908 }
909 foreach (Thing thing5 in map.things)
910 {
911 map.AddCardOnActivate(thing5);
912 }
913 foreach (Chara c in map.serializedCharas)
914 {
915 if (c.c_uidMaster == 0 || EClass.player.listCarryoverMap.Find((Chara chara2) => chara2.uid == c.uid) == null)
916 {
917 map.charas.Add(c);
919 }
920 }
921 map.serializedCharas.Clear();
922 if (isImported && IsTown)
923 {
925 }
928 map.OnLoad();
929 if (flag5)
930 {
931 foreach (Card item3 in map.Cards.ToList())
932 {
933 if (item3.isSubsetCard)
934 {
935 item3.Destroy();
936 }
937 }
938 }
939 if (isImported)
940 {
942 if (idCurrentSubset != null)
943 {
945 subset.Apply();
946 }
947 }
948 if (isImported)
949 {
951 {
952 foreach (Thing thing6 in map.things)
953 {
954 thing6.isNPCProperty = !thing6.isHidden && !thing6.HasEditorTag(EditorTag.NoNpcProperty);
955 }
956 }
957 else
958 {
959 foreach (Thing thing7 in map.things)
960 {
961 thing7.isNPCProperty = false;
962 }
963 }
965 if (instance != null)
966 {
968 }
969 }
970 if (isImported && !flag5 && !RevealRoom)
971 {
972 foreach (Room item4 in map.rooms.listRoom)
973 {
974 if (!item4.HasRoof || item4.data.atrium)
975 {
976 continue;
977 }
978 foreach (Point point2 in item4.points)
979 {
980 point2.cell.isSeen = false;
981 }
982 }
983 }
984 if (flag5)
985 {
986 OnRegenerate();
987 }
988 }
989 PathManager.Instance._pathfinder.PunishChangeDirection = false;
990 isImported = false;
991 if (this is Zone_Tent && IsUnderwater)
992 {
993 EClass._map.config.idSceneProfile = "indoor_water";
994 EClass.scene.profile = SceneProfile.Load(EClass._map.config.idSceneProfile);
995 }
996 if (flag && IsTown && base.lv == 0)
997 {
999 }
1000 if (base.visitCount == 0)
1001 {
1002 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
1003 }
1004 map.ForeachCell(delegate(Cell cell)
1005 {
1006 if (cell.HasFire)
1007 {
1008 map.effectManager.GetOrCreate(cell.GetSharedPoint());
1009 }
1010 if (IsRegion)
1011 {
1012 cell.decal = 0;
1013 cell._bridge = (cell._bridgeMat = 0);
1014 }
1015 });
1017 {
1018 RainWater();
1019 }
1021 {
1022 map.ForeachCell(delegate(Cell cell)
1023 {
1024 cell.isSeen = true;
1025 });
1026 }
1027 isStarted = true;
1028 Map.isDirtySunMap = true;
1030 if (events.listPreEnter.Count > 0)
1031 {
1032 foreach (ZonePreEnterEvent item5 in events.listPreEnter)
1033 {
1034 item5.Execute();
1035 }
1036 events.listPreEnter.Clear();
1037 }
1038 foreach (Card card in map.Cards)
1039 {
1040 card.CalculateFOV();
1041 if (card.isChara)
1042 {
1043 Chara chara = card.Chara;
1044 chara.dirtySpeed = true;
1045 chara.wasInWater = IsUnderwater || (card.Cell.IsTopWater && !card.Cell.isFloating);
1046 if (!card.isDyed && card.HasTag(CTAG.random_color))
1047 {
1048 card.DyeRandom();
1049 }
1050 if (card.IsUnique && !card.IsPCFaction && !card.IsPCParty)
1051 {
1052 Point point = chara.orgPos ?? card.pos;
1053 card.c_uniqueData = new UniqueData
1054 {
1055 x = point.x,
1056 y = point.z,
1057 uidZone = base.uid
1058 };
1059 }
1060 int num3 = card.GetInt(55);
1061 if (num3 != 0)
1062 {
1063 foreach (Chara chara2 in map.charas)
1064 {
1065 if (chara2.uid == num3)
1066 {
1067 if (chara.IsHostile(chara2))
1068 {
1069 chara.enemy = chara2;
1070 chara.SetAI(new GoalCombat());
1071 chara.calmCheckTurn = 20 + EClass.rnd(30);
1072 }
1073 break;
1074 }
1075 }
1076 card.SetInt(55);
1077 }
1078 chara.SyncRide();
1079 if (card.c_uidMaster != 0 && chara.master == null)
1080 {
1081 chara.FindMaster();
1082 }
1083 if (!EClass.game.isLoading)
1084 {
1085 chara.enemy = null;
1086 if (chara.IsInCombat)
1087 {
1088 chara.SetNoGoal();
1089 }
1090 }
1091 }
1092 else if (card.IsInstalled && card.trait is TraitDoor traitDoor && card.pos.HasChara && !traitDoor.IsOpen())
1093 {
1094 traitDoor.ToggleDoor(sound: false, refresh: false);
1095 }
1096 }
1097 RefreshHat();
1098 forceRegenerate = false;
1099 forceSubset = null;
1100 EClass.ui.OnActivateZone();
1102 EClass.Sound.LoadAmbience(IDAmbience);
1103 if (EClass.Branch != null)
1104 {
1106 }
1107 OnVisit();
1108 if (flag)
1109 {
1111 }
1113 if (IsPCFaction)
1114 {
1115 EClass.player.uidLastTown = 0;
1116 }
1117 else if (IsTown && base.lv == 0)
1118 {
1119 EClass.player.uidLastTown = base.uid;
1120 }
1121 RefreshBGM();
1122 Rand.InitBytes(map.seed + 1);
1124 okaerinko = 0;
1125 if (EClass.debug.enable)
1126 {
1127 ModInfluence(2000);
1128 }
1129 if (this is Zone_TinkerCamp)
1130 {
1131 Tutorial.Reserve("tinker");
1132 }
1133 else if (this is Zone_Town && !(this is Zone_SubTown))
1134 {
1135 Tutorial.Reserve("town");
1136 }
1137 }
CTAG
Definition: CTAG.cs:2
if(!match.Success)
EditorTag
Definition: EditorTag.cs:2
void Add(Act a, string s="")
Definition: ActPlan.cs:11
bool atrium
Definition: AreaData.cs:66
AreaData data
Definition: BaseArea.cs:29
PointList points
Definition: BaseArea.cs:26
Definition: Card.cs:11
string id
Definition: Card.cs:36
bool isNPCProperty
Definition: Card.cs:557
bool isSubsetCard
Definition: Card.cs:749
int c_uidMaster
Definition: Card.cs:1501
void AddEditorTag(EditorTag tag)
Definition: Card.cs:2750
Point pos
Definition: Card.cs:60
int uid
Definition: Card.cs:125
Trait trait
Definition: Card.cs:54
void Destroy()
Definition: Card.cs:5326
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2745
Definition: Cell.cs:7
bool isSeen
Definition: Cell.cs:294
bool HasFire
Definition: Cell.cs:712
AIAct SetNoGoal()
Definition: Chara.cs:9569
bool IsInCombat
Definition: Chara.cs:920
AIAct SetAI(AIAct g)
Definition: Chara.cs:9574
Point orgPos
Definition: Chara.cs:23
GlobalData global
Definition: Chara.cs:78
Chara master
Definition: Chara.cs:90
Chara FindMaster()
Definition: Chara.cs:2692
void SyncRide()
Definition: Chara.cs:4267
bool IsHostile()
Definition: Chara.cs:7001
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:578
bool revealMap
Definition: CoreDebug.cs:170
bool enable
Definition: CoreDebug.cs:302
static string ZoneSave
Definition: CorePath.cs:192
TextureManager textures
Definition: Core.cs:45
CoreConfig config
Definition: Core.cs:70
bool IsExpired(int time)
Definition: Date.cs:338
static Scene scene
Definition: EClass.cs:31
static Core core
Definition: EClass.cs:7
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
static SourceManager sources
Definition: EClass.cs:43
static Player player
Definition: EClass.cs:13
static CoreDebug debug
Definition: EClass.cs:49
static SoundManager Sound
Definition: EClass.cs:47
static UI ui
Definition: EClass.cs:17
static GameSetting setting
Definition: EClass.cs:35
void Initialize(EloMap _elomap)
Definition: EloMapActor.cs:28
void OnActivateZone()
Definition: GameIO.cs:11
BalanceSetting balance
Definition: GameSetting.cs:356
bool isLoading
Definition: Game.cs:242
int countLoadedMaps
Definition: Game.cs:236
Zone activeZone
Definition: Game.cs:252
ZoneTransition transition
Definition: GlobalData.cs:6
Definition: Guild.cs:2
void RefreshDevelopment()
Definition: Guild.cs:95
static Guild GetCurrentGuild()
Definition: Guild.cs:74
int Size
Definition: MapBounds.cs:20
string idSceneProfile
Definition: MapConfig.cs:8
void Apply()
Definition: MapSubset.cs:60
static MapSubset Load(string id)
Definition: MapSubset.cs:33
Definition: Map.cs:13
new void ForeachCell(Action< Cell > action)
Definition: Map.cs:2536
Cell GetCell(int index)
Definition: Map.cs:1003
IEnumerable< Card > Cards
Definition: Map.cs:143
void AddCardOnActivate(Card c)
Definition: Map.cs:898
void SetZone(Zone _zone)
Definition: Map.cs:189
List< Thing > things
Definition: Map.cs:55
byte[] TryLoadFile(string path, string s, int size)
Definition: Map.cs:567
Dictionary< int, int > backerObjs
Definition: Map.cs:73
List< Chara > deadCharas
Definition: Map.cs:49
List< Chara > deadCharasShort
Definition: Map.cs:52
int seed
Definition: Map.cs:19
RoomManager rooms
Definition: Map.cs:34
void SetReference()
Definition: Map.cs:203
void OnLoad()
Definition: Map.cs:823
void OnImport(ZoneExportData data)
Definition: Map.cs:829
List< Chara > serializedCharas
Definition: Map.cs:46
Cell[,] cells
Definition: Map.cs:91
MapConfig config
Definition: Map.cs:40
void Load(string path, bool import=false, PartialMap partial=null)
Definition: Map.cs:644
List< Chara > charas
Definition: Map.cs:87
void RefreshAllTiles()
Definition: Map.cs:2272
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
List< Chara > listCarryoverMap
Definition: Player.cs:1305
HashSet< int > doneBackers
Definition: Player.cs:1152
bool simulatingZone
Definition: Player.cs:1261
Definition: Point.cs:9
Point Set(int _x, int _z)
Definition: Point.cs:499
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool IsValid
Definition: Point.cs:84
Definition: Rand.cs:4
static void InitBytes(int a)
Definition: Rand.cs:13
Definition: Region.cs:8
EloMap elomap
Definition: Region.cs:9
List< Room > listRoom
Definition: RoomManager.cs:13
Definition: Room.cs:4
bool HasRoof
Definition: Room.cs:29
static SceneProfile Load(string id)
Definition: SceneProfile.cs:18
void RebuildActorEx()
Definition: Scene.cs:992
EloMapActor elomapActor
Definition: Scene.cs:101
SourceBacker backers
void SetInt(int id, int value=0)
Definition: Spatial.cs:580
string idCurrentSubset
Definition: Spatial.cs:28
virtual bool IsRegion
Definition: Spatial.cs:515
virtual string Name
Definition: Spatial.cs:509
int GetInt(int id, int? defaultInt=null)
Definition: Spatial.cs:566
bool isImported
Definition: Spatial.cs:47
int y
Definition: Spatial.cs:106
int x
Definition: Spatial.cs:94
void ApplyLocalReplace(string path)
Definition: Thing.cs:8
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
bool IsRaining
Definition: Weather.cs:117
Weather weather
Definition: World.cs:12
List< ZonePreEnterEvent > listPreEnter
virtual void OnGenerateMap()
Definition: ZoneInstance.cs:32
virtual void Execute()
string ZoneFullName
Definition: Zone.cs:88
bool isSimulating
Definition: Zone.cs:78
void RefreshElectricity()
Definition: Zone.cs:3195
ZoneExportData Import(string path)
Definition: Zone.cs:3471
void Generate()
Definition: Zone.cs:2560
ZoneEventManager events
Definition: Zone.cs:43
static string forceSubset
Definition: Zone.cs:27
virtual bool RegenerateOnEnter
Definition: Zone.cs:272
static int okaerinko
Definition: Zone.cs:31
virtual string idExport
Definition: Zone.cs:157
virtual bool MakeTownProperties
Definition: Zone.cs:252
virtual void OnRegenerate()
Definition: Zone.cs:1256
bool isStarted
Definition: Zone.cs:76
virtual string pathExport
Definition: Zone.cs:132
MapSubset subset
Definition: Zone.cs:68
Zone GetTopZone()
Definition: Zone.cs:2118
virtual string IDSubset
Definition: Zone.cs:219
ZoneBlueprint bp
Definition: Zone.cs:70
void RefreshBGM()
Definition: Zone.cs:3324
void Deactivate()
Definition: Zone.cs:1795
void SpawnLostItems()
Definition: Zone.cs:4063
void AddGlobalCharasOnActivate()
Definition: Zone.cs:1714
bool IsInstance
Definition: Zone.cs:496
void ClearZones(Zone current=null)
Definition: Zone.cs:2087
void OnVisit()
Definition: Zone.cs:1149
virtual bool IsTown
Definition: Zone.cs:230
void RainWater()
Definition: Zone.cs:3709
virtual bool UseFog
Definition: Zone.cs:398
virtual string IDAmbience
Definition: Zone.cs:185
void RemoveCard(Card t)
Definition: Zone.cs:2202
void RefreshHat()
Definition: Zone.cs:1139
void ModInfluence(int a)
Definition: Zone.cs:3921
virtual void OnGenerateMap()
Definition: Zone.cs:2778
static bool forceRegenerate
Definition: Zone.cs:25
bool IsPCFaction
Definition: Zone.cs:480
virtual bool IsUnderwater
Definition: Zone.cs:276
virtual bool ShouldRegenerate
Definition: Zone.cs:384
string NameWithLevel
Definition: Zone.cs:436
ZoneInstance instance
Definition: Zone.cs:58
virtual bool RevealRoom
Definition: Zone.cs:400
bool IsLoaded
Definition: Zone.cs:498
void RefreshListCitizen()
Definition: Zone.cs:3879
virtual int ExpireDays
Definition: Zone.cs:178
virtual void OnVisitNewMapOrRegenerate()
Definition: Zone.cs:1296

References $, EClass._map, Game.activeZone, ActPlan.List.Add(), Card.AddEditorTag(), AddGlobalCharasOnActivate(), TextureManager.ApplyLocalReplace(), Map.backerObjs, SourceManager.backers, GameSetting.balance, bp, Map.cells, Map.charas, ClearZones(), Core.config, EClass.core, Game.countLoadedMaps, World.date, GameSetting.BalanceSetting.dateRegenerateZone, Deactivate(), Map.deadCharas, Map.deadCharasShort, Debug, Spatial.destryoed, Player.doneBackers, Region.elomap, Scene.elomapActor, ExpireDays, forceRegenerate, forceSubset, Map.ForeachCell(), EClass.game, Generate(), Map.GetCell(), Spatial.GetInt(), Date.GetRaw(), GetTopZone(), Chara.global, SourceBacker.Row.id, Spatial.idCurrentSubset, idExport, IDSubset, CoreConfig.Test.ignoreBackerDestoryFlag, Import(), EloMapActor.Initialize(), instance, Date.IsExpired(), Spatial.isImported, IsInstance, IsLoaded, Game.isLoading, Card.isNPCProperty, IsPCFaction, Spatial.IsRegion, Cell.isSeen, isSimulating, isStarted, Point.IsValid, item, Map.Load(), map, Spatial.Name, NameWithLevel, OnGenerateMap(), ZoneInstance.OnGenerateMap(), Map.OnImport(), ZoneExportData.orgMap, Chara.orgPos, pathExport, pathTemp, EClass.pc, EClass.player, Card.pos, RegenerateOnEnter, RemoveCard(), Msg.Say(), EClass.scene, Map.serializedCharas, Point.Set(), Spatial.SetInt(), Map.SetReference(), EClass.setting, Map.SetZone(), ShouldRegenerate, Player.simulatingZone, MapBounds.Size, EClass.sources, subset, CoreConfig.test, Core.textures, Card.things, Map.things, Card.trait, GlobalData.transition, Map.TryLoadFile(), EClass.ui, UnloadMap(), UseFog, EClass.world, ZoneFullName, and CorePath.ZoneSave.

Referenced by Scene.Init(), and HotItemContext.Show().

◆ AddCard() [1/3]

Card Zone.AddCard ( Card  t)
inline

Definition at line 2167 of file Zone.cs.

2168 {
2169 return AddCard(t, 0, 0);
2170 }
Card AddCard(Card t, Point point)
Definition: Zone.cs:2162

◆ AddCard() [2/3]

Card Zone.AddCard ( Card  t,
int  x,
int  z 
)
inline

Definition at line 2172 of file Zone.cs.

2173 {
2174 if (t.parent != null)
2175 {
2176 t.parent.RemoveCard(t);
2177 }
2178 t.parent = this;
2179 Chara chara = t.Chara;
2180 if (chara != null)
2181 {
2182 chara.currentZone = this;
2183 chara.SetAI(new NoGoal());
2184 }
2185 if (IsActiveZone)
2186 {
2187 map.OnCardAddedToZone(t, x, z);
2188 if (isStarted && t.isThing && t.placeState == PlaceState.roaming && !ignoreSpawnAnime)
2189 {
2190 t.PlayAnimeLoot();
2191 }
2192 ignoreSpawnAnime = false;
2193 }
2194 if (chara != null && EClass.player != null && !chara.hasSpawned)
2195 {
2196 EClass.player.codex.AddSpawn(chara.id);
2197 chara.hasSpawned = true;
2198 }
2199 return t;
2200 }
PlaceState
Definition: PlaceState.cs:2
virtual bool isThing
Definition: Card.cs:2145
virtual Chara Chara
Definition: Card.cs:2134
ICardParent parent
Definition: Card.cs:56
bool hasSpawned
Definition: Card.cs:905
PlaceState placeState
Definition: Card.cs:86
void PlayAnimeLoot()
Definition: Card.cs:6692
void AddSpawn(string id)
Definition: CodexManager.cs:65
void OnCardAddedToZone(Card t, int x, int z)
Definition: Map.cs:921
Definition: NoGoal.cs:4
CodexManager codex
Definition: Player.cs:1194
static bool ignoreSpawnAnime
Definition: Zone.cs:84
void RemoveCard(Card c)

References CodexManager.AddSpawn(), Card.Chara, Player.codex, Card.hasSpawned, Card.id, Card.isThing, Map.OnCardAddedToZone(), Card.parent, Card.placeState, Card.PlayAnimeLoot(), EClass.player, ICardParent.RemoveCard(), and Chara.SetAI().

◆ AddCard() [3/3]

Card Zone.AddCard ( Card  t,
Point  point 
)
inline

Definition at line 2162 of file Zone.cs.

2163 {
2164 return AddCard(t, point.x, point.z);
2165 }

References Point.x, and Point.z.

Referenced by InvOwnerChaosOffering._OnProcess(), TraitShrine._OnUse(), Game.AddAdventurers(), ZoneUtil.AddMerchant(), Quest.AddResident(), Chara.ApplyDeathPenalty(), RecipeCard.Build(), Map.Burn(), AI_Shopping.Buy(), ClaimZone(), TraitCrafter.Craft(), Card.Die(), Chara.Die(), Chara.DropHeld(), Player.DropReward(), Chara.DropThing(), ZonePreEnterBout.Execute(), ZonePreEnterDigStairs.Execute(), ZonePreEnterEncounter.Execute(), DramaOutcome.fiama_pet(), CoreDebug.Fix_LostCore(), Generate(), Zone_SnowGrave.GenerateGrave(), FortuneRollData.GetPrize(), GrowSystem.Grow(), TraitFoodEggFertilized.Incubate(), Chara.MakeGrave(), SurvivalManager.MeteorThing(), Map.MineBlock(), Chara.MoveHome(), Chara.MoveZone(), Zone_Void.OnActivate(), Region.OnAdvanceHour(), Zone_WindRest.OnAfterSimulate(), Zone_Nymelle.OnBeforeSimulate(), TaskHarvest.OnCreateProgress(), TaskBuild.OnDestroy(), SurvivalManager.OnExpandFloor(), Zone_DungeonFairy.OnGenerateMap(), Zone_DungeonMino.OnGenerateMap(), Zone_DungeonPuppy.OnGenerateMap(), Zone_TestRoom.OnGenerateMap(), MapGenDungen.OnGenerateTerrain(), GrowSystemTree.OnHitFail(), ZoneEventSiege.OnKill(), SurvivalManager.OnMineWreck(), AI_Fish.ProgressFish.OnProgressComplete(), QuestCraft.OnProgressComplete(), TaskMoveInstalled.OnProgressComplete(), TraitDiary.OnRead(), Zone_Town.OnRegenerate(), QuestEscort.OnStart(), TraitFarmChest.OnUse(), TraitGiftNewYear.OnUse(), TraitStairsLocked.OnUse(), ZoneEventDefenseGame.OnVisit(), DramaManager.ParseLine(), ActRestrain.Perform(), HotItemActionSleep.Perform(), GrowSystem.Perish(), Chara.Pick(), Chara.PickOrDrop(), Zone_Dungeon.PlaceRail(), GenRoom.Populate(), ActEffect.Proc(), ActEffect.ProcAt(), FactionBranch.PutInMailBox(), DramaOutcome.PutOutFire(), TaskCraft.PutOutResources(), DramaOutcome.QuestExploration_AfterCrystal(), CoreDebug.QuickStart(), TraitBaseSpellbook.ReadFailEffect(), FactionBranch.Recruit(), ReligionManager.Reforge(), Map.ReloadRoom(), SerializedCards.Restore(), Revive(), Chara.Revive(), AI_Craft_Snowman.Run(), AI_Idle.Run(), AI_Slaughter.Run(), AI_UseCrafter.Run(), Meeting.SetChara(), Chara.SetGlobal(), ZoneEventMusic.Spawn(), CoreDebug.Spawn(), SpawnAltar(), ReligionExtension.SpawnAltar(), Card.SpawnLoot(), SpawnLostItems(), SurvivalManager.StartRaid(), ActThrow.Throw(), TryAddThing(), BiomeProfile.ClusterThing.TryCreate(), Chara.TryDropBossLoot(), Chara.TryDuplicate(), TryGenerateBigDaddy(), TryGenerateShrine(), Religion.TryGetGift(), Chara.TryHoldCard(), Chara.TryPutShared(), AI_Shopping.TryRestock(), Map.TryShatter(), Map.TrySmoothPick(), TrySpawnFollower(), DramaOutcome.Tutorial1(), TraitFoodEgg.Update(), TraitSpotBiome.Update(), CoreDebug.UpdateInput(), Chara.Vomit(), and ActEffect.Wish().

◆ AddCardSplinkle()

Card Zone.AddCardSplinkle ( Card  t,
Point  center,
int  radius = 4 
)
inline

Definition at line 2127 of file Zone.cs.

2128 {
2129 Point point = new Point(center);
2130 for (int i = 0; i < 1000; i++)
2131 {
2132 point.x = center.x + EClass.rnd(radius) - EClass.rnd(radius);
2133 point.z = center.z + EClass.rnd(radius) - EClass.rnd(radius);
2134 if (point.IsValid && !point.IsBlocked && !point.HasChara)
2135 {
2136 return AddCard(t, point);
2137 }
2138 }
2139 return AddCard(t, center);
2140 }
bool IsBlocked
Definition: Point.cs:359
bool HasChara
Definition: Point.cs:234

References Point.HasChara, Point.IsBlocked, Point.IsValid, and EClass.rnd().

Referenced by ZoneUtil.AddBandits().

◆ AddChara() [1/2]

Chara Zone.AddChara ( string  id,
int  x,
int  z 
)
inline

◆ AddChara() [2/2]

Chara Zone.AddChara ( string  id,
Point  p 
)
inline

Definition at line 2147 of file Zone.cs.

2148 {
2149 return AddChara(id, p.x, p.z);
2150 }
Chara AddChara(string id, int x, int z)
Definition: Zone.cs:2142

References Point.x, and Point.z.

◆ AddGlobalCharasOnActivate()

void Zone.AddGlobalCharasOnActivate ( )
inline

Definition at line 1714 of file Zone.cs.

1715 {
1716 Point spawnPosPC = null;
1717 if (EClass.pc.currentZone == this)
1718 {
1719 spawnPosPC = GetSpawnPos(EClass.pc);
1720 }
1721 if (spawnPosPC == null)
1722 {
1723 spawnPosPC = map.GetCenterPos();
1724 }
1725 if (spawnPosPC.IsValid && EClass.pc.global.transition != null && spawnPosPC.HasBlock)
1726 {
1727 spawnPosPC = spawnPosPC.GetNearestPoint();
1728 }
1729 spawnPosPC = spawnPosPC.Clamp(useBounds: true).GetNearestPoint();
1730 foreach (Chara c in EClass.game.cards.globalCharas.Values)
1731 {
1732 if (c.currentZone != this)
1733 {
1734 continue;
1735 }
1736 if (c.parent is Chara)
1737 {
1738 Chara chara = c.parent as Chara;
1739 c.currentZone = chara.currentZone;
1740 }
1741 else
1742 {
1743 if (c.isDead)
1744 {
1745 continue;
1746 }
1747 if (c.isRestrained && c.currentZone == EClass.pc.currentZone && (!c.pos.IsValid || c.pos.FindThing<TraitShackle>() == null))
1748 {
1749 c.isRestrained = false;
1750 }
1751 if (c.global.transition != null)
1752 {
1753 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true) : GetSpawnPos(c)));
1754 if (c.IsPCParty && !c.IsPC)
1755 {
1756 if (c.host == EClass.pc)
1757 {
1758 pos.Set(spawnPosPC);
1759 }
1760 else if (pos.Equals(spawnPosPC) || !PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
1761 {
1762 c.pos.Set(spawnPosPC);
1763 if (!spawnPosPC.ForeachNearestPoint(delegate(Point p)
1764 {
1765 if (PathManager.Instance.IsPathClear(spawnPosPC, p, c, 10) && !p.Equals(spawnPosPC))
1766 {
1767 pos.Set(p);
1768 return true;
1769 }
1770 return false;
1771 }, allowBlock: false, EClass.pc.party.members.Count >= 12, allowInstalled: true, ignoreCenter: true, EClass._zone.IsRegion ? 2 : 6))
1772 {
1773 pos.Set(spawnPosPC);
1774 }
1775 }
1776 }
1777 c.pos.Set(pos);
1778 c.global.transition = null;
1779 }
1780 map.charas.Add(c);
1782 }
1783 }
1785 {
1786 Point nearestPoint = spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true);
1787 item.enemy = null;
1788 item.pos.Set(nearestPoint);
1789 map.charas.Add(item);
1791 }
1793 }
GlobalCharaList globalCharas
Definition: CardManager.cs:46
bool isRestrained
Definition: Card.cs:569
override bool IsPC
Definition: Chara.cs:632
Chara host
Definition: Chara.cs:35
Zone currentZone
Definition: Chara.cs:261
bool isDead
Definition: Chara.cs:395
CardManager cards
Definition: Game.cs:156
Point GetCenterPos()
Definition: MapBounds.cs:52
static PathManager Instance
Definition: PathManager.cs:16
bool IsPathClear(Point origin, Point dest, IPathfindWalker walker, int radius)
Definition: PathManager.cs:47
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:620
bool Equals(int _x, int _z)
Definition: Point.cs:962
bool ForeachNearestPoint(Func< Point, bool > endFunc, bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int maxRange=30)
Definition: Point.cs:692
Point Clamp(bool useBounds=false)
Definition: Point.cs:1010
bool HasBlock
Definition: Point.cs:137
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1142
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
Definition: Zone.cs:1503

References Map.AddCardOnActivate(), Game.cards, Map.charas, Point.Clamp(), Chara.currentZone, Point.Equals(), Point.FindThing(), EClass.game, MapBounds.GetCenterPos(), Point.GetNearestPoint(), Chara.global, CardManager.globalCharas, Point.HasBlock, Chara.host, PathManager.Instance, Chara.isDead, PathManager.IsPathClear(), Chara.IsPC, Chara.IsPCParty, Card.isRestrained, Point.IsValid, item, Player.listCarryoverMap, Card.parent, EClass.pc, EClass.player, Card.pos, Point.Set(), and GlobalData.transition.

Referenced by Activate().

◆ AddRandomVisitor()

Chara Zone.AddRandomVisitor ( bool  guest = false)
inline

Definition at line 3605 of file Zone.cs.

3606 {
3607 Trait random = map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
3608 if (random == null)
3609 {
3610 return null;
3611 }
3612 Point point = random.GetPoint();
3613 Chara chara = null;
3614 if (guest)
3615 {
3616 Zone z = EClass.world.FindZone("wilds");
3617 chara = EClass.game.cards.ListGlobalChara(z).RandomItem();
3618 if (chara != null)
3619 {
3620 AddCard(chara, point);
3621 Msg.Say("guestArrive", chara);
3622 chara.visitorState = VisitorState.Arrived;
3623 }
3624 }
3625 else
3626 {
3627 chara = CharaGen.CreateFromFilter("c_wilds");
3628 AddCard(chara, point);
3629 chara.goalListType = GoalListType.Enemy;
3630 }
3631 return chara;
3632 }
GoalListType
Definition: GoalListType.cs:2
VisitorState
Definition: VisitorState.cs:2
List< Chara > ListGlobalChara(Zone z)
Definition: CardManager.cs:103
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
Definition: CharaGen.cs:22
PropsInstalled Installed
Definition: Map.cs:131
TraitManager traits
Definition: Props.cs:18
Zone FindZone(int lv)
Definition: Spatial.cs:728
TraitSet GetTraitSet(Type t)
Definition: TraitManager.cs:94
Definition: Trait.cs:7
Point GetPoint()
Definition: Trait.cs:847
Definition: Zone.cs:12

References Game.cards, CharaGen.CreateFromFilter(), Spatial.FindZone(), EClass.game, Trait.GetPoint(), TraitManager.GetTraitSet(), guest, Map.Installed, CardManager.ListGlobalChara(), Msg.Say(), Props.traits, and EClass.world.

◆ AddThing() [1/2]

Card Zone.AddThing ( string  id,
int  x,
int  z 
)
inline

◆ AddThing() [2/2]

Card Zone.AddThing ( string  id,
Point  p 
)
inline

Definition at line 2157 of file Zone.cs.

2158 {
2159 return AddThing(id, p.x, p.z);
2160 }
Card AddThing(string id, int x, int z)
Definition: Zone.cs:2152

References Point.x, and Point.z.

◆ ApplyBackerPet()

void Zone.ApplyBackerPet ( bool  draw)
inline

Definition at line 4108 of file Zone.cs.

4109 {
4110 bool flag = this is Zone_Yowyn && base.lv == -1;
4111 IList<SourceBacker.Row> list = EClass.sources.backers.listPet.Copy();
4112 list.Shuffle();
4114 {
4115 list.ForeachReverse(delegate(SourceBacker.Row a)
4116 {
4117 if (EClass.player.doneBackers.Contains(a.id))
4118 {
4119 list.Remove(a);
4120 }
4121 });
4122 }
4123 foreach (Chara chara in EClass._map.charas)
4124 {
4125 if (chara.IsGlobal || chara.IsMinion)
4126 {
4127 continue;
4128 }
4129 if (chara.isBackerContent)
4130 {
4131 if (chara.sourceBacker.isStatic != 0)
4132 {
4133 continue;
4134 }
4135 if (chara.id != "follower")
4136 {
4137 chara.RemoveBacker();
4138 }
4139 }
4140 if ((flag && chara.race.id != "cat") || (!EClass.debug.enable && EClass.rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0))
4141 {
4142 continue;
4143 }
4144 foreach (SourceBacker.Row item in list)
4145 {
4146 if (item.chara == chara.id)
4147 {
4148 chara.ApplyBacker(item.id);
4149 list.Remove(item);
4150 break;
4151 }
4152 }
4153 }
4154 }
SourceBacker.Row sourceBacker
Definition: Card.cs:967
void RemoveBacker()
Definition: Card.cs:7554
void ApplyBacker(int bid)
Definition: Card.cs:7518
bool isBackerContent
Definition: Card.cs:964
override bool IsGlobal
Definition: Chara.cs:630
override bool IsMinion
Definition: Chara.cs:647
SourceRace.Row race
Definition: Chara.cs:470
List< Row > listPet

References SourceManager.backers, Core.config, EClass.core, CoreConfig.Test.ignoreBackerDestoryFlag, SourceBacker.listPet, EClass.sources, and CoreConfig.test.

Referenced by Zone_Field.OnGenerateMap(), and Zone_Yowyn.OnVisitNewMapOrRegenerate().

◆ CanDestroy()

bool Zone.CanDestroy ( )
inline

Definition at line 1961 of file Zone.cs.

1962 {
1964 {
1965 return false;
1966 }
1967 if (IsInstance)
1968 {
1969 return true;
1970 }
1971 bool flag = false;
1972 switch (id)
1973 {
1974 case "cave_dragon":
1975 if (!(this is Zone_DungeonDragon))
1976 {
1977 flag = true;
1978 }
1979 break;
1980 case "cave_yeek":
1981 if (!(this is Zone_DungeonYeek))
1982 {
1983 flag = true;
1984 }
1985 break;
1986 case "cave_mino":
1987 if (!(this is Zone_DungeonMino))
1988 {
1989 flag = true;
1990 }
1991 break;
1992 case "cave_dead":
1993 if (!(this is Zone_DungeonDead))
1994 {
1995 flag = true;
1996 }
1997 break;
1998 case "oldkeep":
1999 if (!(this is Zone_OldKeep))
2000 {
2001 flag = true;
2002 }
2003 break;
2004 }
2005 Zone topZone = GetTopZone();
2006 if (!flag)
2007 {
2008 if (base.dateExpire == 0 || !EClass.world.date.IsExpired(base.dateExpire))
2009 {
2010 return false;
2011 }
2012 if (!base.isRandomSite && !(this is Zone_Field) && (topZone == null || topZone == this || topZone.FindDeepestZone() == this))
2013 {
2014 return false;
2015 }
2016 }
2017 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()))
2018 {
2019 return false;
2020 }
2022 {
2024 if (zone != null && zone.GetTopZone() == this)
2025 {
2026 return false;
2027 }
2028 }
2029 return true;
2030 }
SpatialManager spatials
Definition: Game.cs:153
Zone nextZone
Definition: Player.cs:1309
Zone Find(string id)
Zone FindDeepestZone()
Definition: Spatial.cs:715

References Chara.currentZone, World.date, SpatialManager.Find(), Spatial.FindDeepestZone(), EClass.game, GetTopZone(), instance, Date.IsExpired(), IsInstance, Player.nextZone, EClass.pc, EClass.player, Player.simulatingZone, Game.spatials, ZoneInstance.uidZone, and EClass.world.

Referenced by Region.OnActivate().

◆ ClaimZone()

void Zone.ClaimZone ( bool  debug = false,
Point  pos = null 
)
inline

Definition at line 1891 of file Zone.cs.

1892 {
1895 branch = new FactionBranch();
1896 branch.OnCreate(this);
1897 if (base.icon == 0)
1898 {
1899 base.icon = 332;
1900 }
1901 instance = null;
1902 base.dateExpire = 0;
1904 Register();
1905 foreach (Thing thing in map.things)
1906 {
1907 thing.isNPCProperty = false;
1908 }
1911 if (debug)
1912 {
1913 for (int i = 0; i < 7; i++)
1914 {
1915 Chara chara = CharaGen.CreateFromFilter("c_neutral");
1916 EClass._zone.AddCard(chara, EClass._map.bounds.GetRandomPoint().GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false));
1917 branch.AddMemeber(chara);
1918 }
1919 }
1920 else
1921 {
1922 Msg.Say("claimedZone");
1923 EClass.Branch.Log("claimedZone");
1924 EClass.Sound.Play("jingle_embark");
1925 EClass.pc.PlaySound("build");
1926 if (pos == null)
1927 {
1928 pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: true, allowInstalled: false);
1929 }
1930 Effect.Get("aura_heaven").Play(pos);
1931 EClass._zone.AddCard(ThingGen.Create("core_zone"), pos).SetPlaceState(PlaceState.installed);
1932 }
1933 base.idPrefix = 0;
1935 {
1936 EClass.player.spawnZone = EClass._zone;
1937 }
1939 {
1940 EClass._zone.SetBGM(new List<int> { 41, 90, 44, 43 });
1942 }
1943 }
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3940
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6663
Faction faction
Definition: Chara.cs:433
static Zone _zone
Definition: EClass.cs:21
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:80
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
void SetZone(int gx, int gy, Zone z, bool updateMesh=false)
Definition: EloMap.cs:234
void OnCreate(Zone zone)
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
Point GetRandomPoint()
Definition: MapBounds.cs:97
void RevealAll(bool reveal=true)
Definition: Map.cs:1021
MapBounds bounds
Definition: Map.cs:58
EloMap elomap
Definition: Scene.cs:149
void Register()
Definition: Spatial.cs:630
void RefreshPlaylist()
Definition: Zone.cs:3307
void SetBGM(List< int > ids, bool refresh=true, float fadeDuration=0f)
Definition: Zone.cs:3265

References EClass._map, EClass._zone, AddCard(), FactionBranch.AddMemeber(), Map.bounds, EClass.Branch, ThingGen.Create(), CharaGen.CreateFromFilter(), World.date, Scene.elomap, Chara.faction, EClass.game, Effect.Get(), Point.GetNearestPoint(), MapBounds.GetRandomPoint(), Date.GetRaw(), FactionBranch.Log(), FactionBranch.OnClaimZone(), FactionBranch.OnCreate(), EClass.pc, Effect.Play(), Card.PlaySound(), Card.pos, RefreshPlaylist(), Map.RevealAll(), Msg.Say(), EClass.scene, SetBGM(), Card.SetPlaceState(), EloMap.SetZone(), EClass.Sound, Game.StartZone, Map.things, EClass.world, Spatial.x, and Spatial.y.

Referenced by SurvivalManager.OnExpandFloor(), TraitDeed.OnRead(), DramaOutcome.QuestExploration_MeetFarris2(), and CoreDebug.QuickStart().

◆ ClearZones()

void Zone.ClearZones ( Zone  current = null)
inline

Definition at line 2087 of file Zone.cs.

2088 {
2089 if (map != null)
2090 {
2091 UnloadMap();
2092 }
2093 base.isGenerated = false;
2094 Zone topZone = GetTopZone();
2095 if (topZone != this)
2096 {
2097 topZone.ClearZones(this);
2098 return;
2099 }
2100 children.ForeachReverse(delegate(Spatial c)
2101 {
2102 if (c != current)
2103 {
2104 c.Destroy();
2105 }
2106 });
2107 }
virtual void Destroy()
Definition: Spatial.cs:690
List< Spatial > children
Definition: Spatial.cs:37

References ClearZones(), and Spatial.Destroy().

Referenced by Activate(), and ClearZones().

◆ CountMinions()

int Zone.CountMinions ( Chara  c)
inline

Definition at line 4040 of file Zone.cs.

4041 {
4042 int num = 0;
4043 foreach (Chara chara in EClass._map.charas)
4044 {
4045 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
4046 {
4047 num++;
4048 }
4049 }
4050 return num;
4051 }
MinionType
Definition: MinionType.cs:2
MinionType c_minionType
Definition: Card.cs:1027

References EClass._map, Card.c_minionType, Card.c_uidMaster, Map.charas, and Card.uid.

Referenced by WidgetStatsBar.Build(), Chara.CanBeTempAlly(), ActEffect.ProcAt(), and GoalCombat.TryUseAbility().

◆ CreateBP()

void Zone.CreateBP ( )
inline

Definition at line 2548 of file Zone.cs.

2549 {
2550 bp = new ZoneBlueprint();
2551 bp.Create();
2552 bp.genSetting.seed = base.Seed;
2553 OnCreateBP();
2554 }
virtual void OnCreateBP()
Definition: Zone.cs:2556

References ZoneBlueprint.Create().

◆ CreatePlaylist()

Playlist Zone.CreatePlaylist ( ref List< int >  list,
Playlist  mold = null 
)
inline

Definition at line 3364 of file Zone.cs.

3365 {
3366 return ModUtil.CreatePlaylist(ref list, mold);
3367 }

◆ Deactivate()

void Zone.Deactivate ( )
inline

Definition at line 1795 of file Zone.cs.

1796 {
1797 if (!IsUserZone && !IsPCFaction && map != null)
1798 {
1799 List<Thing> list = new List<Thing>();
1800 foreach (Thing thing in map.things)
1801 {
1802 if (thing.rarity >= Rarity.Artifact && thing.HasTag(CTAG.godArtifact))
1803 {
1804 list.Add(thing);
1805 }
1806 }
1807 if (this is Zone_Tent)
1808 {
1809 foreach (Thing item in map.props.stocked.Things.Concat(map.props.roaming.Things))
1810 {
1811 if (item.IsContainer)
1812 {
1813 foreach (Thing thing2 in item.things)
1814 {
1815 if (thing2.trait is TraitTent)
1816 {
1817 list.Add(thing2);
1818 }
1819 }
1820 }
1821 if (item.trait is TraitTent)
1822 {
1823 list.Add(item);
1824 }
1825 }
1826 }
1827 if (list.Count > 0)
1828 {
1829 Msg.Say("pick_valuable");
1830 foreach (Thing item2 in list)
1831 {
1832 Msg.Say("pick_valuable2", item2);
1833 EClass.pc.AddCard(item2);
1834 }
1835 }
1836 }
1838 {
1839 base.isPeace = false;
1840 }
1842 if (IsPCFaction)
1843 {
1844 foreach (Chara member in branch.members)
1845 {
1846 member.ValidateWorks();
1847 }
1848 }
1849 EClass.game.lastActiveZone = EClass.game.activeZone;
1850 base.lastActive = EClass.world.date.GetRaw();
1851 map.OnDeactivate();
1852 EClass.scene.Clear();
1853 EClass.game.activeZone = null;
1854 if (IsInstance)
1855 {
1856 UnloadMap();
1857 base.isGenerated = false;
1858 }
1859 if (forceRegenerate)
1860 {
1861 UnloadMap();
1862 }
1863 OnDeactivate();
1864 }
Rarity
Definition: Rarity.cs:2
Card AddCard(Card c)
Definition: Card.cs:3278
Rarity rarity
Definition: Card.cs:317
bool HasTag(CTAG tag)
Definition: Card.cs:2740
void ValidateWorks()
Definition: Chara.cs:9925
void OnDeactivate()
Definition: Map.cs:213
PropsManager props
Definition: Map.cs:97
PropsRoaming roaming
Definition: PropsManager.cs:10
PropsStocked stocked
Definition: PropsManager.cs:6
List< Thing > Things
Definition: Props.cs:37
void Clear()
Definition: Scene.cs:354
virtual void OnBeforeDeactivate()
Definition: Zone.cs:1284
virtual bool IsUserZone
Definition: Zone.cs:278
virtual void OnDeactivate()
Definition: Zone.cs:1288

References Game.activeZone, Card.AddCard(), Scene.Clear(), World.date, EClass.game, Date.GetRaw(), Card.HasTag(), item, FactionBranch.members, Map.OnDeactivate(), EClass.pc, EClass.player, Map.props, Card.rarity, PropsManager.roaming, Msg.Say(), EClass.scene, Player.simulatingZone, PropsManager.stocked, Map.things, Props.Things, Card.trait, Chara.ValidateWorks(), and EClass.world.

Referenced by Activate().

◆ Destroy()

override void Zone.Destroy ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 2068 of file Zone.cs.

2069 {
2070 children.ForeachReverse(delegate(Spatial z)
2071 {
2072 z.Destroy();
2073 });
2074 if (map != null)
2075 {
2076 UnloadMap();
2077 }
2078 if (parent != null && parent.IsRegion && instance == null)
2079 {
2080 EClass.scene.elomap.SetZone(base.x, base.y, null, updateMesh: true);
2081 }
2082 EClass.game.spatials.Remove(this);
2083 destryoed = true;
2084 base.isGenerated = false;
2085 }
void Remove(Spatial s)
Spatial parent
Definition: Spatial.cs:10

References Spatial.Destroy(), Scene.elomap, EClass.game, SpatialManager.Remove(), EClass.scene, EloMap.SetZone(), and Game.spatials.

◆ Evalue() [1/2]

int Zone.Evalue ( int  ele)
inline

Definition at line 575 of file Zone.cs.

576 {
577 return elements.Value(ele);
578 }
int Value(int ele)
ElementContainerZone elements
Definition: Zone.cs:46

References elements, and ElementContainer.Value().

Referenced by TraitWrench.IsValidTarget().

◆ Evalue() [2/2]

int Zone.Evalue ( string  alias)
inline

Definition at line 580 of file Zone.cs.

581 {
582 return elements.Value(EClass.sources.elements.alias[alias].id);
583 }
SourceElement elements

References SourceManager.elements, elements, EClass.sources, and ElementContainer.Value().

◆ Export() [1/2]

void Zone.Export ( )
inline

Definition at line 3563 of file Zone.cs.

3564 {
3566 string text = pathExport;
3567 IO.Copy(text, CorePath.ZoneSave + "Backup/");
3568 Export(text);
3569 Msg.Say("Exported Map:" + text);
3570 }
static void Copy(string fromPath, string toPath)
Definition: IO.cs:312
void ResetEditorPos()
Definition: Map.cs:365
void Export()
Definition: Zone.cs:3563

References EClass._map, Map.ResetEditorPos(), Msg.Say(), and CorePath.ZoneSave.

◆ Export() [2/2]

void Zone.Export ( string  path,
PartialMap  partial = null,
bool  usermap = false 
)
inline

Definition at line 3480 of file Zone.cs.

3481 {
3482 if (subset != null)
3483 {
3484 SE.Beep();
3485 return;
3486 }
3487 try
3488 {
3489 ZoneExportData zoneExportData = new ZoneExportData
3490 {
3491 name = name,
3492 usermap = usermap
3493 };
3495 if (!map.config.retainDecal)
3496 {
3498 }
3499 map.Save(IO.TempPath + "/", zoneExportData, partial);
3500 map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(path), partial);
3501 if (partial == null)
3502 {
3503 IO.CopyDir(base.pathSave + "Texture Replace", IO.TempPath + "/Texture Replace");
3504 }
3505 IO.SaveFile(IO.TempPath + "/export", zoneExportData, compress: true);
3506 using (ZipFile zipFile = new ZipFile())
3507 {
3508 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3509 zipFile.AddDirectory(IO.TempPath);
3510 zipFile.Save(path);
3511 zipFile.Dispose();
3512 }
3514 }
3515 catch (Exception ex)
3516 {
3517 EClass.ui.Say(ex.Message + ":" + path);
3518 }
3519 }
static void CreateTempDirectory(string path=null)
Definition: IO.cs:422
static string TempPath
Definition: IO.cs:63
static void SaveFile(string path, object obj, bool compress=false, JsonSerializerSettings setting=null)
Definition: IO.cs:88
static void DeleteTempDirectory(string path=null)
Definition: IO.cs:427
bool retainDecal
Definition: MapConfig.cs:44
void ExportMetaData(string _path, string id, PartialMap partial=null)
Definition: Map.cs:835
void ClearRainAndDecal()
Definition: Map.cs:1690
string name
Definition: Spatial.cs:19

References Map.ClearRainAndDecal(), Map.config, Map.ExportMetaData(), MapConfig.retainDecal, Map.Save(), and EClass.ui.

Referenced by ZoneInspector.Export(), LayerUploader.ExportMap(), CoreDebug.InitDebugCommands(), and PartialMap.Save().

◆ ExportDialog()

void Zone.ExportDialog ( string  dir = null)
inline

Definition at line 3521 of file Zone.cs.

3522 {
3524 {
3525 string text = StandaloneFileBrowser.SaveFilePanel("Export Zone", dir ?? CorePath.ZoneSave, "new zone", "z");
3526 if (!string.IsNullOrEmpty(text))
3527 {
3528 Export(text);
3529 Msg.SayRaw("Exported Zone");
3530 }
3531 });
3532 }
void WaitForEndOfFrame(Action action)
Definition: BaseCore.cs:61
static string SayRaw(string text)
Definition: Msg.cs:118
static string SaveFilePanel(string title, string directory, string defaultName, string extension)

References EClass.core, if(), SFB.StandaloneFileBrowser.SaveFilePanel(), Msg.SayRaw(), BaseCore.WaitForEndOfFrame(), and CorePath.ZoneSave.

Referenced by CoreDebug.InitDebugCommands().

◆ FindChara() [1/2]

Chara Zone.FindChara ( int  uid)
inline

Definition at line 3374 of file Zone.cs.

3375 {
3376 return map.charas.Find((Chara c) => c.uid == uid);
3377 }
int uid
Definition: Spatial.cs:70

References Map.charas, and Card.uid.

◆ FindChara() [2/2]

Chara Zone.FindChara ( string  id)
inline

Definition at line 3369 of file Zone.cs.

3370 {
3371 return map.charas.Find((Chara c) => c.id == id);
3372 }

References Map.charas, and Card.id.

Referenced by DramaCustomSequence.Build(), Zone_CurryRuinDungeon.OnGenerateMap(), Zone_OldKeepDungeon.OnGenerateMap(), and Zone_Aquli.OnVisitNewMapOrRegenerate().

◆ FindDeadChara()

Chara Zone.FindDeadChara ( string  id)
inline

Definition at line 3379 of file Zone.cs.

3380 {
3381 return map.deadCharas.Find((Chara c) => c.id == id);
3382 }

References Map.deadCharas, and Card.id.

Referenced by Zone_Aquli.OnVisitNewMapOrRegenerate().

◆ FindOrCreateLevel()

Zone Zone.FindOrCreateLevel ( int  destLv,
string  subId = "" 
)
inline

Definition at line 534 of file Zone.cs.

535 {
536 if (destLv == base.lv)
537 {
538 return this;
539 }
540 Zone zone = FindZone(destLv);
541 if (zone != null)
542 {
543 return zone;
544 }
545 if (!(SpatialGen.Create(subId.IsEmpty(GetNewZoneID(destLv)), this, register: true) is Zone zone2))
546 {
547 return null;
548 }
549 zone2.lv = destLv;
550 zone2.x = base.x;
551 zone2.y = base.y;
552 return zone2;
553 }
static Spatial Create(string id, Spatial parent, bool register, int x=-99999, int y=-99999, int icon=0)
Definition: SpatialGen.cs:16
virtual string GetNewZoneID(int level)
Definition: Zone.cs:595

References SpatialGen.Create(), Spatial.FindZone(), GetNewZoneID(), and Spatial.x.

◆ FindSharedContainer()

Thing Zone.FindSharedContainer ( Thing  t,
List< Thing >  containers = null,
bool  sharedOnly = true 
)
inline

Definition at line 2337 of file Zone.cs.

2338 {
2339 Thing dest = null;
2340 int priority = -1;
2341 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
2342 if (flag == ContainerFlag.none)
2343 {
2344 flag = ContainerFlag.other;
2345 }
2346 if (containers == null)
2347 {
2348 containers = EClass._map.props.installed.containers;
2349 }
2350 SearchDest();
2351 return dest;
2352 Thing SearchDest()
2353 {
2354 foreach (Thing container in containers)
2355 {
2356 Thing thing = container;
2357 if (thing.trait is TraitShippingChest)
2358 {
2360 }
2361 if ((!sharedOnly || thing.IsSharedContainer) && thing.c_lockLv <= 0 && (thing.things.Count < thing.things.MaxCapacity || thing.things.CanStack(t) != t))
2362 {
2363 Window.SaveData windowSaveData = thing.GetWindowSaveData();
2364 if (windowSaveData != null)
2365 {
2366 if (windowSaveData.priority <= priority || (windowSaveData.noRotten && t.IsDecayed) || (windowSaveData.onlyRottable && t.trait.Decay == 0))
2367 {
2368 continue;
2369 }
2371 if (windowSaveData.userFilter)
2372 {
2373 filterResult = windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1));
2374 if (filterResult == Window.SaveData.FilterResult.Block)
2375 {
2376 continue;
2377 }
2378 }
2379 if (filterResult != Window.SaveData.FilterResult.PassWithoutFurtherTest)
2380 {
2381 if (windowSaveData.advDistribution)
2382 {
2383 bool flag2 = false;
2384 foreach (int cat in windowSaveData.cats)
2385 {
2386 if (t.category.uid == cat)
2387 {
2388 flag2 = true;
2389 break;
2390 }
2391 }
2392 if (!flag2)
2393 {
2394 continue;
2395 }
2396 }
2397 else if (windowSaveData.flag.HasFlag(flag))
2398 {
2399 continue;
2400 }
2401 }
2402 priority = windowSaveData.priority;
2403 }
2404 else
2405 {
2406 if (priority != -1)
2407 {
2408 continue;
2409 }
2410 priority = 0;
2411 }
2412 dest = thing;
2413 }
2414 }
2415 return null;
2416 }
2417 }
ContainerFlag
Definition: ContainerFlag.cs:5
NameStyle
Definition: NameStyle.cs:2
Thing container_shipping
Definition: CardManager.cs:52
bool IsDecayed
Definition: Card.cs:2369
int c_lockLv
Definition: Card.cs:1003
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2661
ThingContainer things
Definition: Card.cs:39
SourceCategory.Row category
Definition: Card.cs:2113
PropsInstalled installed
Definition: PropsManager.cs:8
List< Thing > containers
Definition: Props.cs:22
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:536
bool IsSharedContainer
Definition: Thing.cs:110
virtual int Decay
Definition: Trait.cs:123
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

References EClass._map, Window.SaveData.advDistribution, Card.c_lockLv, ThingContainer.CanStack(), Game.cards, Card.category, Window.SaveData.cats, CardManager.container_shipping, Props.containers, Trait.Decay, Window.SaveData.flag, EClass.game, Thing.GetName(), Card.GetWindowSaveData(), PropsManager.installed, Card.IsDecayed, Window.SaveData.IsFilterPass(), Thing.IsSharedContainer, ThingContainer.MaxCapacity, Window.SaveData.noRotten, Window.SaveData.onlyRottable, Window.SaveData.priority, Map.props, Card.things, Card.trait, and Window.SaveData.userFilter.

Referenced by FactionBranch.AutoClean().

◆ Generate()

void Zone.Generate ( )
inline

Definition at line 2560 of file Zone.cs.

2561 {
2562 base.isGenerated = true;
2563 if (bp == null)
2564 {
2565 CreateBP();
2566 }
2567 if (bp.map == null)
2568 {
2569 bp.GenerateMap(this);
2570 }
2571 map.SetZone(this);
2572 Zone_Field zone_Field = this as Zone_Field;
2573 bool flag = IdBiome == "Sand" || IdBiome == "Water" || IsUnderwater;
2574 if (flag)
2575 {
2576 int num = 1 + EClass.rnd((IdBiome == "Water") ? 3 : 2);
2577 for (int i = 0; i < num; i++)
2578 {
2579 Point randomSurface = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2580 if (!randomSurface.HasObj && !randomSurface.HasThing)
2581 {
2582 Thing t = ThingGen.Create("pearl_oyster", new string[3] { "wood_birch", "poplar", "coralwood" }.RandomItem(), ContentLv);
2583 EClass._zone.AddCard(t, randomSurface).Install();
2584 }
2585 }
2586 num = 4 + EClass.rnd(5);
2587 for (int j = 0; j < num; j++)
2588 {
2589 Point randomSurface2 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2590 if (!randomSurface2.HasObj && !randomSurface2.HasThing && (IsUnderwater || randomSurface2.cell.IsTopWaterAndNoSnow || EClass.rnd(6) == 0))
2591 {
2592 EClass._zone.AddCard(ThingGen.Create("70", -1, ContentLv), randomSurface2);
2593 }
2594 }
2595 for (int k = 0; k < EClass.rnd(EClass.rnd(base.isBeach ? 5 : 3) + 1); k++)
2596 {
2597 Point randomSurface3 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2598 if (!randomSurface3.HasObj)
2599 {
2600 EClass._zone.AddCard(ThingGen.Create("bottle_message"), randomSurface3);
2601 }
2602 }
2603 }
2604 if (IsUnderwater)
2605 {
2606 for (int l = 0; l < 30 + EClass.rnd(30); l++)
2607 {
2608 SpawnMob(null, SpawnSetting.Fish());
2609 }
2610 Crawler crawler = Crawler.Create("pasture");
2611 int num2 = (EClass.debug.enable ? 3 : EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(5) + 1) + 1) + 1));
2612 bool flag2 = this is Zone_Field;
2613 Thing seed = null;
2614 if (IsNefia)
2615 {
2616 int num3 = Mathf.Min(EClass._zone.DangerLv, EClass.pc.Evalue(286) * 2 / 3);
2617 if (num3 > 0)
2618 {
2620 Rand.SetSeed(EClass._zone.uid * 10 + num3);
2621 TraitSeed.LevelSeed(seed, (seed.trait as TraitSeed).row, num3);
2622 Rand.SetSeed();
2623 seed.elements.SetBase(2, EClass.curve(seed.encLV, 50, 10, 80));
2624 }
2625 }
2626 crawler.CrawlUntil(EClass._map, () => EClass._map.GetRandomPoint(), num2 + (flag2 ? 4 : 0), delegate(Crawler.Result r)
2627 {
2628 int num7 = 137;
2629 foreach (Point point in r.points)
2630 {
2631 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
2632 {
2633 map.SetObj(point.x, point.z, num7);
2634 int idx = 3 + ((EClass.rnd(3) == 0) ? 1 : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0);
2635 point.growth.SetStage(idx);
2636 if (seed != null)
2637 {
2638 EClass._map.AddPlant(point, seed);
2639 }
2640 }
2641 }
2642 return false;
2643 });
2644 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(5) + 1) + 1 + (flag2 ? 20 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2645 {
2646 int num7 = 136;
2647 foreach (Point point2 in r.points)
2648 {
2649 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
2650 {
2651 map.SetObj(point2.x, point2.z, num7, 1, EClass.rnd(4));
2652 }
2653 }
2654 return false;
2655 });
2656 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(10) + 1) + 3 + (flag2 ? 40 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2657 {
2658 int idFloor = 121;
2659 foreach (Point point3 in r.points)
2660 {
2661 map.SetFloor(point3.x, point3.z, 97, idFloor, Mathf.Clamp(4 - r.startPos.Distance(point3) + EClass.rnd(3) - EClass.rnd(3), 0, 3));
2662 }
2663 return false;
2664 });
2665 }
2666 if (zone_Field != null)
2667 {
2668 if (EClass.rnd(3) == 0)
2669 {
2670 int num4 = EClass.rnd(2);
2671 for (int num5 = 0; num5 < num4; num5++)
2672 {
2673 Point randomSurface4 = EClass._map.bounds.GetRandomSurface();
2674 if (!randomSurface4.HasObj && !randomSurface4.HasThing)
2675 {
2677 EClass._zone.AddCard(t2, randomSurface4).Install();
2678 }
2679 }
2680 }
2681 if (EClass.rnd(8) == 0)
2682 {
2683 SpawnAltar();
2684 }
2686 if (!flag && EClass.rnd(EClass.debug.enable ? 1 : 10) == 0)
2687 {
2688 Point randomSurface5 = EClass._map.bounds.GetRandomSurface();
2689 if (randomSurface5.IsValid)
2690 {
2691 EClass._zone.AddCard(CharaGen.Create("priest"), randomSurface5);
2692 }
2693 }
2694 if (base.Tile.isRoad)
2695 {
2696 for (int num6 = 0; num6 < EClass.rnd(4); num6++)
2697 {
2698 EClass._zone.SpawnMob(map.GetCenterPos().GetRandomPointInRadius(2, 6, requireLos: false, allowChara: false), SpawnSetting.HomeGuest(EClass._zone.DangerLv));
2699 }
2700 }
2701 }
2702 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList) ?? EClass.Sound.GetPlaylist("Day"));
2703 }
@ seed
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3229
int Evalue(int ele)
Definition: Card.cs:2716
Card Install()
Definition: Card.cs:3934
bool IsTopWaterAndNoSnow
Definition: Cell.cs:748
bool isModified
Definition: Cell.cs:450
static Crawler Create(string id)
Definition: Crawler.cs:193
bool CrawlUntil(Map map, Func< Point > onStart, int tries, Func< Result, bool > canComplete, Action onFail=null)
Definition: Crawler.cs:59
static int curve(long _a, int start, int step, int rate=75)
Definition: EClass.cs:69
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:456
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Definition: MapBounds.cs:182
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
Definition: Map.cs:2379
List< int > _plDay
Definition: Map.cs:61
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:1087
PlantData AddPlant(Point pos, Thing seed)
Definition: Map.cs:2116
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1699
bool HasThing
Definition: Point.cs:247
bool HasObj
Definition: Point.cs:133
Point GetRandomPointInRadius(int minRadius, int maxRadius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=2000)
Definition: Point.cs:784
Cell cell
Definition: Point.cs:47
GrowSystem growth
Definition: Point.cs:73
static void SetSeed(int a=-1)
Definition: Rand.cs:44
SourceObj objs
static SpawnSetting Fish()
static SpawnSetting HomeGuest(int lv)
static Thing MakeSeed(string idSource)
Definition: TraitSeed.cs:105
static void LevelSeed(Thing t, SourceObj.Row obj, int num)
Definition: TraitSeed.cs:184
void GenerateMap(Zone zone)
virtual string IDPlayList
Definition: Zone.cs:148
override int ContentLv
Definition: Zone.cs:103
void SpawnAltar()
Definition: Zone.cs:2739
Playlist CreatePlaylist(ref List< int > list, Playlist mold=null)
Definition: Zone.cs:3364
virtual bool IsNefia
Definition: Zone.cs:292
BiomeProfile biome
Definition: Zone.cs:134
Chara SpawnMob(string id, Point pos=null)
Definition: Zone.cs:2991
virtual string IdBiome
Definition: Zone.cs:136
override int DangerLv
Definition: Zone.cs:115
void TrySpawnFollower()
Definition: Zone.cs:2705
void CreateBP()
Definition: Zone.cs:2548

References EClass._map, Map._plDay, EClass._zone, AddCard(), Map.AddPlant(), Map.bounds, Point.cell, Card.ChangeMaterial(), Crawler.CrawlUntil(), Crawler.Create(), ThingGen.Create(), CharaGen.Create(), EClass.curve(), DangerLv, EClass.debug, CoreDebug.enable, Card.Evalue(), SpawnSetting.Fish(), ZoneBlueprint.GenerateMap(), MapBounds.GetCenterPos(), Map.GetRandomPoint(), Point.GetRandomPointInRadius(), MapBounds.GetRandomSurface(), Point.growth, Point.HasBlock, Point.HasObj, Point.HasThing, SpawnSetting.HomeGuest(), Card.Install(), Cell.isModified, Cell.IsTopWaterAndNoSnow, Point.IsValid, TraitSeed.LevelSeed(), TraitSeed.MakeSeed(), ZoneBlueprint.map, BiomeProfile.Style.matDoor, SourceManager.objs, EClass.pc, EClass.rnd(), seed, Map.SetFloor(), Map.SetObj(), Rand.SetSeed(), GrowSystem.SetStage(), Map.SetZone(), EClass.Sound, EClass.sources, SpawnMob(), BiomeProfile.style, Spatial.uid, Point.x, and Point.z.

Referenced by Activate().

◆ GetCostSkyTravel()

int Zone.GetCostSkyTravel ( )
inline

Definition at line 3403 of file Zone.cs.

3404 {
3405 if (base.source.costSkyTravel > 0)
3406 {
3407 return base.source.costSkyTravel;
3408 }
3410 {
3411 return Mathf.Clamp(10 + EClass.curve(DangerLv, 50, 10), 1, 200);
3412 }
3413 return 0;
3414 }
bool IsSurvival
Definition: Game.cs:276

References EClass.curve(), EClass.game, and Game.IsSurvival.

Referenced by TraitSkyHelm.OnUse().

◆ GetDeepestLv() [1/2]

int Zone.GetDeepestLv ( )
inline

Definition at line 3384 of file Zone.cs.

3385 {
3386 int max = base.lv;
3387 return GetDeepestLv(ref max);
3388 }
int GetDeepestLv()
Definition: Zone.cs:3384

◆ GetDeepestLv() [2/2]

int Zone.GetDeepestLv ( ref int  max)
inline

Definition at line 3390 of file Zone.cs.

3391 {
3392 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
3393 {
3394 max = base.lv;
3395 }
3396 foreach (Spatial child in children)
3397 {
3398 (child as Zone).GetDeepestLv(ref max);
3399 }
3400 return max;
3401 }

◆ GetDungenID()

virtual string Zone.GetDungenID ( )
inlinevirtual

◆ GetElectricity()

int Zone.GetElectricity ( bool  cost = false)
inline

Definition at line 3226 of file Zone.cs.

3227 {
3228 bool flag = GetSoilCost() > MaxSoil;
3229 int sum = 0;
3230 foreach (Thing thing in EClass._map.things)
3231 {
3232 if (!thing.IsInstalled || thing.trait.Electricity == 0)
3233 {
3234 continue;
3235 }
3236 if (cost)
3237 {
3238 if (thing.trait.Electricity < 0)
3239 {
3240 sum += -thing.trait.Electricity;
3241 }
3242 }
3243 else if (thing.trait.Electricity > 0)
3244 {
3245 sum += thing.trait.Electricity;
3246 }
3247 }
3248 if (!cost)
3249 {
3250 sum += elements.Value(2201) * 10 + BaseElectricity;
3251 if (!flag)
3252 {
3253 EClass._map.bounds.ForeachCell(delegate(Cell c)
3254 {
3255 if (c.sourceObj.id == 118 && c.growth.IsMature)
3256 {
3257 sum += 20;
3258 }
3259 });
3260 }
3261 }
3262 return sum;
3263 }
bool IsInstalled
Definition: Card.cs:2463
GrowSystem growth
Definition: Cell.cs:247
SourceObj.Row sourceObj
Definition: Cell.cs:1112
virtual bool IsMature
Definition: GrowSystem.cs:117
void ForeachCell(Action< Cell > action)
Definition: MapBounds.cs:279
virtual int Electricity
Definition: Trait.cs:119
virtual int BaseElectricity
Definition: Zone.cs:500
virtual int MaxSoil
Definition: Zone.cs:523
int GetSoilCost()
Definition: Zone.cs:4053

References EClass._map, Map.bounds, Trait.Electricity, MapBounds.ForeachCell(), Cell.growth, Card.IsInstalled, GrowSystem.IsMature, Cell.sourceObj, Map.things, Card.trait, and ElementContainer.Value().

Referenced by UIHomeInfo.RefreshInfo().

◆ GetNewZoneID()

virtual string Zone.GetNewZoneID ( int  level)
inlinevirtual

Reimplemented in Zone_CurryRuin, Zone_CursedManor, Zone_Nymelle, Zone_OldKeep, and Zone_Vernis.

Definition at line 595 of file Zone.cs.

596 {
597 return base.source.id;
598 }

Referenced by TraitNewZone.CreateZone(), FindOrCreateLevel(), and ActEffect.Proc().

◆ GetOrCreateFortuneRollData()

FortuneRollData Zone.GetOrCreateFortuneRollData ( bool  refresh = true)
inline

Definition at line 4156 of file Zone.cs.

4157 {
4158 if (fortuneRoll == null)
4159 {
4161 fortuneRoll.seed = EClass._zone.uid * 100 + EClass.game.seed;
4162 }
4163 if (refresh || fortuneRoll.count == 0)
4164 {
4166 }
4167 return fortuneRoll;
4168 }
int seed
Definition: Game.cs:201
FortuneRollData fortuneRoll
Definition: Zone.cs:64

References FortuneRollData.count, EClass.game, FortuneRollData.Refresh(), and Game.seed.

Referenced by TraitCrafter.Craft(), and UIDragGridInfo.Init().

◆ GetProfile()

ZoneProfile Zone.GetProfile ( )
inline

Definition at line 2508 of file Zone.cs.

2509 {
2510 string text = IdProfile;
2511 if (text.IsEmpty())
2512 {
2513 Region region = parent as Region;
2514 if (base.lv != 0)
2515 {
2516 text = ((base.lv < 0) ? "Underground" : "Sky");
2517 }
2518 else if (region != null)
2519 {
2521 text = EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2522 if (bp != null)
2523 {
2524 name = Lang.GetList("zone_" + text.Split('/')[1]).RandomItem();
2525 bp.surrounding = new EloMap.TileInfo[3, 3];
2526 for (int i = 0; i < 3; i++)
2527 {
2528 for (int j = 0; j < 3; j++)
2529 {
2530 bp.surrounding[j, i] = EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2531 }
2532 }
2533 if (text == "Random/R_Shore")
2534 {
2535 base.isBeach = true;
2536 }
2537 }
2538 }
2539 else
2540 {
2541 text = "Random";
2542 }
2543 idProfile = text;
2544 }
2545 return ZoneProfile.Load(text);
2546 }
EloMap elomap
Definition: EloMapActor.cs:7
string idZoneProfile
Definition: EloMap.cs:68
Definition: EloMap.cs:8
TileInfo GetTileInfo(int gx, int gy)
Definition: EloMap.cs:286
Definition: Lang.cs:7
static string[] GetList(string id)
Definition: Lang.cs:113
string idProfile
Definition: Spatial.cs:25
EloMap.TileInfo[,] surrounding
static ZoneProfile Load(string id)
Definition: ZoneProfile.cs:73
virtual string IdProfile
Definition: Zone.cs:146
Region Region
Definition: Zone.cs:170

References EloMapActor.elomap, Region.elomap, Scene.elomapActor, Lang.GetList(), EloMap.GetTileInfo(), EloMap.TileInfo.idZoneProfile, EloMapActor.Initialize(), ZoneProfile.Load(), EClass.scene, and ZoneBlueprint.surrounding.

Referenced by ZoneBlueprint.GenerateMap().

◆ GetRandomSpot< T >()

T Zone.GetRandomSpot< T > ( )
inline
Type Constraints
T :Trait 

Definition at line 2223 of file Zone.cs.

2223 : Trait
2224 {
2225 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
2226 }

References EClass._map, PropsManager.installed, Map.props, and Props.traits.

◆ GetRandomVisitPos()

Point Zone.GetRandomVisitPos ( Chara  c)
inline

Definition at line 1692 of file Zone.cs.

1693 {
1694 Point point = null;
1695 if (EClass.rnd(3) == 0 && map.rooms.listRoom.Count > 0)
1696 {
1697 point = map.rooms.listRoom.RandomItem().points.RandomItem();
1698 }
1699 if (point == null && EClass.rnd(4) != 0)
1700 {
1701 IEnumerable<Chara> ie = map.charas.Where((Chara t) => t.trait.ShopType != ShopType.None && t.pos != null && t.pos.IsValid);
1702 if (ie.Count() > 0)
1703 {
1704 point = ie.RandomItem().pos.GetRandomPoint(3);
1705 }
1706 }
1707 if (point == null)
1708 {
1709 point = map.bounds.GetRandomSurface(centered: false, walkable: true, !IsPCFaction && !(this is Zone_Civilized)) ?? map.bounds.GetRandomPoint();
1710 }
1711 return point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false) ?? EClass._map.GetCenterPos().GetNearestPoint();
1712 }
ShopType
Definition: ShopType.cs:2
new TraitChara trait
Definition: Chara.cs:511
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:770
virtual ShopType ShopType
Definition: Trait.cs:536

References EClass._map, Map.bounds, Map.charas, MapBounds.GetCenterPos(), Point.GetNearestPoint(), MapBounds.GetRandomPoint(), Point.GetRandomPoint(), MapBounds.GetRandomSurface(), Point.IsValid, RoomManager.listRoom, Card.pos, EClass.rnd(), Map.rooms, Trait.ShopType, and Chara.trait.

◆ GetRoot()

ICardParent Zone.GetRoot ( )
inline

Implements ICardParent.

Definition at line 2113 of file Zone.cs.

2114 {
2115 return this;
2116 }

◆ GetSoilCost()

int Zone.GetSoilCost ( )
inline

Definition at line 4053 of file Zone.cs.

4054 {
4055 int n = 0;
4056 EClass._map.bounds.ForeachCell(delegate(Cell c)
4057 {
4058 n += c.sourceObj.costSoil;
4059 });
4060 return n / 10;
4061 }

References EClass._map, Map.bounds, MapBounds.ForeachCell(), and Cell.sourceObj.

Referenced by WidgetStatsBar.Build(), FactionBranch.DailyOutcome(), Map.MineObj(), GrowSystem.PopHarvest(), UIHomeInfo.RefreshInfo(), and GrowSystem.TryPopSeed().

◆ GetSortVal()

int Zone.GetSortVal ( )
inline

Definition at line 3580 of file Zone.cs.

3581 {
3582 if (IsPCFaction)
3583 {
3584 return -10000000 + base.uid;
3585 }
3586 if (this is Zone_SubTown)
3587 {
3588 return -8000000 + base.uid;
3589 }
3590 if (this is Zone_Town)
3591 {
3592 return -9000000 + base.uid;
3593 }
3594 if (this is Zone_Civilized)
3595 {
3596 return -7000000 + base.uid;
3597 }
3598 if (this is Zone_RandomDungeon)
3599 {
3600 return 1000000 + base.uid;
3601 }
3602 return base.uid;
3603 }

Referenced by SpatialManager.ListReturnLocations().

◆ GetSpawnPos() [1/2]

Point Zone.GetSpawnPos ( Chara  c,
ZoneTransition::EnterState  destState = ZoneTransition::EnterState::Auto 
)
inline

Definition at line 1503 of file Zone.cs.

1504 {
1505 ZoneTransition zoneTransition = c.global?.transition;
1506 Zone zone = zoneTransition?.lastZone;
1507 ZoneTransition.EnterState enterState = zoneTransition?.state ?? destState;
1508 bool flag = zone == null || zone.lv > base.lv;
1509 if (IsRegion)
1510 {
1511 if (zone != null && !EClass.player.simulatingZone)
1512 {
1513 Zone topZone = zone.GetTopZone();
1514 if (GetZoneAt(topZone.x, topZone.y) != null)
1515 {
1516 return new Point(topZone.mapX, topZone.mapY);
1517 }
1518 }
1519 }
1520 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))
1521 {
1522 return EClass.player.lastZonePos;
1523 }
1524 if (enterState == ZoneTransition.EnterState.Region)
1525 {
1526 enterState = RegionEnterState;
1527 }
1528 if (this is Zone_Kapul && enterState == ZoneTransition.EnterState.Left)
1529 {
1530 enterState = ZoneTransition.EnterState.Right;
1531 }
1532 float rate = zoneTransition?.ratePos ?? (-1f);
1533 if (IsPCFaction)
1534 {
1535 if ((uint)(enterState - 3) <= 4u || enterState == ZoneTransition.EnterState.Return)
1536 {
1538 if (spot != null)
1539 {
1540 Point nearestPoint = (spot.trait as TraitSpotGuidePC).GetRandomPoint((Point p) => !p.IsBlocked && !p.Equals(spot.pos)).GetNearestPoint();
1541 if (nearestPoint != null && nearestPoint.IsValid)
1542 {
1543 return nearestPoint;
1544 }
1545 }
1546 }
1547 }
1548 while (true)
1549 {
1550 switch (enterState)
1551 {
1552 case ZoneTransition.EnterState.UndergroundOrSky:
1553 return new Point(zoneTransition.x, zoneTransition.z);
1554 case ZoneTransition.EnterState.Teleport:
1555 {
1556 foreach (Thing thing2 in map.things)
1557 {
1558 if (thing2.IsInstalled)
1559 {
1560 TraitTeleporter traitTeleporter = thing2.trait as TraitTeleporter;
1561 if (traitTeleporter != null)
1562 {
1563 Debug.Log(zoneTransition.idTele + "/" + traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)) + "/" + traitTeleporter.GetParam(3));
1564 }
1565 if (traitTeleporter != null && !zoneTransition.idTele.IsEmpty() && zoneTransition.idTele == traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)))
1566 {
1567 return thing2.pos.GetNearestPoint();
1568 }
1569 }
1570 }
1571 foreach (Thing thing3 in map.things)
1572 {
1573 if (thing3.IsInstalled && thing3.trait is TraitTeleporter traitTeleporter2 && traitTeleporter2.IsFor(zoneTransition.lastZone))
1574 {
1575 return thing3.pos.GetNearestPoint();
1576 }
1577 }
1578 Thing randomThing2 = EClass._map.props.installed.traits.GetRandomThing<TraitTeleporter>();
1579 if (randomThing2 != null)
1580 {
1581 return randomThing2.pos.GetNearestPoint();
1582 }
1583 goto case ZoneTransition.EnterState.Return;
1584 }
1585 case ZoneTransition.EnterState.Return:
1586 case ZoneTransition.EnterState.Elevator:
1587 case ZoneTransition.EnterState.Moongate:
1588 {
1589 if (enterState == ZoneTransition.EnterState.Elevator)
1590 {
1591 foreach (Thing thing4 in map.things)
1592 {
1593 if (thing4.IsInstalled && thing4.trait is TraitElevator traitElevator && traitElevator.IsFor(zoneTransition.lastZone))
1594 {
1595 return thing4.pos.GetNearestPoint();
1596 }
1597 }
1598 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<TraitElevator>();
1599 if (randomThing != null)
1600 {
1601 return randomThing.pos.GetNearestPoint();
1602 }
1603 }
1604 Thing thing = null;
1605 if (enterState == ZoneTransition.EnterState.Return && EClass.game.IsSurvival)
1606 {
1607 thing = map.props.installed.traits.GetRandomThing<TraitLandingPortal>();
1608 if (thing != null)
1609 {
1610 return thing.pos;
1611 }
1612 }
1613 thing = map.props.installed.traits.GetRandomThing<TraitWaystone>();
1614 if (thing != null)
1615 {
1616 return thing.pos.GetNearestPoint();
1617 }
1618 thing = map.props.installed.traits.GetRandomThing<TraitCoreZone>();
1619 if (thing != null)
1620 {
1621 return thing.pos.GetNearestPoint();
1622 }
1623 if (base.lv == 0)
1624 {
1625 goto IL_04da;
1626 }
1627 flag = base.lv <= 0;
1628 break;
1629 }
1630 case ZoneTransition.EnterState.Center:
1631 case ZoneTransition.EnterState.Encounter:
1632 if (map.config.embarkX != 0)
1633 {
1634 return new Point(map.config.embarkX, map.config.embarkY);
1635 }
1636 return map.GetCenterPos().GetNearestPoint(allowBlock: false, allowChara: false);
1637 case ZoneTransition.EnterState.Top:
1638 return map.bounds.GetTopPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1639 case ZoneTransition.EnterState.Right:
1640 return map.bounds.GetRightPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1641 case ZoneTransition.EnterState.Bottom:
1642 return map.bounds.GetBottomPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1643 case ZoneTransition.EnterState.Left:
1644 return map.bounds.GetLeftPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1645 case ZoneTransition.EnterState.Dead:
1646 case ZoneTransition.EnterState.Exact:
1647 case ZoneTransition.EnterState.PortalReturn:
1648 case ZoneTransition.EnterState.Fall:
1649 if (zoneTransition.x == 0 && EClass._map.bounds.x != 0)
1650 {
1651 return new Point(map.config.embarkX, map.config.embarkY);
1652 }
1653 return new Point(zoneTransition.x, zoneTransition.z);
1654 case ZoneTransition.EnterState.RandomVisit:
1655 return GetRandomVisitPos(c);
1656 case ZoneTransition.EnterState.Down:
1657 flag = true;
1658 break;
1659 case ZoneTransition.EnterState.Up:
1660 flag = false;
1661 break;
1662 }
1663 break;
1664 IL_04da:
1665 enterState = ZoneTransition.EnterState.Center;
1666 }
1667 foreach (Thing thing5 in map.things)
1668 {
1669 if (thing5.trait is TraitNewZone { zone: not null } traitNewZone && zone != null && traitNewZone.zone.uid == zone.uid)
1670 {
1671 if (c != null && enterState != ZoneTransition.EnterState.Auto)
1672 {
1673 c.SetDir(traitNewZone.owner.dir);
1674 }
1675 return traitNewZone.GetExitPos();
1676 }
1677 }
1678 foreach (Thing thing6 in map.things)
1679 {
1680 if (thing6.trait is TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1681 {
1682 if (c != null && enterState != ZoneTransition.EnterState.Auto)
1683 {
1684 c.SetDir(traitNewZone2.owner.dir);
1685 }
1686 return traitNewZone2.GetExitPos();
1687 }
1688 }
1689 return GetRandomVisitPos(c);
1690 }
override void SetDir(int d)
Definition: Chara.cs:3828
Point GetLeftPos(float rate=-1f)
Definition: MapBounds.cs:92
Point GetBottomPos(float rate=-1f)
Definition: MapBounds.cs:87
int x
Definition: MapBounds.cs:8
Point GetTopPos(float rate=-1f)
Definition: MapBounds.cs:77
Point GetRightPos(float rate=-1f)
Definition: MapBounds.cs:82
int embarkY
Definition: MapConfig.cs:89
int embarkX
Definition: MapConfig.cs:86
Point lastZonePos
Definition: Player.cs:1182
Thing Find(int uid)
Definition: Props.cs:395
int mapX
Definition: Spatial.cs:460
int lv
Definition: Spatial.cs:142
int mapY
Definition: Spatial.cs:472
virtual bool IsFor(Zone z)
string GetParam(int i, string def=null)
Definition: Trait.cs:593
EnterState state
virtual ZoneTransition.EnterState RegionEnterState
Definition: Zone.cs:180
Point GetRandomVisitPos(Chara c)
Definition: Zone.cs:1692
Zone GetZoneAt(int _x, int _y)
Definition: Zone.cs:3831

References EClass._map, Map.bounds, Map.config, Debug, MapConfig.embarkX, MapConfig.embarkY, Point.Equals(), Props.Find(), EClass.game, MapBounds.GetBottomPos(), MapBounds.GetCenterPos(), MapBounds.GetLeftPos(), Point.GetNearestPoint(), Trait.GetParam(), MapBounds.GetRightPos(), MapBounds.GetTopPos(), GetTopZone(), Chara.global, TraitTeleporter.id, ZoneTransition.idTele, PropsManager.installed, TraitNewZone.IsFor(), Card.IsInstalled, Chara.IsPC, Spatial.IsRegion, Game.IsSurvival, Point.IsValid, ZoneTransition.lastZone, Player.lastZonePos, Spatial.lv, Spatial.mapX, Spatial.mapY, EClass.player, Card.pos, Map.props, ZoneTransition.ratePos, Chara.SetDir(), Player.simulatingZone, ZoneTransition.state, Map.things, Card.trait, Props.traits, GlobalData.transition, Spatial.uid, MapBounds.x, Spatial.x, ZoneTransition.x, Spatial.y, ZoneTransition.z, and TraitNewZone.zone.

Referenced by Chara.MoveZone(), and Zone_Town.OnRegenerate().

◆ GetSpawnPos() [2/2]

Point Zone.GetSpawnPos ( SpawnPosition  type,
int  tries = 100 
)
inline

Definition at line 2945 of file Zone.cs.

2946 {
2947 Point point = new Point();
2948 for (int i = 0; i < tries; i++)
2949 {
2950 point = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2951 if (!point.IsValid || point.cell.hasDoor || point.IsSync)
2952 {
2953 continue;
2954 }
2955 switch (type)
2956 {
2957 case SpawnPosition.Guest:
2958 {
2959 List<TraitSpotGuest> list = EClass._map.props.installed.traits.List<TraitSpotGuest>();
2960 if (list.Count > 0)
2961 {
2962 list.Shuffle();
2963 foreach (TraitSpotGuest item in list)
2964 {
2965 List<Point> list2 = item.ListPoints(null, onlyPassable: true, allowChara: false);
2966 if (list2.Count > 0)
2967 {
2968 return list2.RandomItem();
2969 }
2970 }
2971 }
2972 Room room = point.cell.room;
2973 if (room != null && room.data.accessType != BaseArea.AccessType.Public)
2974 {
2975 continue;
2976 }
2977 break;
2978 }
2979 case SpawnPosition.Outside:
2980 if (point.cell.HasRoof || point.cell.light > 0)
2981 {
2982 continue;
2983 }
2984 break;
2985 }
2986 return point;
2987 }
2988 return null;
2989 }
SpawnPosition
Definition: SpawnPosition.cs:2
BaseArea.AccessType accessType
Definition: AreaData.cs:42
AccessType
Definition: BaseArea.cs:9
Room room
Definition: Cell.cs:122
byte light
Definition: Cell.cs:80
bool HasRoof
Definition: Cell.cs:684
bool hasDoor
Definition: Cell.cs:279
bool IsSync
Definition: Point.cs:340

References EClass._map, AreaData.accessType, Map.bounds, Point.cell, BaseArea.data, MapBounds.GetRandomSurface(), Cell.hasDoor, Cell.HasRoof, PropsManager.installed, Point.IsSync, Point.IsValid, item, Cell.light, Map.props, Cell.room, and Props.traits.

◆ GetTopZone()

◆ GetZoneAt()

Zone Zone.GetZoneAt ( int  _x,
int  _y 
)
inline

Definition at line 3831 of file Zone.cs.

3832 {
3833 if (IsRegion)
3834 {
3835 foreach (Spatial child in children)
3836 {
3837 if (!(child is Zone_Field) && _x == child.x && _y == child.y)
3838 {
3839 return child as Zone;
3840 }
3841 }
3842 }
3843 foreach (Spatial child2 in children)
3844 {
3845 if (_x == child2.x && _y == child2.y)
3846 {
3847 return child2 as Zone;
3848 }
3849 }
3850 return null;
3851 }

References Spatial.x, and Spatial.y.

Referenced by Player.EnterLocalZone(), and RegionPoint.SetRegionPoint().

◆ GrowPlants()

void Zone.GrowPlants ( VirtualDate  date)
inline

Definition at line 3724 of file Zone.cs.

3725 {
3726 bool num = (EClass.player.isAutoFarming = IsPCFaction && EClass.Branch.policies.IsActive(2707));
3727 int weedChance = 1;
3729 {
3730 weedChance += (EClass.debug.enable ? 100000 : 20) + EClass.Branch.Evalue(2703) * 10;
3731 }
3732 if (date.sunMap == null)
3733 {
3734 date.BuildSunMap();
3735 }
3736 if (num)
3737 {
3738 HashSet<int> hashSet = new HashSet<int>();
3739 foreach (Thing thing in EClass._map.things)
3740 {
3741 if (!thing.IsInstalled || !(thing.trait is TraitSpotFarm traitSpotFarm))
3742 {
3743 continue;
3744 }
3745 foreach (Point item in traitSpotFarm.ListPoints(null, onlyPassable: false))
3746 {
3747 hashSet.Add(item.index);
3748 }
3749 }
3750 Perform(hashSet);
3751 EClass.player.isAutoFarming = false;
3752 Perform(hashSet);
3753 }
3754 else
3755 {
3756 Perform(null);
3757 }
3758 void Perform(HashSet<int> farmMap)
3759 {
3760 bool isWinter = date.IsWinter;
3761 EClass._map.bounds.ForeachCell(delegate(Cell c)
3762 {
3763 if (farmMap != null)
3764 {
3766 {
3767 if (!farmMap.Contains(c.index))
3768 {
3769 return;
3770 }
3771 }
3772 else if (farmMap.Contains(c.index))
3773 {
3774 return;
3775 }
3776 }
3777 if (c.decal != 0 && EClass.rnd(3) == 0)
3778 {
3779 c.decal = 0;
3780 }
3781 if (GrowPlant)
3782 {
3783 if (c.growth != null)
3784 {
3785 bool flag = false;
3786 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3787 {
3788 flag = true;
3789 }
3790 PlantData plantData = map.TryGetPlant(c);
3791 if (!flag && (plantData == null || plantData.fert >= 0))
3792 {
3793 c.TryGrow(date);
3794 }
3795 if (isWinter && plantData != null && c.growth != null && c.growth.NeedSunlight && plantData.fert >= 0 && (EClass.rnd(4) == 0 || c.growth.stage.idx == 0))
3796 {
3797 if (date.sunMap == null)
3798 {
3799 date.BuildSunMap();
3800 }
3801 if (!date.sunMap.Contains(c.index) && !c.growth.CanGrow(date))
3802 {
3803 c.growth.Perish();
3804 }
3805 }
3806 }
3807 else if (c.detail != null)
3808 {
3809 c.Things.ForeachReverse(delegate(Thing t)
3810 {
3811 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3812 {
3813 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3814 }
3815 });
3816 }
3817 else if (EClass.rnd(20) == 0 && GrowWeed && c.CanGrowWeed && EClass.rnd(weedChance) == 0)
3818 {
3819 biome.Populate(c.GetPoint());
3820 if (c.growth != null)
3821 {
3822 c.growth.SetStage(0);
3823 }
3824 }
3825 }
3826 c.isWatered = false;
3827 });
3828 }
3829 }
void Populate(Point point, bool interior=false, float mtpDensity=1f)
byte decal
Definition: Cell.cs:70
CellDetail detail
Definition: Cell.cs:112
Point GetPoint()
Definition: Cell.cs:1141
bool CanGrowWeed
Definition: Cell.cs:778
int index
Definition: Cell.cs:136
bool IsWinter
Definition: Date.cs:192
int Evalue(int ele)
PolicyManager policies
Stage stage
Definition: GrowSystem.cs:115
virtual bool NeedSunlight
Definition: GrowSystem.cs:107
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:292
PlantData TryGetPlant(Point p)
Definition: Map.cs:2106
bool isAutoFarming
Definition: Player.cs:1263
bool IsActive(int id, int days=-1)
void BuildSunMap()
Definition: VirtualDate.cs:54
HashSet< int > sunMap
Definition: VirtualDate.cs:9
virtual bool GrowWeed
Definition: Zone.cs:356
virtual bool GrowPlant
Definition: Zone.cs:354

References EClass._map, Map.bounds, EClass.Branch, VirtualDate.BuildSunMap(), GrowSystem.CanGrow(), Cell.decal, FactionBranch.Evalue(), MapBounds.ForeachCell(), Cell.growth, GrowSystem.Stage.idx, if(), Cell.index, PolicyManager.IsActive(), Player.isAutoFarming, Card.IsInstalled, Date.IsWinter, item, GrowSystem.NeedSunlight, EClass.player, FactionBranch.policies, EClass.rnd(), GrowSystem.stage, VirtualDate.sunMap, Map.things, Card.trait, and Map.TryGetPlant().

◆ HasField()

bool Zone.HasField ( int  idEle)
inline

Definition at line 3180 of file Zone.cs.

3181 {
3182 return fieldElements.Has(idEle);
3183 }
bool Has(int ele)
ElementContainerField fieldElements
Definition: Zone.cs:49

References ElementContainer.Has().

Referenced by ActPlan._Update(), ConIncognito.OnRemoved(), ConIncognito.OnStart(), FoodEffect.Proc(), ActEffect.ProcAt(), AI_Eat.Run(), Card.SpawnLoot(), and GoalCombat.TryUseAbility().

◆ Import()

ZoneExportData Zone.Import ( string  path)
inline

Definition at line 3471 of file Zone.cs.

3472 {
3473 ZipFile zipFile = ZipFile.Read(path);
3474 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3475 zipFile.ExtractAll(pathTemp);
3476 zipFile.Dispose();
3477 return IO.LoadFile<ZoneExportData>(pathTemp + "export") ?? new ZoneExportData();
3478 }

Referenced by Activate(), and PartialMap.Load().

◆ ImportDialog()

void Zone.ImportDialog ( string  dir = null)
inline

Definition at line 3534 of file Zone.cs.

3535 {
3537 {
3538 string[] array = StandaloneFileBrowser.OpenFilePanel("Import Zone", dir ?? CorePath.ZoneSave, "z", multiselect: false);
3539 if (array.Length != 0)
3540 {
3541 Zone_User zone_User = SpatialGen.Create("user", EClass.world.region, register: true) as Zone_User;
3542 zone_User.path = array[0];
3543 Thing thing = ThingGen.Create("teleporter");
3544 thing.c_uidZone = zone_User.uid;
3545 EClass._zone.AddCard(thing, EClass.pc.pos);
3546 }
3547 });
3548 }
static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect)

References EClass.core, if(), SFB.StandaloneFileBrowser.OpenFilePanel(), BaseCore.WaitForEndOfFrame(), and CorePath.ZoneSave.

Referenced by CoreDebug.InitDebugCommands().

◆ IsCrime()

bool Zone.IsCrime ( Chara  c,
Act  act 
)
inline

◆ IsImportValid()

static bool Zone.IsImportValid ( string  path)
inlinestatic

Definition at line 3550 of file Zone.cs.

3551 {
3552 try
3553 {
3554 return Map.GetMetaData(path)?.IsValidVersion() ?? false;
3555 }
3556 catch (Exception ex)
3557 {
3558 EClass.ui.Say(ex.Message);
3559 return false;
3560 }
3561 }
bool IsValidVersion()
Definition: MapMetaData.cs:31
static MapMetaData GetMetaData(string pathZip)
Definition: Map.cs:853

References Map.GetMetaData(), MapMetaData.IsValidVersion(), and EClass.ui.

Referenced by TraitMoongate.UseMoongate().

◆ ListLandFeats()

List< Element > Zone.ListLandFeats ( )
inline

Definition at line 3416 of file Zone.cs.

3417 {
3418 if (landFeats == null)
3419 {
3420 landFeats = new List<int>();
3422 string[] listBase = IDBaseLandFeat.Split(',');
3423 string[] array = listBase;
3424 foreach (string text in array)
3425 {
3426 if (!text.IsEmpty())
3427 {
3428 landFeats.Add(EClass.sources.elements.alias[text].id);
3429 }
3430 }
3431 if (listBase.Length == 1)
3432 {
3433 List<SourceElement.Row> list = EClass.sources.elements.rows.Where(delegate(SourceElement.Row e)
3434 {
3435 if (e.category != "landfeat" || e.chance == 0)
3436 {
3437 return false;
3438 }
3439 bool flag = true;
3440 string[] tag = e.tag;
3441 foreach (string text2 in tag)
3442 {
3443 if (text2.StartsWith("bf"))
3444 {
3445 flag = false;
3446 if (listBase[0] == text2)
3447 {
3448 flag = true;
3449 break;
3450 }
3451 }
3452 }
3453 return flag ? true : false;
3454 }).ToList();
3455 SourceElement.Row row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3456 landFeats.Add(row.id);
3457 list.Remove(row);
3458 row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3459 landFeats.Add(row.id);
3460 }
3461 Rand.SetSeed();
3462 }
3463 List<Element> list2 = new List<Element>();
3464 foreach (int landFeat in landFeats)
3465 {
3466 list2.Add(Element.Create(landFeat, 1));
3467 }
3468 return list2;
3469 }
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1163
virtual string IDBaseLandFeat
Definition: Zone.cs:154
List< int > landFeats
Definition: Zone.cs:61

References EClass._zone, SourceManager.elements, SourceElement.Row.id, Rand.SetSeed(), EClass.sources, and Spatial.uid.

Referenced by WidgetDate._Refresh(), FactionBranch.OnClaimZone(), FactionBranch.OnUnclaimZone(), UIFactionInfo.SetZone(), and FactionBranch.Upgrade().

◆ ListMinions()

List< Chara > Zone.ListMinions ( Chara  c)
inline

Definition at line 4027 of file Zone.cs.

4028 {
4029 List<Chara> list = new List<Chara>();
4030 foreach (Chara chara in EClass._map.charas)
4031 {
4032 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
4033 {
4034 list.Add(chara);
4035 }
4036 }
4037 return list;
4038 }

References EClass._map, Card.c_minionType, Card.c_uidMaster, Map.charas, and Card.uid.

◆ ModDevelopment()

void Zone.ModDevelopment ( int  a)
inline

Definition at line 3931 of file Zone.cs.

3932 {
3933 base.development += a;
3934 if (a > 0)
3935 {
3936 Msg.Say("gainDevelopment", Name, a.ToString() ?? "");
3937 }
3938 }

References Msg.Say().

◆ ModInfluence()

void Zone.ModInfluence ( int  a)
inline

Definition at line 3921 of file Zone.cs.

3922 {
3923 base.influence += a;
3924 if (a > 0)
3925 {
3926 Msg.Say("gainInfluence", Name, a.ToString() ?? "");
3927 }
3928 Tutorial.Reserve("influence");
3929 }

References Tutorial.Reserve(), and Msg.Say().

Referenced by Card.ModCurrency(), QuestRandom.OnDropReward(), ActEffect.Proc(), and ActThrow.Throw().

◆ OnActivate()

virtual void Zone.OnActivate ( )
inlinevirtual

Reimplemented in Region, Zone_Aquli, Zone_Casino, Zone_DungeonDead, Zone_Exile, Zone_LittleGarden, Zone_LumiestRuin, Zone_Mifu, Zone_Nefu, Zone_Olvina, Zone_SisterHouse, Zone_Specwing, Zone_User, and Zone_Void.

Definition at line 1260 of file Zone.cs.

1261 {
1262 if (!(id == "startVillage2"))
1263 {
1264 return;
1265 }
1266 if (EClass._map.version.IsBelow(0, 23, 226))
1267 {
1268 SetBGM(121, refresh: false);
1269 }
1270 int num = 0;
1271 foreach (Chara chara in EClass._map.charas)
1272 {
1273 if (chara.id == "cat_silver" && !chara.IsPCFaction)
1274 {
1275 num++;
1276 }
1277 }
1278 if (num > 0)
1279 {
1280 Msg.Say("num_silvercat", num.ToString() ?? "");
1281 }
1282 }
override bool IsPCFaction
Definition: Chara.cs:691
Version version
Definition: Map.cs:31
bool IsBelow(int _major, int _minor, int _batch)
Definition: Version.cs:49

References EClass._map, Map.charas, Card.id, Version.IsBelow(), Chara.IsPCFaction, Msg.Say(), and Map.version.

◆ OnAdvanceHour()

virtual void Zone.OnAdvanceHour ( )
inlinevirtual

Reimplemented in Region.

Definition at line 1304 of file Zone.cs.

1305 {
1306 }

Referenced by GameDate.AdvanceHour().

◆ OnAfterCreate()

override void Zone.OnAfterCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 624 of file Zone.cs.

625 {
626 if (AddPrefix)
627 {
628 if (GetTopZone() == this)
629 {
630 base.idPrefix = EClass.sources.zoneAffixes.rows.RandomItem().id;
631 }
632 else
633 {
634 base.idPrefix = GetTopZone().idPrefix;
635 }
636 }
637 }
SourceZoneAffix zoneAffixes
int idPrefix
Definition: Spatial.cs:130
virtual bool AddPrefix
Definition: Zone.cs:290

References AddPrefix, GetTopZone(), Spatial.idPrefix, EClass.sources, and SourceManager.zoneAffixes.

◆ OnAfterSimulate()

virtual void Zone.OnAfterSimulate ( )
inlinevirtual

Reimplemented in Zone_WindRest.

Definition at line 1300 of file Zone.cs.

1301 {
1302 }

◆ OnBeforeDeactivate()

virtual void Zone.OnBeforeDeactivate ( )
inlinevirtual

Reimplemented in Zone_Tent.

Definition at line 1284 of file Zone.cs.

1285 {
1286 }

◆ OnBeforeSimulate()

virtual void Zone.OnBeforeSimulate ( )
inlinevirtual

Reimplemented in Zone_DungeonPuppy, and Zone_Nymelle.

Definition at line 1292 of file Zone.cs.

1293 {
1294 }

◆ OnChildNumChange()

void Zone.OnChildNumChange ( Card  c)
inline

Implements ICardParent.

Definition at line 2109 of file Zone.cs.

2110 {
2111 }

◆ OnCreate()

override void Zone.OnCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 618 of file Zone.cs.

619 {
620 events.zone = this;
621 base.lv = StartLV;
622 }
virtual int StartLV
Definition: Zone.cs:416

References StartLV.

◆ OnCreateBP()

virtual void Zone.OnCreateBP ( )
inlinevirtual

Reimplemented in Zone_Arena2, and Zone_Harvest.

Definition at line 2556 of file Zone.cs.

2557 {
2558 }

◆ OnDeactivate()

virtual void Zone.OnDeactivate ( )
inlinevirtual

Definition at line 1288 of file Zone.cs.

1289 {
1290 }

◆ OnGenerateMap()

virtual void Zone.OnGenerateMap ( )
inlinevirtual

Reimplemented in Zone_Arena2, Zone_CurryRuinDungeon, Zone_CursedManor, Zone_CursedManorDungeon, Zone_Dungeon, Zone_DungeonDead, Zone_DungeonFairy, Zone_DungeonMino, Zone_DungeonPuppy, Zone_Field, Zone_Harvest, Zone_OldKeepDungeon, Zone_RandomDungeon, Zone_RandomDungeonFactory, Zone_SnowGrave, Zone_StartSite, Zone_TestRoom, Zone_UnderseaTemple, Zone_VernisMine, Zone_Void, and Zone_WindRest.

Definition at line 2778 of file Zone.cs.

2779 {
2781 {
2782 foreach (Chara chara in EClass._map.charas)
2783 {
2784 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral && chara.OriginalHostility < Hostility.Friend)
2785 {
2786 Hostility hostility = (chara.c_originalHostility = Hostility.Neutral);
2787 chara.hostility = hostility;
2788 }
2789 }
2790 }
2791 if (PrespawnRate != 0f && !IsSkyLevel)
2792 {
2793 for (int i = 0; i < (int)((float)MaxSpawn * PrespawnRate); i++)
2794 {
2795 SpawnMob();
2796 }
2797 }
2802 }
Hostility
Definition: Hostility.cs:2
Hostility OriginalHostility
Definition: Chara.cs:477
Hostility hostility
Definition: Chara.cs:297
virtual float PrespawnRate
Definition: Zone.cs:334
virtual int MaxSpawn
Definition: Zone.cs:320
virtual bool IsSkyLevel
Definition: Zone.cs:274
Chara TryGenerateEvolved(bool force=false, Point p=null)
Definition: Zone.cs:2831
void TryGenerateShrine()
Definition: Zone.cs:2888
void TryGenerateOre()
Definition: Zone.cs:2804
virtual bool MakeEnemiesNeutral
Definition: Zone.cs:241
void TryGenerateBigDaddy()
Definition: Zone.cs:2851

References EClass._map, Map.charas, Chara.hostility, Chara.IsGlobal, and Chara.OriginalHostility.

Referenced by Activate().

◆ OnGenerateRooms()

virtual void Zone.OnGenerateRooms ( BaseMapGen  gen)
inlinevirtual

Reimplemented in Zone_CaveMonster, and Zone_SubTown.

Definition at line 2941 of file Zone.cs.

2942 {
2943 }

Referenced by MapGenDungen.OnGenerateTerrain().

◆ OnInspect()

void Zone.OnInspect ( )
inline

Implements IInspect.

Definition at line 3576 of file Zone.cs.

3577 {
3578 }

◆ OnKillGame()

void Zone.OnKillGame ( )
inline

Definition at line 1866 of file Zone.cs.

1867 {
1868 foreach (Thing thing in map.things)
1869 {
1870 if (thing.renderer.hasActor)
1871 {
1872 thing.renderer.KillActor();
1873 }
1874 }
1875 }
void KillActor()
CardRenderer renderer
Definition: Card.cs:64

References CardRenderer.hasActor, CardRenderer.KillActor(), Card.renderer, and Map.things.

Referenced by Game.Kill().

◆ OnLoad()

override void Zone.OnLoad ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 2059 of file Zone.cs.

2060 {
2061 if (branch != null)
2062 {
2063 branch.SetOwner(this);
2064 }
2065 events.OnLoad(this);
2066 }
void SetOwner(Zone zone)
void OnLoad(Zone _zone)

References ZoneEventManager.OnLoad(), and FactionBranch.SetOwner().

◆ OnRegenerate()

virtual void Zone.OnRegenerate ( )
inlinevirtual

Reimplemented in Zone_LittleGarden, and Zone_Town.

Definition at line 1256 of file Zone.cs.

1257 {
1258 }

◆ OnSimulateDay()

void Zone.OnSimulateDay ( VirtualDate  date)
inline

Definition at line 3689 of file Zone.cs.

3690 {
3691 if (base.IsPlayerFaction)
3692 {
3693 branch.OnSimulateDay(date);
3694 }
3695 }
void OnSimulateDay(VirtualDate date)

References FactionBranch.OnSimulateDay().

Referenced by VirtualDate.SimulateDay().

◆ OnSimulateHour()

void Zone.OnSimulateHour ( VirtualDate  date)
inline

Definition at line 3634 of file Zone.cs.

3635 {
3636 if (base.IsPlayerFaction)
3637 {
3638 branch.OnSimulateHour(date);
3639 }
3641 if (date.IsRealTime)
3642 {
3643 foreach (Thing thing in EClass._map.things)
3644 {
3645 if (thing.IsInstalled)
3646 {
3647 thing.trait.TryToggle();
3648 }
3649 }
3651 }
3652 EClass._map.things.ForeachReverse(delegate(Thing t)
3653 {
3654 t.OnSimulateHour(date);
3655 });
3656 foreach (Thing sucker in Suckers)
3657 {
3658 sucker.Destroy();
3659 }
3660 Suckers.Clear();
3661 if (RespawnRate != 0f)
3662 {
3663 int num = 0;
3664 foreach (Chara chara in map.charas)
3665 {
3666 if (!chara.IsGlobal)
3667 {
3668 num++;
3669 }
3670 }
3671 if (num < MaxRespawn)
3672 {
3673 for (int num2 = 0; num2 < RespawnPerHour; num2++)
3674 {
3675 SpawnMob();
3676 }
3677 }
3678 }
3679 if (!date.IsRealTime && EClass.rnd(24) == 0)
3680 {
3681 RainWater();
3682 }
3683 if (date.hour == 6)
3684 {
3685 GrowPlants(date);
3686 }
3687 }
virtual void OnSimulateHour(VirtualDate date)
Definition: Card.cs:7094
void DecayNatural(int hour=1)
Definition: Card.cs:7103
int hour
Definition: Date.cs:74
void OnSimulateHour(VirtualDate date)
virtual void TryToggle()
Definition: Trait.cs:1341
bool IsRealTime
Definition: VirtualDate.cs:7
virtual int RespawnPerHour
Definition: Zone.cs:350
virtual float RespawnRate
Definition: Zone.cs:336
static List< Thing > Suckers
Definition: Zone.cs:86
void GrowPlants(VirtualDate date)
Definition: Zone.cs:3724
int MaxRespawn
Definition: Zone.cs:322

References EClass._map, Map.charas, Card.DecayNatural(), Card.Destroy(), Chara.IsGlobal, Card.IsInstalled, VirtualDate.IsRealTime, ZoneEventManager.OnSimulateHour(), Card.OnSimulateHour(), FactionBranch.OnSimulateHour(), EClass.pc, EClass.rnd(), Map.things, Card.trait, and Trait.TryToggle().

Referenced by VirtualDate.SimulateHour().

◆ OnSimulateMonth()

void Zone.OnSimulateMonth ( VirtualDate  date)
inline

Definition at line 3697 of file Zone.cs.

3698 {
3699 if (base.IsPlayerFaction)
3700 {
3701 branch.OnSimulateMonth(date);
3702 }
3703 if (date.IsRealTime)
3704 {
3706 }
3707 }
void OnSimulateMonth(VirtualDate date)

References EClass._map, VirtualDate.IsRealTime, FactionBranch.OnSimulateMonth(), and Map.RefreshAllTiles().

Referenced by VirtualDate.SimulateMonth().

◆ OnVisit()

void Zone.OnVisit ( )
inline

Definition at line 1149 of file Zone.cs.

1150 {
1151 if (EClass.world.date.IsExpired(base.dateRevive))
1152 {
1154 Revive();
1155 List<Chara> list = new List<Chara>();
1156 foreach (Chara chara in EClass._map.charas)
1157 {
1158 chara.TryRestock(onCreate: false);
1159 if (!chara.IsPCFaction)
1160 {
1161 chara.c_fur = 0;
1162 }
1163 if (chara.IsMinion && chara.master != null && !chara.master.IsPCParty)
1164 {
1165 list.Add(chara);
1166 }
1167 }
1168 foreach (Chara item in list)
1169 {
1170 item.Destroy();
1171 }
1172 }
1173 if (!EClass.game.isLoading)
1174 {
1176 }
1179 events.OnVisit();
1180 OnActivate();
1181 UpdateQuests();
1183 isSimulating = true;
1184 try
1185 {
1186 Simulate();
1187 }
1188 catch (Exception exception)
1189 {
1190 Debug.LogException(exception);
1191 }
1192 finally
1193 {
1194 isSimulating = false;
1195 }
1198 base.lastActive = EClass.world.date.GetRaw();
1199 if (!EClass.game.isLoading)
1200 {
1201 base.visitCount++;
1202 }
1203 base.version = EClass.core.version.GetInt();
1204 if (HasField(10000))
1205 {
1206 Tutorial.Reserve("field");
1207 }
1208 }
Version version
Definition: BaseCore.cs:17
void TryRestock(bool onCreate)
Definition: Chara.cs:5030
void OnAfterSimulate()
void AssignCharas()
Definition: RoomManager.cs:39
void Revive()
Definition: Zone.cs:1221
void RefreshDeathSentense()
Definition: Zone.cs:1210
void Simulate()
Definition: Zone.cs:1308
virtual void OnAfterSimulate()
Definition: Zone.cs:1300
void RefreshCriminal()
Definition: Zone.cs:3862
bool HasField(int idEle)
Definition: Zone.cs:3180
virtual void OnBeforeSimulate()
Definition: Zone.cs:1292
virtual void OnActivate()
Definition: Zone.cs:1260
void ResetHostility()
Definition: Zone.cs:2925
void UpdateQuests(bool force=false)
Definition: Zone.cs:3940
int GetInt()
Definition: Version.cs:39

References EClass._map, RoomManager.AssignCharas(), EClass.Branch, Map.charas, EClass.core, World.date, Debug, EClass.game, Version.GetInt(), Date.GetRaw(), Date.IsExpired(), Game.isLoading, Chara.IsMinion, Chara.IsPCFaction, Chara.IsPCParty, item, Chara.master, FactionBranch.OnAfterSimulate(), ZoneEventManager.OnVisit(), Tutorial.Reserve(), Revive, Map.rooms, Chara.TryRestock(), BaseCore.version, and EClass.world.

◆ OnVisitNewMapOrRegenerate()

virtual void Zone.OnVisitNewMapOrRegenerate ( )
inlinevirtual

Reimplemented in Zone_Aquli, and Zone_Yowyn.

Definition at line 1296 of file Zone.cs.

1297 {
1298 }

◆ ParseZoneFullName()

static string string int zoneLv Zone.ParseZoneFullName ( string  zoneFullName)
inlinestatic

Definition at line 555 of file Zone.cs.

556 {
557 int item = 0;
558 zoneFullName = zoneFullName.Replace('/', '@');
559 int num = zoneFullName.LastIndexOf('@');
560 string text;
561 if (num > 0 && num < zoneFullName.Length - 1)
562 {
563 text = zoneFullName[..num];
564 item = zoneFullName[(num + 1)..].ToInt();
565 }
566 else
567 {
568 text = zoneFullName.Replace("@", "");
569 }
570 string text2 = text.Replace("Zone_", "");
571 text = "Zone_" + text2;
572 return (zoneType: text, zoneId: text2, zoneLv: item);
573 }
static string zoneType
Definition: Zone.cs:555
static string string zoneId
Definition: Zone.cs:555

References item, zoneId, and zoneType.

◆ RainWater()

void Zone.RainWater ( )
inline

Definition at line 3709 of file Zone.cs.

3710 {
3712 {
3713 return;
3714 }
3715 EClass._map.bounds.ForeachCell(delegate(Cell c)
3716 {
3717 if (c.IsFarmField && !c.HasRoof)
3718 {
3719 c.isWatered = true;
3720 }
3721 });
3722 }
bool IsFarmField
Definition: Cell.cs:766
bool IsIndoor
Definition: Map.cs:139

References EClass._map, Map.bounds, MapBounds.ForeachCell(), Cell.HasRoof, Cell.IsFarmField, and Map.IsIndoor.

Referenced by Weather.SetCondition().

◆ RefreshBGM()

void Zone.RefreshBGM ( )
inline

Definition at line 3324 of file Zone.cs.

3325 {
3327 {
3328 return;
3329 }
3331 Playlist playlist = map.plDay;
3332 foreach (ZoneEvent item in events.list)
3333 {
3334 if (item.playlist != null)
3335 {
3336 playlist = item.playlist;
3337 }
3338 }
3339 if (IDPlaylistOverwrite != null)
3340 {
3341 playlist = EClass.Sound.GetPlaylist(IDPlaylistOverwrite);
3342 }
3344 {
3345 Room room = EClass.pc.pos.cell.room;
3346 if (room != null && room.lot != null && room.lot.idBGM != 0)
3347 {
3348 playlist = EClass.Sound.plLot;
3349 if (playlist.list[0].data?.id != room.lot.idBGM)
3350 {
3351 playlist.list[0].data = EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM);
3352 playlist.Reset();
3353 if (!LayerDrama.keepBGM)
3354 {
3355 EClass.Sound.StopBGM(1f);
3356 }
3357 }
3358 }
3359 }
3361 EClass.Sound.SwitchPlaylist(playlist, !LayerDrama.keepBGM);
3362 }
bool IsInActiveZone
Definition: Chara.cs:894
void SetBGMInterval()
Definition: CoreConfig.cs:1039
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:388
CoreRef refs
Definition: Core.cs:51
static bool keepBGM
Definition: LayerDrama.cs:10
int idBGM
Definition: Lot.cs:16
Playlist plDay
Definition: Map.cs:83
Lot lot
Definition: Room.cs:21
List< ZoneEvent > list
virtual string IDPlaylistOverwrite
Definition: Zone.cs:150

References Point.cell, Core.config, EClass.core, CoreRef.dictBGM, Lot.idBGM, Chara.IsInActiveZone, item, LayerDrama.keepBGM, ZoneEventManager.list, Room.lot, EClass.pc, EClass.player, Map.plDay, Card.pos, Core.refs, Cell.room, CoreConfig.SetBGMInterval(), Player.simulatingZone, and EClass.Sound.

Referenced by BuildMenu.Deactivate(), BaseTileMap.Draw(), TileMapElona.Draw(), LayerNewZone.Embark(), ELayer.Kill(), ZoneEventSiege.OnInit(), LayerEditPlaylist.OnKill(), ZoneEventSiege.OnKill(), and ZoneEventSiege.OnVisit().

◆ RefreshCriminal()

void Zone.RefreshCriminal ( )
inline

Definition at line 3862 of file Zone.cs.

3863 {
3864 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3865 Hostility hostility = (flag ? Hostility.Neutral : Hostility.Friend);
3866 foreach (Chara chara in EClass._map.charas)
3867 {
3868 if (chara.trait is TraitGuard)
3869 {
3870 chara.hostility = hostility;
3871 if (!flag && chara.enemy != null && chara.enemy.IsPCParty)
3872 {
3873 chara.SetEnemy();
3874 }
3875 }
3876 }
3877 }
Chara enemy
Definition: Chara.cs:88
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6767
virtual bool AllowCriminal
Definition: Zone.cs:254

References EClass._map, Map.charas, Chara.enemy, Chara.IsPCParty, Chara.SetEnemy(), and Chara.trait.

Referenced by Player.ModKarma(), ConIncognito.OnRemoved(), and ConIncognito.OnStart().

◆ RefreshDeathSentense()

void Zone.RefreshDeathSentense ( )
inline

Definition at line 1210 of file Zone.cs.

1211 {
1212 foreach (Chara chara in EClass._map.charas)
1213 {
1214 if (chara.HasCondition<ConDeathSentense>())
1215 {
1216 chara.GetCondition<ConDeathSentense>().TryRemove();
1217 }
1218 }
1219 }
BaseCondition GetCondition(string idCon)
Definition: Chara.cs:10197
bool HasCondition(string alias)
Definition: Chara.cs:10141

References EClass._map, Map.charas, Chara.GetCondition(), and Chara.HasCondition().

Referenced by Chara.Die().

◆ RefreshElectricity()

void Zone.RefreshElectricity ( )
inline

Definition at line 3195 of file Zone.cs.

3196 {
3197 dirtyElectricity = false;
3198 bool flag = GetSoilCost() > MaxSoil;
3199 base.electricity = elements.Value(2201) * 10 + BaseElectricity;
3200 foreach (Thing thing in EClass._map.things)
3201 {
3202 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
3203 {
3204 base.electricity += thing.trait.Electricity;
3205 }
3206 }
3207 if (!flag)
3208 {
3209 EClass._map.bounds.ForeachCell(delegate(Cell c)
3210 {
3211 if (c.sourceObj.id == 118 && c.growth.IsMature)
3212 {
3213 base.electricity += 20;
3214 }
3215 });
3216 }
3217 foreach (Thing thing2 in EClass._map.things)
3218 {
3219 if (thing2.IsInstalled)
3220 {
3221 thing2.trait.TryToggle();
3222 }
3223 }
3224 }
bool isOn
Definition: Card.cs:545
bool dirtyElectricity
Definition: Zone.cs:74

References EClass._map, Map.bounds, Trait.Electricity, MapBounds.ForeachCell(), Cell.growth, Card.IsInstalled, GrowSystem.IsMature, Card.isOn, Cell.sourceObj, Map.things, Card.trait, Trait.TryToggle(), and ElementContainer.Value().

Referenced by TraitLeverBreaker.OnToggle(), Scene.OnUpdate(), TraitGenerator.Recover(), UIHomeInfo.Refresh(), and TraitGenerator.ShortOut().

◆ RefreshHat()

void Zone.RefreshHat ( )
inline

Definition at line 1139 of file Zone.cs.

1140 {
1141 if (idHat != null && EClass.world.date.IsExpired(base.dateHat))
1142 {
1143 idHat = null;
1144 base.dateHat = 0;
1145 }
1146 sourceHat = ((idHat != null) ? EClass.sources.cards.map[idHat] : ((IDHat != null) ? EClass.sources.cards.map[IDHat] : null));
1147 }
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceCard cards
string idHat
Definition: Spatial.cs:31
virtual string IDHat
Definition: Zone.cs:152
static CardRow sourceHat
Definition: Zone.cs:29

References SourceManager.cards, World.date, Date.IsExpired(), SourceCard.map, EClass.sources, and EClass.world.

Referenced by TraitHat.OnUse().

◆ RefreshListCitizen()

void Zone.RefreshListCitizen ( )
inline

Definition at line 3879 of file Zone.cs.

3880 {
3881 if (base.lv != 0)
3882 {
3883 return;
3884 }
3885 dictCitizen.Clear();
3886 foreach (Chara item in map.charas.Concat(map.deadCharas))
3887 {
3888 if (item.trait.IsCitizen && !item.IsGlobal && !item.isSubsetCard)
3889 {
3890 dictCitizen[item.uid] = item.Name;
3891 }
3892 }
3893 }
Dictionary< int, string > dictCitizen
Definition: Zone.cs:55

References Map.charas, Map.deadCharas, and item.

Referenced by Chara.MakeAlly().

◆ RefreshPlaylist()

void Zone.RefreshPlaylist ( )
inline

Definition at line 3307 of file Zone.cs.

3308 {
3309 if (map.plDay == null)
3310 {
3311 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList));
3312 }
3313 map.plDay.shuffle = EClass._map.config.shufflePL;
3314 }
bool shufflePL
Definition: MapConfig.cs:50

References EClass._map, Map._plDay, Map.config, Map.plDay, MapConfig.shufflePL, and EClass.Sound.

Referenced by ClaimZone(), and LayerEditPlaylist.OnKill().

◆ RemoveCard()

void Zone.RemoveCard ( Card  t)
inline

Implements ICardParent.

Definition at line 2202 of file Zone.cs.

2203 {
2204 if (IsActiveZone)
2205 {
2207 }
2208 t.parent = null;
2209 if (t.isChara)
2210 {
2211 t.Chara.currentZone = null;
2212 }
2213 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
2214 {
2216 }
2217 if (t.renderer.hasActor)
2218 {
2220 }
2221 }
override void OnLeaveScreen()
virtual bool isChara
Definition: Card.cs:2147
void OnCardRemovedFromZone(Card t)
Definition: Map.cs:940
void RemoveActorEx(Card c)
Definition: Scene.cs:1033
virtual string IDActorEx
Definition: Trait.cs:187

References CardRenderer.hasActor, Trait.IDActorEx, Card.isChara, Card.isThing, Map.OnCardRemovedFromZone(), CardRenderer.OnLeaveScreen(), Scene.RemoveActorEx(), Card.renderer, EClass.scene, and Card.trait.

Referenced by Activate(), Faction.AddReserve(), Chara.MoveZone(), Map.OnDeactivate(), TaskMoveInstalled.OnProgressComplete(), Map.ReloadRoom(), Simulate(), ActThrow.Throw(), Chara.Tick(), and CoreDebug.UpdateInput().

◆ RemoveFieldEffect()

void Zone.RemoveFieldEffect ( int  idEle)
inline

Definition at line 3190 of file Zone.cs.

3191 {
3192 fieldElements.Remove(idEle);
3193 }
void Remove(int id)

References ElementContainer.Remove().

Referenced by GameDate.AdvanceMin().

◆ ResetHostility()

void Zone.ResetHostility ( )
inline

Definition at line 2925 of file Zone.cs.

2926 {
2927 foreach (Chara chara in EClass._map.charas)
2928 {
2929 if (!chara.source.hostility.IsEmpty() && chara.source.hostility.ToEnum<Hostility>() >= Hostility.Friend && !chara.IsPCFactionOrMinion && !chara.isSummon && (EClass._zone is Zone_Civilized || EClass._zone.IsPCFactionOrTent))
2930 {
2931 chara.c_originalHostility = (Hostility)0;
2932 }
2933 chara.hostility = chara.OriginalHostility;
2934 if (chara.enemy != null && (chara.enemy.IsPCFaction || chara.IsPCFaction) && !chara.IsHostile(chara.enemy))
2935 {
2936 chara.SetEnemy();
2937 }
2938 }
2939 }
bool IsPCFactionOrMinion
Definition: Card.cs:2354
bool isSummon
Definition: Card.cs:713
SourceChara.Row source
Definition: Chara.cs:164
bool IsPCFactionOrTent
Definition: Zone.cs:483

References EClass._map, EClass._zone, Map.charas, Chara.enemy, Chara.IsHostile(), Chara.IsPCFaction, Card.IsPCFactionOrMinion, IsPCFactionOrTent, Card.isSummon, Chara.OriginalHostility, Chara.SetEnemy(), and Chara.source.

Referenced by Chara.Die(), and ConIncognito.OnStart().

◆ ResetPlaylist()

void Zone.ResetPlaylist ( )
inline

Definition at line 3316 of file Zone.cs.

3317 {
3318 map._plDay.Clear();
3319 UnityEngine.Object.DestroyImmediate(map.plDay);
3320 map.plDay = null;
3322 }

References Map._plDay, and Map.plDay.

◆ Revive()

void Zone.Revive ( )
inline

Definition at line 1221 of file Zone.cs.

1222 {
1223 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
1224 if (ShouldAutoRevive)
1225 {
1226 foreach (Chara deadChara in map.deadCharas)
1227 {
1228 if (deadChara.trait.CanAutoRevive && deadChara.CanRevive())
1229 {
1230 deadChara.Revive();
1232 {
1233 deadChara.RemoveBacker();
1234 }
1235 EClass._zone.AddCard(deadChara, (deadChara.orgPos != null && deadChara.orgPos.IsInBounds) ? deadChara.orgPos : deadChara.pos);
1236 }
1237 }
1238 }
1239 foreach (Chara value in EClass.game.cards.globalCharas.Values)
1240 {
1241 if (value.isDead && value.CanRevive() && value.homeZone == this)
1242 {
1243 value.Revive();
1244 Point point = GetSpawnPos(value);
1245 if (value.orgPos != null && value.orgPos.IsInBounds)
1246 {
1247 point = value.orgPos.GetNearestPoint() ?? point;
1248 }
1249 EClass._zone.AddCard(value, point);
1250 }
1251 }
1252 map.deadCharas.Clear();
1253 map.deadCharasShort.Clear();
1254 }
int c_idBacker
Definition: Card.cs:1489
bool CanRevive()
Definition: Chara.cs:5522
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:5548
Zone homeZone
Definition: Chara.cs:273
bool IsInBounds
Definition: Point.cs:100
virtual bool CanAutoRevive
Definition: TraitChara.cs:21
virtual bool ShouldAutoRevive
Definition: Zone.cs:387

References EClass._zone, AddCard(), GameSetting.balance, Card.c_idBacker, TraitChara.CanAutoRevive, Chara.CanRevive(), Game.cards, Core.config, EClass.core, World.date, GameSetting.BalanceSetting.dateRevive, Map.deadCharas, Map.deadCharasShort, Player.doneBackers, EClass.game, Point.GetNearestPoint(), Date.GetRaw(), CardManager.globalCharas, Chara.homeZone, CoreConfig.Test.ignoreBackerDestoryFlag, Card.isBackerContent, Chara.isDead, Point.IsInBounds, Chara.orgPos, EClass.player, Card.pos, Card.RemoveBacker(), Chara.Revive(), EClass.setting, CoreConfig.test, Chara.trait, and EClass.world.

Referenced by Map.ResetEditorPos().

◆ SetAlarm()

virtual void Zone.SetAlarm ( bool  enable)
inlinevirtual

Reimplemented in Zone_CurryRuinDungeon, and Zone_OldKeepDungeon.

Definition at line 3895 of file Zone.cs.

3896 {
3897 base.isAlarmSet = enable;
3898 if (enable)
3899 {
3900 foreach (Chara chara in EClass._map.charas)
3901 {
3902 if (!chara.IsPCFactionOrMinion)
3903 {
3904 chara.SetHostility(Hostility.Enemy);
3905 }
3906 }
3907 Msg.Say("alarm");
3908 Msg.Say("alarm2");
3909 SE.Play("alarm");
3910 return;
3911 }
3912 foreach (Chara chara2 in EClass._map.charas)
3913 {
3914 if (!chara2.IsPCFactionOrMinion)
3915 {
3916 chara2.SetHostility(Hostility.Neutral);
3917 }
3918 }
3919 }
Chara SetHostility(Hostility h)
Definition: Chara.cs:1530

References EClass._map, Map.charas, Card.IsPCFactionOrMinion, Msg.Say(), and Chara.SetHostility().

Referenced by Point.CallGuard(), and GoalCombat.Run().

◆ SetBGM() [1/2]

void Zone.SetBGM ( int  id = -1,
bool  refresh = true,
float  fadeDuration = 0f 
)
inline

Definition at line 3302 of file Zone.cs.

3303 {
3304 SetBGM(new List<int> { id }, refresh, fadeDuration);
3305 }

◆ SetBGM() [2/2]

void Zone.SetBGM ( List< int >  ids,
bool  refresh = true,
float  fadeDuration = 0f 
)
inline

Definition at line 3265 of file Zone.cs.

3266 {
3267 map._plDay.Clear();
3268 if (ids.Count > 0)
3269 {
3270 foreach (int id in ids)
3271 {
3272 if (id != -1)
3273 {
3274 map._plDay.Add(id);
3275 }
3276 }
3277 }
3278 UnityEngine.Object.DestroyImmediate(map.plDay);
3279 map.plDay = null;
3281 if (!refresh)
3282 {
3283 return;
3284 }
3285 if (fadeDuration > 0f)
3286 {
3287 EClass.Sound.StopBGM(fadeDuration, playLastBGM: false, delegate
3288 {
3290 {
3291 RefreshBGM();
3292 }
3293 });
3294 }
3295 else
3296 {
3297 EClass.Sound.StopBGM();
3298 RefreshBGM();
3299 }
3300 }
bool IsGameStarted
Definition: Core.cs:87

References Map._plDay, Game.activeZone, EClass.core, EClass.game, Core.IsGameStarted, Map.plDay, and EClass.Sound.

Referenced by ZoneEventSubdue.CheckClear(), ClaimZone(), ZonePreEnterBout.Execute(), Zone_DungeonDead.OnActivate(), Zone_Nefu.OnActivate(), ZoneEventDefenseGame.OnVisit(), ZoneEventHarvest.OnVisit(), ZoneEventSubdue.OnVisit(), DramaManager.ParseLine(), GoalCombat.Run(), Zone_CurryRuinDungeon.SetAlarm(), Zone_OldKeepDungeon.SetAlarm(), CardRenderer.ShowBossText(), ActThrow.Throw(), and Chara.TryDropBossLoot().

◆ SetFieldEffect()

void Zone.SetFieldEffect ( int  idEle,
int  a,
int  duration = 0 
)
inline

Definition at line 3185 of file Zone.cs.

3186 {
3187 fieldElements.SetBase(idEle, a, duration);
3188 }
Element SetBase(string alias, int v, int potential=0)

References ElementContainer.SetBase().

Referenced by Zone_DungeonDead.OnActivate(), ConIncognito.OnStart(), and ZoneEventWedding.OnVisit().

◆ ShouldScaleImportedChara()

virtual bool Zone.ShouldScaleImportedChara ( Chara  c)
inlinevirtual

Reimplemented in Zone_QuestDungeon.

Definition at line 590 of file Zone.cs.

591 {
592 return false;
593 }

Referenced by SerializedCards.Restore().

◆ Simulate()

void Zone.Simulate ( )
inline

Definition at line 1308 of file Zone.cs.

1309 {
1310 if (!EClass.game.isLoading && base.visitCount > 0)
1311 {
1312 if (Boss != null && IsNefia)
1313 {
1314 Msg.Say("bossLeave", Boss.Name.ToTitleCase(), EClass._zone.Name);
1317 }
1318 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1319 foreach (Chara chara2 in EClass._map.charas)
1320 {
1321 if (chara2.hp < 0)
1322 {
1323 chara2.hp = 0;
1324 }
1325 if (!chara2.IsPCParty)
1326 {
1327 if (chara2.mana.value < 0)
1328 {
1329 chara2.mana.value = 0;
1330 }
1331 if (chara2.stamina.value < 0)
1332 {
1333 chara2.stamina.value = 0;
1334 }
1335 }
1336 if (num > 60)
1337 {
1338 chara2.resistCon = null;
1339 }
1340 if (chara2.rarity >= Rarity.Legendary && !chara2.IsPCFaction && num > 0)
1341 {
1342 Msg.ignoreAll = true;
1343 chara2.Cure(CureType.Boss, 20 + num * 10);
1344 chara2.HealHP((int)((long)Mathf.Max(1, chara2.MaxHP) * (long)Mathf.Min(num, 20) / 20));
1345 chara2.mana.Mod(Mathf.Max(1, chara2.mana.max) * Mathf.Min(num, 20) / 20);
1346 chara2.stamina.Mod(Mathf.Max(1, chara2.stamina.max) * Mathf.Min(num, 20) / 20);
1347 Msg.ignoreAll = false;
1348 }
1349 }
1350 }
1351 Debug.Log("Last Active:" + base.lastActive);
1352 if (base.lastActive == 0 || IsRegion)
1353 {
1354 return;
1355 }
1356 if (pendingSimHours < 0)
1357 {
1358 pendingSimHours = 0;
1359 }
1360 int num2 = GetInt(3);
1361 if (num2 == 0)
1362 {
1364 }
1365 int maxSleepSimHours = EClass.core.config.test.maxSleepSimHours;
1366 int hourSinceLastActive = HourSinceLastActive;
1367 if (hourSinceLastActive <= 1 && pendingSimHours == 0)
1368 {
1369 return;
1370 }
1371 int num3 = hourSinceLastActive + pendingSimHours;
1372 int num4 = ((num2 > 0 && num3 > num2) ? (num3 - num2) : 0);
1373 num3 -= num4;
1374 int num5 = ((EClass.player.simulatingZone && num3 > maxSleepSimHours) ? maxSleepSimHours : num3);
1375 pendingSimHours = num3 - num5;
1376 Debug.Log($"{Name} Simulate/{num5}/{pendingSimHours}/skipped {num4}");
1377 try
1378 {
1379 VirtualDate virtualDate = new VirtualDate(num3);
1380 List<Chara> list = EClass._map.charas.ToList();
1381 int passed = num5 + num4;
1382 int num6 = passed / 24;
1383 if (num6 > 0)
1384 {
1385 foreach (Chara item in list)
1386 {
1387 if (!item.IsPCParty)
1388 {
1389 item.OnSleep(200, num6);
1390 if (item.conSleep != null)
1391 {
1392 item.conSleep.Kill();
1393 }
1394 if (EClass.rnd(EClass.world.date.IsNight ? 20 : 200) == 0 && !item.IsPCFaction && !item.IsGuest())
1395 {
1396 item.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
1397 }
1398 if (item.things.Count > 20)
1399 {
1400 item.ClearInventory(ClearInventoryType.Purge);
1401 }
1402 }
1403 }
1404 }
1405 VirtualDate.current = virtualDate;
1406 int num7 = 0;
1407 for (int i = 0; i < num5; i++)
1408 {
1409 try
1410 {
1411 virtualDate.SimulateHour();
1412 }
1413 catch (Exception exception)
1414 {
1415 if (num7++ == 0)
1416 {
1417 Debug.LogException(exception);
1418 }
1419 }
1420 }
1421 EClass._map.things.ForeachReverse(delegate(Thing t)
1422 {
1423 t.DecayNatural(passed);
1424 });
1425 VirtualDate.current = null;
1426 if (!IsPCFaction)
1427 {
1428 return;
1429 }
1430 int num8 = 0;
1431 foreach (Chara item2 in list)
1432 {
1433 if (item2.IsPCParty)
1434 {
1435 continue;
1436 }
1437 if (!item2.IsHomeMember())
1438 {
1439 if (item2.id == "bee")
1440 {
1441 num8++;
1442 }
1443 if (num6 > 0 && item2.IsGuest())
1444 {
1445 item2.ChooseNewGoal();
1446 item2.ai.SimulateZone(num6);
1447 item2.ai.OnSimulatePosition();
1448 }
1449 continue;
1450 }
1451 if (num6 > 0)
1452 {
1453 Goal goalWork = item2.GetGoalWork();
1454 item2.SetAI(goalWork);
1455 if (goalWork is GoalWork)
1456 {
1457 (goalWork as GoalWork).FindWork(item2);
1458 }
1459 item2.ai.SimulateZone(num6);
1460 goalWork = item2.GetGoalHobby();
1461 item2.SetAI(goalWork);
1462 if (goalWork is GoalWork)
1463 {
1464 (goalWork as GoalWork).FindWork(item2);
1465 }
1466 item2.ai.SimulateZone(num6);
1467 }
1468 item2.ChooseNewGoal();
1469 if (item2.conSuspend == null)
1470 {
1471 item2.ai.OnSimulatePosition();
1472 }
1473 }
1474 List<Thing> list2 = new List<Thing>();
1475 foreach (Thing thing in map.things)
1476 {
1477 if (thing.IsInstalled && thing.trait is TraitBeekeep)
1478 {
1479 list2.Add(thing);
1480 }
1481 }
1482 if (num8 >= list2.Count)
1483 {
1484 return;
1485 }
1486 for (int num9 = num8; num9 < list2.Count; num9++)
1487 {
1488 if (EClass.rnd(200) <= passed)
1489 {
1490 Chara chara = CharaGen.Create("bee");
1491 AddCard(chara, list2.RandomItem().pos);
1492 Hostility c_originalHostility = (chara.hostility = Hostility.Neutral);
1493 chara.c_originalHostility = c_originalHostility;
1494 }
1495 }
1496 }
1497 finally
1498 {
1499 VirtualDate.current = null;
1500 }
1501 }
ClearInventoryType
CureType
Definition: CureType.cs:2
virtual void OnSimulatePosition()
Definition: AIAct.cs:604
void SimulateZone(int days)
Definition: AIAct.cs:592
int hp
Definition: Card.cs:245
string Name
Definition: Card.cs:2203
virtual void HealHP(long a, HealSource origin=HealSource.None)
Definition: Card.cs:4200
AIAct ai
Definition: Chara.cs:208
ConSuspend conSuspend
Definition: Chara.cs:106
Goal GetGoalWork()
Definition: Chara.cs:9509
override int MaxHP
Definition: Chara.cs:728
Goal GetGoalHobby()
Definition: Chara.cs:9522
Stats mana
Definition: Chara.cs:1238
Stats stamina
Definition: Chara.cs:1230
bool IsHomeMember()
Definition: Chara.cs:7067
bool IsGuest()
Definition: Chara.cs:7092
void ChooseNewGoal()
Definition: Chara.cs:9445
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:10246
bool IsNight
Definition: Date.cs:112
Definition: Goal.cs:4
bool isConquered
Definition: Spatial.cs:382
virtual void Mod(int a)
Definition: Stats.cs:135
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
void SimulateHour()
Definition: VirtualDate.cs:66
int MinsSinceLastActive
Definition: Zone.cs:130
int pendingSimHours
Definition: Zone.cs:37
Chara Boss
Definition: Zone.cs:91
int HourSinceLastActive
Definition: Zone.cs:128

References $, EClass._map, EClass._zone, Chara.ai, Boss, Map.charas, Chara.ChooseNewGoal(), Core.config, Chara.conSuspend, EClass.core, CharaGen.Create(), Chara.Cure(), World.date, Debug, Card.DecayNatural(), EClass.game, Chara.GetGoalHobby(), Chara.GetGoalWork(), GetTopZone(), Card.HealHP(), Card.hp, Card.id, Spatial.isConquered, Chara.IsGuest(), Chara.IsHomeMember(), Card.IsInstalled, Game.isLoading, Date.IsNight, Chara.IsPCFaction, Chara.IsPCParty, item, Chara.mana, Stats.max, Chara.MaxHP, CoreConfig.Test.maxSimHours, CoreConfig.Test.maxSleepSimHours, Stats.Mod(), Spatial.Name, AIAct.OnSimulatePosition(), Card.pos, Card.rarity, RemoveCard(), EClass.rnd(), Msg.Say(), Chara.SetAI(), VirtualDate.SimulateHour(), AIAct.SimulateZone(), Chara.stamina, CoreConfig.test, Map.things, Card.trait, Stats.value, and EClass.world.

◆ SpawnAltar()

void Zone.SpawnAltar ( )
inline

Definition at line 2739 of file Zone.cs.

2740 {
2742 {
2743 if (r.points.Count <= 4)
2744 {
2745 return false;
2746 }
2747 map.poiMap.OccyupyPOI(r.points[0]);
2748 List<Point> points = r.points;
2749 Religion randomReligion = EClass.game.religions.GetRandomReligion();
2750 "altarPoint".lang(randomReligion.NameDomain.lang());
2751 Thing thing = ThingGen.Create("altar");
2752 (thing.trait as TraitAltar).SetDeity(randomReligion.id);
2753 Chara t = CharaGen.Create("twintail");
2754 EClass._zone.AddCard(t, points.RandomItem());
2755 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2756 {
2757 Chara t2 = CharaGen.Create("twintail");
2758 EClass._zone.AddCard(t2, points.RandomItem());
2759 }
2760 if (points[0].Installed == null)
2761 {
2762 EClass._zone.AddCard(thing, points[0]).Install();
2763 }
2764 foreach (Point item in points)
2765 {
2766 if (item.x % 3 == 0 && item.z % 2 == 0 && item != points[0] && !item.Equals(points[0].Front) && item.Installed == null)
2767 {
2768 thing = ThingGen.Create("pillar1");
2769 EClass._zone.AddCard(thing, item).Install();
2770 }
2771 item.SetObj();
2772 item.SetFloor(3, 6);
2773 }
2774 return true;
2775 });
2776 }
mods...$ Installed
Definition: ModManager.cs:988
Crawler start
Definition: CoreRef.cs:217
Crawlers crawlers
Definition: CoreRef.cs:346
ReligionManager religions
Definition: Game.cs:159
POIMap poiMap
Definition: Map.cs:103
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
Religion GetRandomReligion(bool onlyJoinable=true, bool includeMinor=false)

References EClass._zone, AddCard(), EClass.core, CoreRef.crawlers, Crawler.CrawlUntil(), ThingGen.Create(), CharaGen.Create(), EClass.game, POIMap.Cell.GetCenter(), POIMap.GetCenterCell(), ReligionManager.GetRandomReligion(), Installed, item, POIMap.OccyupyPOI(), Map.poiMap, Core.refs, Game.religions, EClass.rnd(), CoreRef.Crawlers.start, and Card.trait.

◆ SpawnLostItems()

void Zone.SpawnLostItems ( )
inline

Definition at line 4063 of file Zone.cs.

4064 {
4065 for (int i = 0; i < 2 + EClass.rnd(4); i++)
4066 {
4067 Point point = GetPos();
4068 if (point == null)
4069 {
4070 continue;
4071 }
4072 if (EClass.rnd(30) == 0)
4073 {
4074 Thing thing = ThingGen.Create("purse");
4075 thing.isLostProperty = true;
4076 thing.things.DestroyAll();
4077 int num = (thing.c_lockLv = EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
4078 thing.Add("money", EClass.rndHalf(num * 60 + 1000));
4079 if (EClass.rnd(2) == 0)
4080 {
4081 thing.Add("plat", EClass.rnd(4));
4082 }
4083 else
4084 {
4085 thing.Add("medal", EClass.rnd(2));
4086 }
4087 EClass._zone.AddCard(thing, point);
4088 }
4089 else
4090 {
4092 }
4093 }
4094 static Point GetPos()
4095 {
4096 for (int j = 0; j < 10; j++)
4097 {
4098 Point randomPoint = EClass._zone.bounds.GetRandomPoint();
4099 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
4100 {
4101 return randomPoint;
4102 }
4103 }
4104 return null;
4105 }
4106 }
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3269
static int rndHalf(int a)
Definition: EClass.cs:97
void DestroyAll(Func< Thing, bool > funcExclude=null)
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
MapBounds bounds
Definition: Zone.cs:52

References EClass._zone, Card.Add(), AddCard(), bounds, ThingGen.Create(), ThingGen.CreateFromCategory(), ThingContainer.DestroyAll(), MapBounds.GetRandomPoint(), Point.HasBlock, Point.HasObj, Point.HasThing, Point.IsBlocked, EClass.rnd(), EClass.rndHalf(), and Card.things.

◆ SpawnMob() [1/2]

Chara Zone.SpawnMob ( Point  pos = null,
SpawnSetting  setting = null 
)
inline

Definition at line 2999 of file Zone.cs.

3000 {
3001 if (setting == null)
3002 {
3004 }
3005 if (pos == null)
3006 {
3007 pos = GetSpawnPos(setting.position, setting.tries);
3008 if (pos == null)
3009 {
3010 pos = GetSpawnPos(SpawnPosition.Random, setting.tries);
3011 if (pos == null)
3012 {
3013 return null;
3014 }
3015 }
3016 }
3018 if (IsUnderwater && EClass.rnd(15) != 0)
3019 {
3021 }
3022 SpawnList spawnList = null;
3023 if (setting.idSpawnList != null)
3024 {
3025 spawnList = SpawnList.Get(setting.idSpawnList);
3026 }
3027 else if (EClass._zone is Zone_DungeonYeek && EClass.rnd(5) != 0)
3028 {
3029 spawnList = SpawnListChara.Get("dungeon_yeek", (SourceChara.Row r) => r.race == "yeek" && r.quality == 0);
3030 }
3031 else if (EClass._zone is Zone_DungeonDragon && EClass.rnd(5) != 0)
3032 {
3033 spawnList = SpawnListChara.Get("dungeon_dragon", (SourceChara.Row r) => (r.race == "dragon" || r.race == "drake" || r.race == "wyvern" || r.race == "lizardman" || r.race == "dinosaur") && r.quality == 0);
3034 }
3035 else if (EClass._zone is Zone_DungeonMino && EClass.rnd(5) != 0)
3036 {
3037 spawnList = SpawnListChara.Get("dungeon_mino", (SourceChara.Row r) => r.race == "minotaur" && r.quality == 0);
3038 }
3039 else if (setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) < ChanceSpawnNeutral))
3040 {
3041 spawnList = SpawnList.Get(IsInstance ? "c_neutral_war" : "c_neutral");
3042 }
3043 else if (biome.spawn.chara.Count > 0)
3044 {
3045 string randomCharaId = biome.spawn.GetRandomCharaId();
3046 spawnList = ((!IsInstance) ? SpawnList.Get(randomCharaId) : SpawnList.Get("instance_" + randomCharaId, randomCharaId, new CharaFilter
3047 {
3048 ShouldPass = (SourceChara.Row s) => (!(s.hostility != "") || (!s.tag.Contains("cat") && !s.race_row.tag.Contains("cat"))) ? true : false
3049 }));
3050 }
3051 else
3052 {
3053 spawnList = SpawnList.Get(biome.name, "chara", new CharaFilter
3054 {
3055 ShouldPass = delegate(SourceChara.Row s)
3056 {
3057 if (s.hostility != "")
3058 {
3059 return false;
3060 }
3061 return s.biome == biome.name || s.biome.IsEmpty();
3062 }
3063 });
3064 }
3065 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
3066 CardBlueprint cardBlueprint = new CardBlueprint
3067 {
3068 rarity = Rarity.Normal,
3069 idEle = setting.idEle
3070 };
3071 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
3072 if (ScaleType == ZoneScaleType.Void)
3073 {
3074 num2 = ((num - 1) % 50 + 5) * 150 / 100;
3075 if (num2 >= 20 && EClass.rnd(100) < num2)
3076 {
3077 num2 = num;
3078 }
3079 }
3080 CardRow cardRow = (setting.id.IsEmpty() ? spawnList.Select(num2, setting.levelRange) : EClass.sources.cards.map[setting.id]);
3081 if (EClass.world.date.month == 12 && setting.rarity == Rarity.Random && EClass._zone.IsNefia && EClass._zone.isRandomSite && EClass.world.date.day >= 24 && EClass.world.date.day <= 26 && EClass.rnd(50 * (1 + EClass.player.flags.santa) * (1 + EClass.player.flags.santa)) == 0)
3082 {
3083 cardRow = EClass.sources.cards.map["santa"];
3085 }
3086 if (cardRow == null)
3087 {
3088 Debug.LogError("SpawnMob: no spawn row list/" + spawnList?.id + "/biome/" + biome.name + "/zone/" + Name);
3089 return null;
3090 }
3091 long num3 = ((setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv);
3092 bool flag = setting.fixedLv != -1 || setting.addLv > 0 || DangerLvBoost > 0;
3093 num3 += setting.addLv;
3094 if (ScaleType == ZoneScaleType.Void)
3095 {
3096 num3 = (50L + (long)cardRow.LV) * Mathf.Max(1, (num - 1) / 50);
3097 flag = true;
3098 }
3099 num3 += DangerLvBoost;
3100 if (flag && num3 <= Mathf.Max(50, cardRow.LV))
3101 {
3102 flag = false;
3103 }
3104 if (setting.rarity == Rarity.Random && cardRow.quality == 0)
3105 {
3106 if (EClass.rnd(EClass.pc.HasElement(1271) ? 80 : 100) == 0)
3107 {
3108 cardBlueprint.rarity = Rarity.Legendary;
3109 num3 = num3 * 125 / 100;
3110 }
3111 }
3112 else
3113 {
3114 cardBlueprint.rarity = setting.rarity;
3115 }
3116 if (setting.isBoss)
3117 {
3118 num3 = num3 * 150 / 100;
3119 }
3120 if (setting.isEvolved)
3121 {
3122 num3 = num3 * 2 + 20;
3123 }
3124 if (num3 != cardRow.LV)
3125 {
3126 cardBlueprint.lv = (int)Mathf.Min(num3, 100000000f);
3127 }
3128 CardBlueprint.Set(cardBlueprint);
3129 Chara chara = CharaGen.Create(cardRow.id, num2);
3130 if (!flag)
3131 {
3132 chara.isScaled = false;
3133 }
3134 AddCard(chara, pos);
3135 if (setting.forcedHostility.HasValue)
3136 {
3137 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
3138 chara.c_originalHostility = c_originalHostility;
3139 }
3140 else
3141 {
3142 switch (chara.id)
3143 {
3144 case "unicorn":
3145 if (EClass.pc.HasElement(1216) && EClass.pc.Evalue(418) < 1)
3146 {
3147 chara.SetHostility(Hostility.Enemy);
3148 }
3149 break;
3150 case "santa":
3151 case "silverwolf":
3152 case "twintail":
3153 case "test17":
3154 if (EClass.pc.HasElement(1270))
3155 {
3156 chara.SetHostility(Hostility.Friend);
3157 }
3158 else if (EClass.pc.HasElement(1271))
3159 {
3160 chara.SetHostility(Hostility.Enemy);
3161 }
3162 break;
3163 }
3164 }
3165 if (setting.isBoss)
3166 {
3167 chara.c_bossType = BossType.Boss;
3168 }
3169 if (setting.isEvolved)
3170 {
3171 chara.c_bossType = BossType.Evolved;
3172 }
3173 if (DangerLv >= 20 && !IsPCFaction && !IsTown && EClass.rnd(200) == 0)
3174 {
3176 }
3177 return chara;
3178 }
BossType
Definition: BossType.cs:2
SpawnHostility
ZoneScaleType
Definition: ZoneScaleType.cs:2
List< SpawnListChara > chara
string GetRandomCharaId()
static void Set(CardBlueprint _bp=null)
int quality
Definition: CardRow.cs:19
string id
Definition: CardRow.cs:7
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6395
BiomeProfile biome
Definition: Cell.cs:1115
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9959
BiomeProfile Water
Definition: CoreRef.cs:155
BiomeProfile Sand
Definition: CoreRef.cs:153
Biomes biomes
Definition: CoreRef.cs:344
int month
Definition: Date.cs:50
int day
Definition: Date.cs:62
int santa
Definition: Player.cs:604
Flags flags
Definition: Player.cs:1173
static int Range(int min, int max)
Definition: Rand.cs:49
int LV
Definition: RenderRow.cs:22
bool isRandomSite
Definition: Spatial.cs:334
virtual int DangerLvBoost
Definition: Spatial.cs:489
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
CardRow Select(int lv=-1, int levelRange=-1)
Definition: SpawnList.cs:139
static SpawnSetting Default
Definition: SpawnSetting.cs:33
virtual ZoneScaleType ScaleType
Definition: Zone.cs:418
virtual float ChanceSpawnNeutral
Definition: Zone.cs:352

References EClass._zone, CoreRef.biomes, BiomeProfile.Spawns.chara, EClass.core, SpawnSetting.Default, SpawnListChara.Get(), SpawnList.Get(), BiomeProfile.Spawns.GetRandomCharaId(), Rand.Range(), Core.refs, EClass.rnd(), CoreRef.Biomes.Sand, BiomeProfile.spawn, and CoreRef.Biomes.Water.

◆ SpawnMob() [2/2]

◆ TextLevel()

string Zone.TextLevel ( int  _lv)
inline

Definition at line 605 of file Zone.cs.

606 {
607 if (_lv != 0)
608 {
609 if (base.lv <= 0)
610 {
611 return " " + "zoneLevelB".lang((_lv * -1).ToString() ?? "");
612 }
613 return " " + "zoneLevel".lang((_lv + 1).ToString() ?? "");
614 }
615 return "";
616 }
override string ToString()
Definition: Zone.cs:600

References ToString().

◆ ToString()

override string Zone.ToString ( )
inline

Definition at line 600 of file Zone.cs.

601 {
602 return Name + "(" + base.uid + ")(" + RegionPos?.ToString() + ") instance?" + IsInstance + "/" + EClass.world.date.GetRemainingHours(base.dateExpire) + "h";
603 }
int GetRemainingHours(int rawDeadLine)
Definition: Date.cs:343
override string ToString()
Definition: Point.cs:520
virtual Point RegionPos
Definition: Spatial.cs:560

References World.date, Date.GetRemainingHours(), IsInstance, Spatial.Name, Spatial.RegionPos, Point.ToString(), and EClass.world.

Referenced by Game.OnLoad(), and TextLevel().

◆ TryAddThing()

bool Zone.TryAddThing ( Thing  target,
Point  p,
bool  destroyIfFail = false 
)
inline

Definition at line 2419 of file Zone.cs.

2420 {
2421 int num = 0;
2422 if (p.cell.detail != null)
2423 {
2424 foreach (Thing thing in p.cell.detail.things)
2425 {
2426 if (thing.placeState == PlaceState.roaming)
2427 {
2428 if (target.TryStackTo(thing))
2429 {
2430 return true;
2431 }
2432 num++;
2433 }
2434 }
2435 }
2436 if (num == 0 || !destroyIfFail)
2437 {
2438 EClass._zone.AddCard(target, p);
2439 return true;
2440 }
2441 target.Destroy();
2442 return false;
2443 }
bool TryStackTo(Thing to)
Definition: Card.cs:3590
List< Thing > things
Definition: CellDetail.cs:11

References EClass._zone, AddCard(), Point.cell, Card.Destroy(), Cell.detail, Card.placeState, CellDetail.things, and Card.TryStackTo().

Referenced by FactionBranch.GenerateGarbage(), and Card.GiveBirth().

◆ TryAddThingInSharedContainer()

bool Zone.TryAddThingInSharedContainer ( Thing  t,
List< Thing >  containers = null,
bool  add = true,
bool  msg = false,
Chara  chara = null,
bool  sharedOnly = true 
)
inline

Definition at line 2319 of file Zone.cs.

2320 {
2321 Thing thing = FindSharedContainer(t, containers, sharedOnly);
2322 if (thing == null)
2323 {
2324 return false;
2325 }
2326 if (add)
2327 {
2328 if (msg)
2329 {
2330 chara?.Say("putSharedItem", chara, t, thing.GetName(NameStyle.Full));
2331 }
2332 thing.AddThing(t);
2333 }
2334 return true;
2335 }
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3292
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7341
Thing FindSharedContainer(Thing t, List< Thing > containers=null, bool sharedOnly=true)
Definition: Zone.cs:2337

References Card.AddThing(), Thing.GetName(), and Card.Say().

Referenced by AI_Haul.GetThingToClean(), AI_Haul.Run(), GrowSystem.TryPick(), Chara.TryPutShared(), and Chara.TryPutSharedItems().

◆ TryAddThingInSpot< T >()

bool Zone.TryAddThingInSpot< T > ( Thing  t,
bool  useContainer = true 
)
inline
Type Constraints
T :Trait 

Definition at line 2228 of file Zone.cs.

2228 : Trait
2229 {
2230 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<T>();
2231 if (randomThing == null)
2232 {
2234 {
2236 }
2237 else
2238 {
2240 }
2241 return false;
2242 }
2243 if (useContainer && (!t.IsContainer || t.things.Count == 0))
2244 {
2245 List<Thing> list = new List<Thing>();
2246 foreach (Point item in randomThing.trait.ListPoints(null, onlyPassable: false))
2247 {
2248 foreach (Card item2 in item.ListCards())
2249 {
2250 if (item2.IsContainer && !(item2.trait is TraitDeliveryChest))
2251 {
2252 list.Add(item2.Thing);
2253 }
2254 }
2255 }
2256 if (TryAddThingInSharedContainer(t, list, add: true, msg: false, null, sharedOnly: false))
2257 {
2258 return true;
2259 }
2260 }
2262 {
2263 TryAddThing(t, randomThing.trait.GetRandomPoint());
2264 }
2265 else
2266 {
2267 AddCard(t, randomThing.trait.GetRandomPoint());
2268 }
2269 return true;
2270 }
virtual Thing Thing
Definition: Card.cs:2122
bool IsContainer
Definition: Card.cs:2153
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:852
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true, bool allowChara=true)
Definition: Trait.cs:870
static bool IsActive
Definition: VirtualDate.cs:13
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2319
bool TryAddThing(Thing target, Point p, bool destroyIfFail=false)
Definition: Zone.cs:2419

References EClass._map, Map.bounds, Trait.GetRandomPoint(), MapBounds.GetRandomSurface(), PropsManager.installed, VirtualDate.IsActive, Card.IsContainer, item, Trait.ListPoints(), Map.props, Card.Thing, Card.things, Card.trait, and Props.traits.

◆ TryGenerateBigDaddy()

void Zone.TryGenerateBigDaddy ( )
inline

Definition at line 2851 of file Zone.cs.

2852 {
2853 if (!(BigDaddyChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f) <= EClass.rndf(1f)))
2854 {
2855 Point spawnPos = GetSpawnPos(SpawnPosition.Random, 10000);
2856 List<string> list = new List<string> { "big_daddy", "big_daddy2" };
2857 list.Shuffle();
2858 Spawn(list[0], spawnPos);
2859 if (EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
2860 {
2861 Spawn(list[1], spawnPos.GetNearestPoint(allowBlock: false, allowChara: false));
2862 }
2863 Msg.Say("sign_bigdaddy");
2864 }
2865 void Spawn(string id, Point pos)
2866 {
2867 int num = (int)((long)DangerLv * 125L / 100);
2868 if (num >= 30)
2869 {
2871 {
2872 lv = num
2873 });
2874 }
2875 Chara chara = CharaGen.Create(id);
2876 if (EClass.pc.HasElement(1270))
2877 {
2878 chara.SetHostility(Hostility.Friend);
2879 }
2880 else if (EClass.pc.HasElement(1271))
2881 {
2882 chara.SetHostility(Hostility.Enemy);
2883 }
2884 EClass._zone.AddCard(chara, pos);
2885 }
2886 }
static float rndf(float a)
Definition: EClass.cs:102
virtual float BigDaddyChance
Definition: Zone.cs:328

References EClass._zone, AddCard(), CharaGen.Create(), EClass.debug, CoreDebug.enable, Point.GetNearestPoint(), Card.HasElement(), EClass.pc, EClass.rnd(), EClass.rndf(), Msg.Say(), CardBlueprint.Set(), and Chara.SetHostility().

Referenced by Zone_Dungeon.OnGenerateMap().

◆ TryGenerateEvolved()

Chara Zone.TryGenerateEvolved ( bool  force = false,
Point  p = null 
)
inline

Definition at line 2831 of file Zone.cs.

2832 {
2833 float num = EvolvedChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f);
2834 if (!force && num <= EClass.rndf(1f))
2835 {
2836 return null;
2837 }
2838 Chara chara = SpawnMob(p, SpawnSetting.Evolved());
2839 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2840 {
2841 chara.ability.AddRandom();
2842 }
2843 chara.AddThing(chara.MakeGene(DNA.Type.Default));
2844 if (EClass.rnd(2) == 0)
2845 {
2846 chara.AddThing(chara.MakeGene(DNA.Type.Superior));
2847 }
2848 return chara;
2849 }
void AddRandom()
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:8802
CharaAbility ability
Definition: Chara.cs:430
Definition: DNA.cs:9
Type
Definition: DNA.cs:11
static SpawnSetting Evolved(int fixedLv=-1)
Definition: SpawnSetting.cs:37
virtual float EvolvedChance
Definition: Zone.cs:330

References Chara.ability, CharaAbility.AddRandom(), Card.AddThing(), SpawnSetting.Evolved(), Card.HasElement(), Chara.MakeGene(), EClass.pc, EClass.rnd(), and EClass.rndf().

Referenced by ZoneEventSiege.CreateChara(), Zone_Dungeon.OnGenerateMap(), and ZoneEventQuest.SpawnBoss().

◆ TryGenerateOre()

void Zone.TryGenerateOre ( )
inline

Definition at line 2804 of file Zone.cs.

2805 {
2806 if (OreChance <= 0f)
2807 {
2808 return;
2809 }
2810 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)
2811 {
2812 int num = 18;
2813 string text = "ore";
2814 if (EClass.rnd(5) == 0)
2815 {
2816 num++;
2817 text = "gem";
2818 }
2819 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(DangerLv, text);
2820 foreach (Point point in r.points)
2821 {
2822 if (point.sourceBlock.ContainsTag("ore"))
2823 {
2824 map.SetObj(point.x, point.z, randomMaterial.id, num, 1, 0);
2825 }
2826 }
2827 return false;
2828 });
2829 }
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:56
int Width
Definition: MapBounds.cs:26
int Height
Definition: MapBounds.cs:28
virtual float OreChance
Definition: Zone.cs:326

References EClass._map, Map.bounds, Crawler.CrawlUntil(), Crawler.Create(), MATERIAL.GetRandomMaterial(), MapBounds.GetRandomPoint(), MapBounds.Height, EClass.rnd(), and MapBounds.Width.

Referenced by Zone_Dungeon.OnGenerateMap().

◆ TryGenerateShrine()

void Zone.TryGenerateShrine ( )
inline

Definition at line 2888 of file Zone.cs.

2889 {
2890 float num = ShrineChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f);
2891 for (int i = 0; i < 3; i++)
2892 {
2893 Rand.SetSeed(base.uid + i);
2894 if (num <= EClass.rndf(1f))
2895 {
2896 continue;
2897 }
2898 Point randomSpace = EClass._map.GetRandomSpace(3, 3);
2899 if (randomSpace == null)
2900 {
2901 continue;
2902 }
2903 randomSpace.x++;
2904 randomSpace.z++;
2905 if (randomSpace.HasThing || randomSpace.HasChara)
2906 {
2907 continue;
2908 }
2909 randomSpace.SetObj();
2912 if (EClass.rnd(EClass.debug.test ? 2 : 15) == 0)
2913 {
2914 EClass._zone.AddCard(ThingGen.Create("pedestal_power"), randomSpace).Install();
2915 EClass._zone.AddCard(ThingGen.Create(EClass.gamedata.godStatues.RandomItemWeighted((GodStatueData a) => a.chance).idThing, -1, DangerLv), randomSpace).Install();
2916 }
2917 else
2918 {
2919 EClass._zone.AddCard(ThingGen.Create("statue_power", -1, DangerLv), randomSpace).Install().SetRandomDir();
2920 }
2921 }
2922 Rand.SetSeed();
2923 }
void SetRandomDir()
Definition: Card.cs:6725
bool test
Definition: CoreDebug.cs:186
static GameData gamedata
Definition: EClass.cs:37
List< GodStatueData > godStatues
Definition: GameData.cs:9
Point GetRandomSpace(int width, int height, int tries=100)
Definition: MapBounds.cs:246
int seedShrine
Definition: Player.cs:1017
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:930
virtual float ShrineChance
Definition: Zone.cs:332

References EClass._map, EClass._zone, AddCard(), GodStatueData.chance, ThingGen.Create(), EClass.debug, EClass.gamedata, MapBounds.GetRandomSpace(), GameData.godStatues, Point.HasChara, Card.HasElement(), Point.HasThing, EClass.pc, EClass.player, EClass.rnd(), EClass.rndf(), Player.seedShrine, Point.SetObj(), Card.SetRandomDir(), Rand.SetSeed(), CoreDebug.test, Point.x, and Point.z.

Referenced by Zone_Dungeon.OnGenerateMap().

◆ TryGetRestock< T >()

Thing Zone.TryGetRestock< T > ( string  idCat)
inline
Type Constraints
T :TraitSpot 

Definition at line 2461 of file Zone.cs.

2461 : TraitSpot
2462 {
2463 List<T> list = new List<T>();
2464 foreach (Thing thing2 in EClass._map.things)
2465 {
2466 if (thing2.IsInstalled && thing2.trait is T)
2467 {
2468 list.Add(thing2.trait as T);
2469 }
2470 }
2471 foreach (T item in list)
2472 {
2473 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2474 {
2475 foreach (Thing thing3 in item2.Things)
2476 {
2477 if (!thing3.IsInstalled || thing3.isSale)
2478 {
2479 continue;
2480 }
2481 if (thing3.things.Count == 0)
2482 {
2483 if (IsValid(thing3, insideContainer: false))
2484 {
2485 return thing3;
2486 }
2487 continue;
2488 }
2489 Thing thing = thing3.things.Find((Thing _t) => IsValid(_t, insideContainer: true));
2490 if (thing != null)
2491 {
2492 return thing;
2493 }
2494 }
2495 }
2496 }
2497 return null;
2498 bool IsValid(Thing t, bool insideContainer)
2499 {
2500 if (t.category.id != idCat || !TraitSalesTag.CanTagSale(t, insideContainer))
2501 {
2502 return false;
2503 }
2504 return true;
2505 }
2506 }
bool isSale
Definition: Card.cs:869
List< Thing > Things
Definition: Point.cs:334
Thing Find(int uid)
static bool CanTagSale(Card t, bool insideContainer=false)
Definition: TraitSalesTag.cs:9

References EClass._map, TraitSalesTag.CanTagSale(), Card.category, ThingContainer.Find(), Card.IsInstalled, Card.isSale, item, Card.things, Map.things, Point.Things, and Card.trait.

◆ TryGetThingFromSharedContainer()

Thing Zone.TryGetThingFromSharedContainer ( Func< Thing, bool >  func)
inline

Definition at line 2445 of file Zone.cs.

2446 {
2447 foreach (Thing container in EClass._map.props.installed.containers)
2448 {
2449 if (container.IsSharedContainer)
2450 {
2451 Thing thing = container.things.Find(func);
2452 if (thing != null)
2453 {
2454 return thing;
2455 }
2456 }
2457 }
2458 return null;
2459 }

References EClass._map, Props.containers, ThingContainer.Find(), PropsManager.installed, Thing.IsSharedContainer, Map.props, and Card.things.

Referenced by FactionBranch.DailyOutcome(), and FactionBranch.GetMeal().

◆ TryListThingsInSpot< T >()

List< Thing > Zone.TryListThingsInSpot< T > ( Func< Thing, bool >  func = null)
inline
Type Constraints
T :TraitSpot 

Definition at line 2272 of file Zone.cs.

2272 : TraitSpot
2273 {
2274 List<T> list = new List<T>();
2275 List<Thing> list2 = new List<Thing>();
2276 foreach (Thing thing in EClass._map.things)
2277 {
2278 if (thing.IsInstalled && thing.trait is T)
2279 {
2280 list.Add(thing.trait as T);
2281 }
2282 }
2283 foreach (T item in list)
2284 {
2285 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2286 {
2287 foreach (Thing thing2 in item2.Things)
2288 {
2289 if (!thing2.IsInstalled)
2290 {
2291 continue;
2292 }
2293 if (thing2.things.Count == 0)
2294 {
2295 if (IsValid(thing2))
2296 {
2297 list2.Add(thing2);
2298 }
2299 continue;
2300 }
2301 foreach (Thing item3 in thing2.things.List((Thing _t) => IsValid(_t)))
2302 {
2303 list2.Add(item3);
2304 }
2305 }
2306 }
2307 }
2308 return list2;
2309 bool IsValid(Thing t)
2310 {
2311 if (func != null && !func(t))
2312 {
2313 return false;
2314 }
2315 return true;
2316 }
2317 }
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)

References EClass._map, Card.IsInstalled, item, ThingContainer.List(), Card.things, Map.things, Point.Things, and Card.trait.

◆ TrySpawnFollower()

void Zone.TrySpawnFollower ( )
inline

Definition at line 2705 of file Zone.cs.

2706 {
2707 bool flag = EClass.pc.HasCondition<ConDrawBacker>();
2708 if (!EClass.debug.enable && EClass.rnd(flag ? 3 : 20) != 0)
2709 {
2710 return;
2711 }
2712 Point randomSurface = EClass._map.bounds.GetRandomSurface();
2713 if (!randomSurface.IsValid)
2714 {
2715 return;
2716 }
2717 Chara c = CharaGen.Create("follower");
2718 EClass._zone.AddCard(c, randomSurface);
2719 (EClass._zone.AddThing("gallows", randomSurface).Install().trait as TraitShackle).Restrain(c);
2720 c.c_rescueState = RescueState.WaitingForRescue;
2721 if (EClass.rnd(flag ? 1 : 2) == 0 || EClass.debug.enable)
2722 {
2724 if (row != null)
2725 {
2726 c.ApplyBacker(row.id);
2727 }
2728 }
2729 Religion faith = EClass.game.religions.dictAll.Values.Where((Religion a) => a != c.faith).RandomItem();
2730 for (int num = 0; num < 3 + EClass.rnd(4); num++)
2731 {
2732 Chara chara = CharaGen.Create("fanatic");
2733 chara.SetFaith(faith);
2734 Point point = randomSurface.GetRandomPoint(4) ?? randomSurface.GetNearestPoint();
2735 EClass._zone.AddCard(chara, point);
2736 }
2737 }
RescueState
Definition: RescueState.cs:2
static int indexFollower
Religion faith
Definition: Chara.cs:445
void SetFaith(string id)
Definition: Chara.cs:1814
Dictionary< string, Religion > dictAll
List< Row > listFollower

References EClass._map, EClass._zone, AddCard(), AddThing(), Card.ApplyBacker(), SourceManager.backers, Map.bounds, CharaGen.Create(), EClass.debug, ReligionManager.dictAll, CoreDebug.enable, Chara.faith, faith, EClass.game, Point.GetNearestPoint(), Point.GetRandomPoint(), MapBounds.GetRandomSurface(), Chara.HasCondition(), SourceBacker.Row.id, BackerContent.indexFollower, Card.Install(), Point.IsValid, SourceBacker.listFollower, EClass.pc, Game.religions, EClass.rnd(), Chara.SetFaith(), EClass.sources, and Card.trait.

◆ UnloadMap()

void Zone.UnloadMap ( )
inline

Definition at line 1877 of file Zone.cs.

1878 {
1879 map = null;
1880 if (bp != null)
1881 {
1882 bp.map = null;
1883 }
1884 if (branch != null)
1885 {
1887 }
1888 Debug.Log("Unloaded Map:" + this);
1889 }
void OnUnloadMap()

References Debug, and FactionBranch.OnUnloadMap().

Referenced by Activate().

◆ UpdateQuests()

void Zone.UpdateQuests ( bool  force = false)
inline

Definition at line 3940 of file Zone.cs.

3941 {
3942 if (!IsPCFaction && (!(this is Zone_Town) || base.lv != 0))
3943 {
3944 return;
3945 }
3946 Debug.Log("Updating Quest:" + force);
3947 List<SourceQuest.Row> list = EClass.sources.quests.rows.Where((SourceQuest.Row a) => a.group == "random").ToList();
3948 int num = 0;
3949 foreach (Chara item in map.charas.Concat(map.deadCharas))
3950 {
3951 if (item.quest != null && !EClass.game.quests.list.Contains(item.quest))
3952 {
3953 if (item.quest.IsExpired || completedQuests.Contains(item.quest.uid) || force)
3954 {
3955 item.quest = null;
3956 }
3957 else
3958 {
3959 num++;
3960 }
3961 }
3962 }
3963 if (EClass._zone.dateQuest > EClass.world.date.GetRaw() && !force)
3964 {
3965 return;
3966 }
3967 EClass._zone.dateQuest = EClass.world.date.GetRaw() + 1440;
3968 int maxQuest = 3;
3969 Rand.UseSeed(base.uid + EClass.player.stats.days / 7 % 100, delegate
3970 {
3971 maxQuest = 4 + EClass.rnd(4);
3972 });
3973 completedQuests.Clear();
3974 List<Zone> list2 = Quest.ListDeliver();
3975 List<Tuple<string, int>> listTag = new List<Tuple<string, int>>();
3976 string[] array = EClass._zone.source.questTag;
3978 {
3979 array = new string[9] { "supply/8", "deliver/7", "food/8", "escort/4", "deliver/4", "monster/0", "war/0", "farm/0", "music/0" };
3980 }
3981 string[] array2 = array;
3982 for (int num2 = 0; num2 < array2.Length; num2++)
3983 {
3984 string[] array3 = array2[num2].Split('/');
3985 listTag.Add(new Tuple<string, int>(array3[0], array3[1].ToInt()));
3986 }
3987 for (int num3 = 0; num3 < map.charas.Count * 2; num3++)
3988 {
3989 if (num > maxQuest)
3990 {
3991 break;
3992 }
3993 if (num > 15)
3994 {
3995 break;
3996 }
3997 Chara chara = map.charas.RandomItem();
3998 if (!chara.trait.CanGiveRandomQuest || chara.isSubsetCard || chara.homeZone != EClass._zone || chara.IsGuest() || chara.memberType == FactionMemberType.Livestock || (chara.quest != null && !force))
3999 {
4000 continue;
4001 }
4002 SourceQuest.Row row = list.RandomItemWeighted(delegate(SourceQuest.Row a)
4003 {
4004 int num4 = 1;
4005 foreach (Tuple<string, int> item2 in listTag)
4006 {
4007 if (a.tags.Contains(item2.Item1))
4008 {
4009 num4 = item2.Item2;
4010 break;
4011 }
4012 }
4013 if (!EClass._zone.IsPCFaction && a.tags.Contains("bulk"))
4014 {
4015 num4 = 0;
4016 }
4017 return a.chance * num4;
4018 });
4019 if ((!row.tags.Contains("needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame < EClass.player.fame || EClass.debug.enable))
4020 {
4021 Quest.Create(row.id, null, chara);
4022 num++;
4023 }
4024 }
4025 }
QuestManager quests
Definition: Game.cs:183
int days
Definition: Player.cs:75
Stats stats
Definition: Player.cs:1095
int fame
Definition: Player.cs:957
List< Quest > list
Definition: QuestManager.cs:11
Definition: Quest.cs:7
static List< Zone > ListDeliver()
Definition: Quest.cs:259
static Quest Create(string _id, string _idPerson=null, Chara c=null, bool assignQuest=true)
Definition: Quest.cs:241
static void UseSeed(int seed, Action action)
Definition: Rand.cs:24
SourceQuest quests
string[] tags
Definition: SourceQuest.cs:23
int dateQuest
Definition: Spatial.cs:286
SourceZone.Row source
Definition: Spatial.cs:453
virtual bool CanGiveRandomQuest
Definition: TraitChara.cs:123
HashSet< int > completedQuests
Definition: Zone.cs:40

References EClass._zone, TraitChara.CanGiveRandomQuest, Map.charas, Quest.Create(), World.date, Spatial.dateQuest, Player.Stats.days, Map.deadCharas, EClass.debug, Debug, CoreDebug.enable, Player.fame, EClass.game, Date.GetRaw(), Chara.homeZone, SourceQuest.Row.id, Chara.IsGuest(), IsPCFaction, Card.isSubsetCard, item, QuestManager.list, Quest.ListDeliver(), SourceQuest.Row.minFame, EClass.player, Game.quests, SourceManager.quests, Spatial.source, EClass.sources, Player.stats, SourceQuest.Row.tags, Chara.trait, Rand.UseSeed(), and EClass.world.

Referenced by LayerQuestBoard.OnSwitchContent(), and LayerQuestBoard.RefreshQuest().

◆ WriteNote()

void Zone.WriteNote ( UINote  n,
Action< UINote >  onWriteNote = null,
IInspect::NoteMode  mode = IInspect::NoteMode::Default,
Recipe  recipe = null 
)
inline

Implements IInspect.

Definition at line 3572 of file Zone.cs.

3573 {
3574 }

Member Data Documentation

◆ _biome

BiomeProfile Zone._biome

Definition at line 82 of file Zone.cs.

◆ bounds

◆ bp

ZoneBlueprint Zone.bp

Definition at line 70 of file Zone.cs.

Referenced by Activate().

◆ branch

◆ completedQuests

HashSet<int> Zone.completedQuests = new HashSet<int>()

Definition at line 40 of file Zone.cs.

Referenced by Quest.Complete(), and Quest.Fail().

◆ dictCitizen

Dictionary<int, string> Zone.dictCitizen = new Dictionary<int, string>()

Definition at line 55 of file Zone.cs.

Referenced by DramaCustomSequence.Build(), Quest.Create(), and Quest.ListDeliver().

◆ dirtyElectricity

bool Zone.dirtyElectricity

Definition at line 74 of file Zone.cs.

Referenced by Scene.OnUpdate().

◆ elements

◆ events

◆ fieldElements

ElementContainerField Zone.fieldElements = new ElementContainerField()

Definition at line 49 of file Zone.cs.

Referenced by WidgetDate._Refresh(), and GameDate.AdvanceMin().

◆ fileVariation

int Zone.fileVariation

Definition at line 72 of file Zone.cs.

◆ forceRegenerate

bool Zone.forceRegenerate
static

Definition at line 25 of file Zone.cs.

Referenced by Activate().

◆ forceSubset

string Zone.forceSubset
static

Definition at line 27 of file Zone.cs.

Referenced by Activate().

◆ fortuneRoll

FortuneRollData Zone.fortuneRoll
private

Definition at line 64 of file Zone.cs.

◆ ignoreSpawnAnime

bool Zone.ignoreSpawnAnime
static

Definition at line 84 of file Zone.cs.

◆ instance

◆ isSimulating

bool Zone.isSimulating

Definition at line 78 of file Zone.cs.

Referenced by Activate(), and Chara.GetGoalFromTimeTable().

◆ isStarted

◆ landFeats

List<int> Zone.landFeats

Definition at line 61 of file Zone.cs.

◆ map

◆ okaerinko

int Zone.okaerinko = 0
static

Definition at line 31 of file Zone.cs.

Referenced by AI_Idle.Run().

◆ pendingSimHours

int Zone.pendingSimHours

Definition at line 37 of file Zone.cs.

Referenced by Player.SimulateFaction().

◆ sourceHat

CardRow Zone.sourceHat
static

Definition at line 29 of file Zone.cs.

Referenced by CharaRenderer.Draw().

◆ subset

MapSubset Zone.subset

Definition at line 68 of file Zone.cs.

Referenced by Activate(), and MapSubset.Save().

◆ Suckers

List<Thing> Zone.Suckers = new List<Thing>()
static

Definition at line 86 of file Zone.cs.

Referenced by TraitSeed.TrySprout().

◆ tempDist

int Zone.tempDist

Definition at line 80 of file Zone.cs.

Referenced by LayerTravel.GetTravelFood(), and LayerTravel.Refresh().

◆ zoneId

string string Zone.zoneId
static

Definition at line 555 of file Zone.cs.

Referenced by ParseZoneFullName().

◆ zoneType

string Zone.zoneType
static

Definition at line 555 of file Zone.cs.

Referenced by ParseZoneFullName().

Property Documentation

◆ AddPrefix

virtual bool Zone.AddPrefix
get

Definition at line 290 of file Zone.cs.

Referenced by OnAfterCreate().

◆ AllowCriminal

virtual bool Zone.AllowCriminal
get

Definition at line 254 of file Zone.cs.

◆ AllowInvest

virtual bool Zone.AllowInvest
get

Definition at line 256 of file Zone.cs.

257 {
258 get
259 {
260 if (!IsTown && !IsPCFaction)
261 {
262 return Guild.GetCurrentGuild() != null;
263 }
264 return true;
265 }
266 }

◆ AllowNewZone

virtual bool Zone.AllowNewZone
get

Definition at line 268 of file Zone.cs.

Referenced by TraitNewZone.CanAutoEnter(), and TraitNewZone.TrySetAct().

◆ AlwaysLowblock

virtual bool Zone.AlwaysLowblock
get

Definition at line 402 of file Zone.cs.

Referenced by BaseTileMap.Draw().

◆ BaseElectricity

virtual int Zone.BaseElectricity
get

Definition at line 500 of file Zone.cs.

◆ BigDaddyChance

virtual float Zone.BigDaddyChance
get

Definition at line 328 of file Zone.cs.

◆ biome

◆ BlockBorderExit

virtual bool Zone.BlockBorderExit
get

Definition at line 176 of file Zone.cs.

Referenced by Player.CanExitBorder().

◆ Boss

Chara Zone.Boss
getset

Definition at line 90 of file Zone.cs.

91 {
92 get
93 {
94 return EClass._map.FindChara(base.uidBoss);
95 }
96 set
97 {
98 base.uidBoss = value?.uid ?? 0;
99 }
100 }
Chara FindChara(string id)
Definition: Map.cs:2778

Referenced by Scene.Init(), TraitNewZone.MoveZone(), ActEffect.Proc(), AI_Idle.Run(), ActThrow.Throw(), and Chara.TryDropBossLoot().

◆ CanBeDeliverDestination

virtual bool Zone.CanBeDeliverDestination
get

Definition at line 232 of file Zone.cs.

Referenced by Quest.ListDeliver().

◆ CanDigUnderground

virtual bool Zone.CanDigUnderground
get

Definition at line 280 of file Zone.cs.

Referenced by TaskMine.GetHitResult().

◆ CanEnterBuildMode

bool Zone.CanEnterBuildMode
get

Definition at line 452 of file Zone.cs.

453 {
454 get
455 {
457 {
458 return base.mainFaction == EClass.pc.faction;
459 }
460 return true;
461 }
462 }
bool godBuild
Definition: CoreDebug.cs:320
bool ignoreBuildRule
Definition: CoreDebug.cs:201

◆ CanEnterBuildModeAnywhere

bool Zone.CanEnterBuildModeAnywhere
get

Definition at line 464 of file Zone.cs.

465 {
466 get
467 {
469 {
470 if (base.mainFaction == EClass.pc.faction)
471 {
472 return EClass.Branch.elements.Has(4003);
473 }
474 return false;
475 }
476 return true;
477 }
478 }
ElementContainerZone elements

Referenced by WidgetMenuPanel._OnChangeMode(), ActionMode.DoFunc(), and HotbarManager.ResetHotbar().

◆ CanInspect

bool Zone.CanInspect
get

Implements IInspect.

Definition at line 504 of file Zone.cs.

505 {
506 get
507 {
508 if (!IsInstance)
509 {
510 return !HiddenInRegionMap;
511 }
512 return false;
513 }
514 }
virtual bool HiddenInRegionMap
Definition: Zone.cs:420

◆ CanUnlockExit

virtual bool Zone.CanUnlockExit
get

Definition at line 284 of file Zone.cs.

Referenced by TraitStairsLocked.OnUse(), and CoreDebug.UpdateInput().

◆ ChanceSpawnNeutral

virtual float Zone.ChanceSpawnNeutral
get

Definition at line 352 of file Zone.cs.

◆ ContentLv

override int Zone.ContentLv
get

Definition at line 102 of file Zone.cs.

103 {
104 get
105 {
106 if (branch == null)
107 {
108 return DangerLv;
109 }
110 return branch.ContentLV;
111 }
112 }

Referenced by DNA.GenerateRandomGene(), AI_Fish.Makefish(), and ConTransmuteMimic.OnBeforeStart().

◆ CountDeepestLevel

virtual bool Zone.CountDeepestLevel
get

Definition at line 234 of file Zone.cs.

◆ DangerLv

◆ DefaultActionMode

virtual ActionMode Zone.DefaultActionMode
get

Definition at line 174 of file Zone.cs.

◆ DisableRooms

virtual bool Zone.DisableRooms
get

Definition at line 126 of file Zone.cs.

Referenced by Map.TryAddRoom().

◆ EvolvedChance

virtual float Zone.EvolvedChance
get

Definition at line 330 of file Zone.cs.

◆ ExpireDays

virtual int Zone.ExpireDays
get

Definition at line 178 of file Zone.cs.

Referenced by Activate().

◆ FeatureType

virtual ZoneFeatureType Zone.FeatureType
get

Definition at line 182 of file Zone.cs.

◆ FlockType

virtual FlockController.SpawnType Zone.FlockType
get

Definition at line 422 of file Zone.cs.

Referenced by Scene.Init().

◆ Generator

MapGenerator Zone.Generator
get

Definition at line 144 of file Zone.cs.

Referenced by MapGenDungen.OnGenerateTerrain().

◆ GrowPlant

virtual bool Zone.GrowPlant
get

Definition at line 354 of file Zone.cs.

◆ GrowWeed

virtual bool Zone.GrowWeed
get

Definition at line 356 of file Zone.cs.

◆ HasLaw

virtual bool Zone.HasLaw
get

◆ HiddenInRegionMap

virtual bool Zone.HiddenInRegionMap
get

Definition at line 420 of file Zone.cs.

Referenced by Chara._Move().

◆ HourSinceLastActive

int Zone.HourSinceLastActive
get

Definition at line 128 of file Zone.cs.

◆ IDAmbience

virtual string Zone.IDAmbience
get

Definition at line 184 of file Zone.cs.

185 {
186 get
187 {
188 if (!IsRegion && !map.IsIndoor)
189 {
190 if (!IsTown)
191 {
192 return "forest";
193 }
194 return "town";
195 }
196 return null;
197 }
198 }

◆ IDBaseLandFeat

virtual string Zone.IDBaseLandFeat
get

Definition at line 154 of file Zone.cs.

◆ IdBiome

virtual string Zone.IdBiome
get

Definition at line 136 of file Zone.cs.

◆ idExport

virtual string Zone.idExport
get

Definition at line 156 of file Zone.cs.

157 {
158 get
159 {
160 if (base.source.idFile.Length != 0)
161 {
162 return base.source.idFile[fileVariation] + ((base.lv == 0) ? "" : ("_F" + base.lv));
163 }
164 return "";
165 }
166 }
int fileVariation
Definition: Zone.cs:72

Referenced by Activate(), MapSubset.Exist(), Zone_Dungeon.OnGenerateMap(), and MapSubset.Save().

◆ IDGenerator

virtual string Zone.IDGenerator
get

Definition at line 140 of file Zone.cs.

Referenced by ZoneBlueprint.GenerateMap(), and TraitNewZone.MoveZone().

◆ IDHat

virtual string Zone.IDHat
get

Definition at line 152 of file Zone.cs.

◆ IDPlayList

virtual string Zone.IDPlayList
get

Definition at line 148 of file Zone.cs.

◆ IDPlaylistOverwrite

virtual string Zone.IDPlaylistOverwrite
get

Definition at line 150 of file Zone.cs.

◆ IdProfile

virtual string Zone.IdProfile
get

Definition at line 146 of file Zone.cs.

◆ IDSceneTemplate

virtual string Zone.IDSceneTemplate
get

Definition at line 200 of file Zone.cs.

201 {
202 get
203 {
204 if (!EClass._map.IsIndoor)
205 {
206 if (!IsSnowZone)
207 {
208 return "Default";
209 }
210 return "Snow";
211 }
212 return "Indoor";
213 }
214 }
virtual bool IsSnowZone
Definition: Spatial.cs:542

Referenced by BaseGameScreen.RefreshGrading().

◆ IDSubset

virtual string Zone.IDSubset
get

Definition at line 218 of file Zone.cs.

219 {
220 get
221 {
222 if (!IsFestival)
223 {
224 return null;
225 }
226 return "festival";
227 }
228 }
virtual bool IsFestival
Definition: Zone.cs:216

Referenced by Activate().

◆ InspectName

string Zone.InspectName
get

Implements IInspect.

Definition at line 516 of file Zone.cs.

◆ InspectPoint

Point Zone.InspectPoint
get

Implements IInspect.

Definition at line 518 of file Zone.cs.

◆ InspectPosition

Vector3 Zone.InspectPosition
get

Implements IInspect.

Definition at line 520 of file Zone.cs.

◆ IsActiveZone

◆ IsExplorable

virtual bool Zone.IsExplorable
get

Definition at line 358 of file Zone.cs.

◆ IsFestival

◆ IsInstance

◆ IsLoaded

bool Zone.IsLoaded
get

Definition at line 498 of file Zone.cs.

Referenced by Activate().

◆ IsNefia

virtual bool Zone.IsNefia
get

Definition at line 292 of file Zone.cs.

Referenced by TraitNewZone.MoveZone(), AI_Idle.Run(), and Chara.TryDropBossLoot().

◆ IsPCFaction

bool Zone.IsPCFaction
get

Definition at line 480 of file Zone.cs.

Referenced by Chara._Move(), WidgetDate._Refresh(), Map._ValidateInstalled(), Activate(), LayerSleep.Advance(), WidgetStatsBar.Build(), DramaCustomSequence.Build(), Chara.CanDestroyPath(), ActRestrain.CanPerform(), QuestIntoDarkness.CanUpdateOnTalk(), QuestNevernight.CanUpdateOnTalk(), QuestVernis.CanUpdateOnTalk(), TraitGeneratorWheel.CanUse(), TraitLoytelMart.CanUse(), TraitMannequin.CanUse(), TraitShackle.CanUse(), GameLang.ConvertDrama(), Faction.CountWealth(), Card.Create(), ActEffect.DamageEle(), Chara.DoHostileAction(), CoreDebug.Fix_LostCore(), RankedZone.GetFactionName(), TaskBuild.GetHitResult(), TaskDig.GetHitResult(), Card.GetPrice(), Chara.GetRevived(), Chara.HasAccess(), QuestManager.HasFarAwayEscort(), TraitFoodEggFertilized.Incubate(), Quest.IsVisibleOnQuestBoard(), Quest.ListDeliver(), QuestDeliver.ListDestThing(), Props.ListThingStack(), Chara.MoveZone(), Region.OnActivate(), TraitHitchingPost.OnActivateTrap(), QuestRandom.OnDropReward(), Player.Flags.OnEnterZone(), LayerQuestBoard.OnInit(), ElementContainerZone.OnLevelUp(), TraitBlueprint.OnRead(), TraitBookSkill.OnRead(), TraitDeedRelocate.OnRead(), AM_Adv.OnRenderTile(), GoalSleep.OnSimulatePosition(), TraitFloorSwitch.OnStepped(), TraitBookResident.OnUse(), TraitBookRoster.OnUse(), TraitFarmChest.OnUse(), TraitPolicyBoard.OnUse(), ZoneEventWedding.OnVisit(), ActRestrain.Perform(), ActEffect.Proc(), Map.PutAway(), TraitBaseSpellbook.ReadFailEffect(), ContentHomeRanking.Refresh(), TCOrbitChara.RefreshAll(), UIInventory.RefreshMenu(), ContentFaction.RefreshZones(), AI_Eat.Run(), AI_Idle.Run(), WidgetSearch.Search(), Card.SetPlaceState(), UIFactionInfo.SetZone(), TraitTicketFurniture.SetZone(), TraitGeneratorWheel.ShouldWork(), Card.SpawnLoot(), Chara.Tick(), TaskDump.TryPerform(), TraitBed.TrySetAct(), TraitCoreZone.TrySetAct(), TraitFactionBoard.TrySetAct(), TraitHomeBoard.TrySetAct(), TraitPartyBoard.TrySetAct(), TraitResearchBoard.TrySetAct(), TraitResidentBoard.TrySetAct(), TraitSwitch.TrySetAct(), TraitWaystone.TrySetAct(), TraitSalesTag.TrySetHeldAct(), Trait.TrySetToggleAct(), Map.TryShatter(), AI_Shopping.TryShop(), TraitTeleporter.TryTeleport(), Card.TryUnrestrain(), GoalCombat.TryUseAbility(), TraitGeneratorWheel.Update(), GameUpdater.Update100ms(), UpdateQuests(), and Chara.Vomit().

◆ IsPCFactionOrTent

◆ IsReturnLocation

virtual bool Zone.IsReturnLocation
get

Definition at line 360 of file Zone.cs.

361 {
362 get
363 {
364 if (EClass.pc.homeZone != this)
365 {
366 return base.source.tag.Contains("return");
367 }
368 return true;
369 }
370 }

Referenced by SpatialManager.ListReturnLocations().

◆ IsSkyLevel

◆ IsStartZone

bool Zone.IsStartZone
get

Definition at line 494 of file Zone.cs.

◆ IsTown

◆ IsUnderwater

◆ IsUserZone

◆ KeepAllyDistance

virtual bool Zone.KeepAllyDistance
get

Definition at line 308 of file Zone.cs.

309 {
310 get
311 {
312 if (!HasLaw)
313 {
314 return IsPCFaction;
315 }
316 return true;
317 }
318 }

Referenced by Chara._Move(), and ConfigTactics.AllyDistance().

◆ LockExit

virtual bool Zone.LockExit
get

Definition at line 282 of file Zone.cs.

Referenced by MapGenDungen.OnGenerateTerrain().

◆ MakeEnemiesNeutral

virtual bool Zone.MakeEnemiesNeutral
get

Definition at line 240 of file Zone.cs.

241 {
242 get
243 {
244 if (!IsTown)
245 {
246 return HasLaw;
247 }
248 return true;
249 }
250 }

◆ MakeTownProperties

virtual bool Zone.MakeTownProperties
get

Definition at line 252 of file Zone.cs.

◆ MaxLv

virtual int Zone.MaxLv
get

Definition at line 286 of file Zone.cs.

◆ MaxRespawn

int Zone.MaxRespawn
get

Definition at line 322 of file Zone.cs.

◆ MaxSoil

virtual int Zone.MaxSoil
get

Definition at line 522 of file Zone.cs.

523 {
524 get
525 {
526 if (branch == null)
527 {
528 return 99999;
529 }
530 return branch.MaxSoil;
531 }
532 }

Referenced by WidgetStatsBar.Build(), Map.MineObj(), GrowSystem.PopHarvest(), and GrowSystem.TryPopSeed().

◆ MaxSpawn

virtual int Zone.MaxSpawn
get

Definition at line 320 of file Zone.cs.

◆ MinLv

virtual int Zone.MinLv
get

Definition at line 288 of file Zone.cs.

Referenced by Zone_Void.OnActivate(), and ActEffect.Proc().

◆ MinsSinceLastActive

int Zone.MinsSinceLastActive
get

Definition at line 130 of file Zone.cs.

◆ NameSuffix

override string Zone.NameSuffix
get

Definition at line 424 of file Zone.cs.

425 {
426 get
427 {
428 if (!IsNefia || !GetTopZone().isConquered)
429 {
430 return "";
431 }
432 return "conquered".lang();
433 }
434 }

◆ NameWithLevel

string Zone.NameWithLevel
get

◆ OreChance

virtual float Zone.OreChance
get

Definition at line 326 of file Zone.cs.

◆ ParentZone

◆ pathExport

virtual string Zone.pathExport
get

Definition at line 132 of file Zone.cs.

Referenced by Activate().

◆ pathTemp

string Zone.pathTemp
get

Definition at line 168 of file Zone.cs.

Referenced by PartialMap._Load(), and Activate().

◆ PetFollow

virtual bool Zone.PetFollow
get

Definition at line 294 of file Zone.cs.

Referenced by Chara._Move(), and AI_Idle.Run().

◆ PrespawnRate

virtual float Zone.PrespawnRate
get

Definition at line 334 of file Zone.cs.

◆ RegenerateOnEnter

virtual bool Zone.RegenerateOnEnter
get

Definition at line 272 of file Zone.cs.

Referenced by Activate(), and TraitNewZone.TrySetAct().

◆ Region

◆ RegionEnterState

virtual ZoneTransition.EnterState Zone.RegionEnterState
get

Definition at line 180 of file Zone.cs.

Referenced by Player.EnterLocalZone(), and LayerTravel.Refresh().

◆ RespawnPerHour

virtual int Zone.RespawnPerHour
get

Definition at line 350 of file Zone.cs.

◆ RespawnRate

virtual float Zone.RespawnRate
get

Definition at line 336 of file Zone.cs.

◆ RestrictBuild

virtual bool Zone.RestrictBuild
get

Definition at line 296 of file Zone.cs.

297 {
298 get
299 {
300 if (this is Zone_Civilized)
301 {
302 return !IsPCFaction;
303 }
304 return false;
305 }
306 }

Referenced by HotItemHeld.CanRotate(), TaskBuild.CanRotateBlock(), and TaskBuild.GetHitResult().

◆ RevealRoom

virtual bool Zone.RevealRoom
get

Definition at line 400 of file Zone.cs.

◆ RuinChance

virtual float Zone.RuinChance
get

Definition at line 324 of file Zone.cs.

Referenced by GenBounds.TryAddMapPiece().

◆ ScaleType

virtual ZoneScaleType Zone.ScaleType
get

Definition at line 418 of file Zone.cs.

◆ SetAlarmOnBreakLaw

virtual bool Zone.SetAlarmOnBreakLaw
get

Definition at line 238 of file Zone.cs.

Referenced by Point.CallGuard(), and GoalCombat.Run().

◆ ShouldAutoRevive

virtual bool Zone.ShouldAutoRevive
get

Definition at line 386 of file Zone.cs.

387 {
388 get
389 {
390 if (!ShouldRegenerate)
391 {
392 return IsPCFaction;
393 }
394 return true;
395 }
396 }

◆ ShouldMakeExit

virtual bool Zone.ShouldMakeExit
get

Definition at line 372 of file Zone.cs.

373 {
374 get
375 {
376 if (base.lv > MinLv)
377 {
378 return base.lv < MaxLv;
379 }
380 return false;
381 }
382 }
virtual int MaxLv
Definition: Zone.cs:286
virtual int MinLv
Definition: Zone.cs:288

Referenced by MapGenDungen.OnGenerateTerrain().

◆ ShouldRegenerate

virtual bool Zone.ShouldRegenerate
get

Definition at line 384 of file Zone.cs.

Referenced by Activate().

◆ ShowEnemyOnMinimap

bool Zone.ShowEnemyOnMinimap
get

Definition at line 338 of file Zone.cs.

339 {
340 get
341 {
342 if (instance != null)
343 {
345 }
346 return false;
347 }
348 }
virtual bool ShowEnemyOnMinimap
Definition: ZoneInstance.cs:30

Referenced by WidgetMinimap.RefreshMarkers().

◆ ShrineChance

virtual float Zone.ShrineChance
get

Definition at line 332 of file Zone.cs.

◆ SightRadiusBonus

virtual int Zone.SightRadiusBonus
get

Definition at line 138 of file Zone.cs.

Referenced by Card.CalculateFOV(), and Card.GetSightRadius().

◆ StartLV

virtual int Zone.StartLV
get

Definition at line 416 of file Zone.cs.

Referenced by OnCreate().

◆ TextDangerLv

string Zone.TextDangerLv
get

Definition at line 438 of file Zone.cs.

Referenced by WidgetDate._Refresh().

◆ TextDeepestLv

string Zone.TextDeepestLv
get

Definition at line 440 of file Zone.cs.

441 {
442 get
443 {
444 if (GetDeepestLv() != 0)
445 {
446 return "zoneLevelMax".lang(TextLevel(GetDeepestLv()));
447 }
448 return "";
449 }
450 }
string TextLevel(int _lv)
Definition: Zone.cs:605

Referenced by AM_Adv._OnUpdateInput().

◆ TextWidgetDate

virtual string Zone.TextWidgetDate
get

Definition at line 142 of file Zone.cs.

Referenced by WidgetDate._Refresh().

◆ UseFog

virtual bool Zone.UseFog
get

Definition at line 398 of file Zone.cs.

Referenced by Activate(), BaseTileMap.DrawTile(), and Fov.Perform().

◆ UseLight

virtual bool Zone.UseLight
get

Definition at line 404 of file Zone.cs.

405 {
406 get
407 {
408 if (base.mainFaction != EClass.pc.faction)
409 {
410 return base.source.tag.Contains("light");
411 }
412 return true;
413 }
414 }

Referenced by EloMap.Init(), and EloMap.SetZone().

◆ WillAutoSave

virtual bool Zone.WillAutoSave
get

Definition at line 270 of file Zone.cs.

Referenced by Chara.MoveZone().

◆ ZoneFullName

string Zone.ZoneFullName
get

Definition at line 88 of file Zone.cs.

Referenced by Activate(), and CustomCharaContent.OnGameLoad().


The documentation for this class was generated from the following file: