Elin Decompiled Documentation EA 23.335 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)
 
GetRandomSpot< T > ()
 
bool TryAddThingInSpot< T > (Thing t, bool useContainer=true)
 
List< ThingTryListThingsInSpot< 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)
 
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< ElementListLandFeats ()
 
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< CharaListMinions (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
 
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< Spatialchildren = new List<Spatial>()
 
List< Spatialconnections = 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< ThingSuckers = 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 1968 of file Zone.cs.

1969 {
1970 if (CanDestroy())
1971 {
1972 Debug.Log("Deleting Zone:" + this);
1973 if (!destryoed)
1974 {
1975 Destroy();
1976 }
1977 }
1978 else if (map != null)
1979 {
1980 Debug.Log("Saving Zone:" + this);
1981 map.Save(base.pathSave);
1982 if (!base.isMapSaved)
1983 {
1984 base.isMapSaved = true;
1985 IO.DeleteDirectory(base.pathSave + "Texture Replace");
1986 IO.CopyDir(pathTemp + "Texture Replace", base.pathSave + "/Texture Replace");
1987 }
1988 if (!IsActiveZone)
1989 {
1990 UnloadMap();
1991 }
1992 }
1993 }
Definition: IO.cs:10
static void DeleteDirectory(string path)
Definition: IO.cs:392
static void CopyDir(string sourceDirectory, string targetDirectory, Func< string, bool > funcExclude=null)
Definition: IO.cs:276
void Save(string path, ZoneExportData export=null, PartialMap partial=null)
Definition: Map.cs:376
bool destryoed
Definition: Spatial.cs:45
bool CanDestroy()
Definition: Zone.cs:1903
override void Destroy()
Definition: Zone.cs:2004
bool IsActiveZone
Definition: Zone.cs:499
void UnloadMap()
Definition: Zone.cs:1819
string pathTemp
Definition: Zone.cs:165
Map map
Definition: Zone.cs:63

References CanDestroy(), Debug, Destroy(), Spatial.destryoed, IsActiveZone, map, pathTemp, Map.Save(), and UnloadMap().

◆ AbandonZone()

void Zone.AbandonZone ( )
inline

Definition at line 1887 of file Zone.cs.

1888 {
1889 FactionBranch destBranch = ((EClass.pc.homeBranch == branch) ? EClass.game.StartZone.branch : EClass.pc.homeBranch);
1890 branch.members.ForeachReverse(delegate(Chara m)
1891 {
1892 destBranch.AddMemeber(m);
1893 if (!m.IsPCParty)
1894 {
1895 m.MoveZone(destBranch.owner);
1896 }
1897 });
1899 SetMainFaction(null);
1900 base.dateExpire = EClass.world.date.GetRaw() + 10080;
1901 }
Definition: Chara.cs:10
override bool IsPCParty
Definition: Chara.cs:633
FactionBranch homeBranch
Definition: Chara.cs:1113
void MoveZone(string alias)
Definition: Chara.cs:3548
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, Spatial.SetMainFaction(), Game.StartZone, and EClass.world.

◆ Activate()

void Zone.Activate ( )
inline

Definition at line 636 of file Zone.cs.

637 {
638 if (IsRegion)
639 {
641 }
642 isStarted = (isSimulating = false);
643 base.isKnown = true;
644 EClass.game.config.reverseSnow = false;
646 {
647 Msg.Say("regenerateZone", Name);
648 ClearZones();
649 if (EClass.pc.global.transition != null)
650 {
651 EClass.pc.global.transition.uidLastZone = 0;
652 }
653 }
655 if (EClass.game.activeZone != null)
656 {
658 }
659 EClass.game.activeZone = this;
660 ZoneExportData zoneExportData = null;
661 Debug.Log(NameWithLevel + "/" + id + "/" + base.uid + "/" + base.isGenerated + "/" + IsLoaded + "/" + File.Exists(base.pathSave + "map"));
662 if (base.isGenerated && !IsLoaded && !File.Exists(base.pathSave + "map"))
663 {
664 Debug.Log("(Bug) File does not exist:" + destryoed + "/" + base.pathSave);
665 base.isGenerated = false;
666 }
667 bool flag = false;
668 Debug.Log(idCurrentSubset + "/" + IDSubset);
669 bool flag2 = idCurrentSubset != IDSubset || forceSubset != null;
670 if (flag2 && map != null)
671 {
672 UnloadMap();
673 }
674 string fullName = pathExport;
675 string lhs = CorePath.ZoneSave + "_new.z";
676 bool flag3 = File.Exists(fullName) && !PathComparer.Default.Equals(lhs, fullName);
677 bool flag4 = !idExport.IsEmpty();
678 Debug.Log(idExport + "/" + flag3 + "/" + fullName);
679 if (!flag3 && (base.source.tag.Contains("addMap") || flag4))
680 {
681 string[] array = new string[4]
682 {
683 "Maps/" + idExport + ".z",
684 "Maps/" + ZoneFullName + ".z",
685 "Map/" + idExport + ".z",
686 "Map/" + ZoneFullName + ".z"
687 };
688 for (int i = 0; i < array.Length; i++)
689 {
690 FileInfo fileInfo = PackageIterator.GetFiles(array[i]).LastOrDefault();
691 if (fileInfo != null)
692 {
693 fullName = fileInfo.FullName;
694 flag3 = true;
695 flag4 = true;
696 break;
697 }
698 }
699 }
700 if (!base.isGenerated && (!flag4 || !flag3))
701 {
702 Debug.Log("generating random map");
703 flag = true;
704 base.dateExpire = EClass.world.date.GetRaw() + 1440 * ExpireDays;
705 Generate();
707 if (instance != null)
708 {
710 }
711 if (!UseFog)
712 {
713 map.ForeachCell(delegate(Cell c)
714 {
715 c.isSeen = true;
716 });
717 }
718 if (!(bp is GameBlueprint))
719 {
721 }
722 }
723 else if (IsLoaded)
724 {
725 Debug.Log("zone is already loaded");
726 map.SetZone(this);
727 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
729 }
730 else
731 {
732 subset = null;
733 bool flag5 = (base.isGenerated && flag2) || (base.isGenerated && !IsInstance && !IsPCFaction && ShouldRegenerate && EClass.world.date.IsExpired(base.dateRegenerate)) || forceRegenerate;
735 {
736 flag5 = false;
737 flag2 = false;
738 }
739 Debug.Log(base.isGenerated + "/" + flag5 + "/" + flag2 + "/" + IDSubset);
740 if (!base.isGenerated || flag5 || flag2)
741 {
742 Debug.Log("importing map:" + fullName);
743 flag = true;
744 base.dateRegenerate = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRegenerateZone;
745 if (!flag5)
746 {
747 IO.DeleteDirectory(pathTemp + "Texture Replace");
748 Debug.Log(pathTemp);
749 }
750 try
751 {
752 zoneExportData = Import(fullName);
753 base.isGenerated = true;
754 isImported = true;
755 if (flag5)
756 {
757 zoneExportData.orgMap = GameIO.LoadFile<Map>(base.pathSave + "map");
758 }
759 }
760 catch (Exception message)
761 {
762 Debug.Log(message);
763 zoneExportData = Import(CorePath.ZoneSave + "fail.z");
764 base.isGenerated = true;
765 isImported = true;
766 }
767 }
769 Debug.Log("loading map: imported? " + isImported + " regenerate? " + flag5);
770 string text = (isImported ? pathTemp : base.pathSave) + "map";
771 try
772 {
773 map = GameIO.LoadFile<Map>(text);
774 }
775 catch (Exception message2)
776 {
777 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);
778 Debug.LogError(message2);
779 return;
780 }
781 map.SetZone(this);
782 map.Load(isImported ? pathTemp : base.pathSave, isImported);
784 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
785 if (isImported)
786 {
787 map.deadCharas.Clear();
788 map.OnImport(zoneExportData);
789 if (UseFog && !flag5)
790 {
791 map.ForeachCell(delegate(Cell c)
792 {
793 c.isSeen = false;
794 });
795 }
796 if (zoneExportData.orgMap != null)
797 {
798 Map orgMap = zoneExportData.orgMap;
799 List<Chara> serializedCharas = map.serializedCharas;
800 map.charas = orgMap.charas;
801 map.serializedCharas = orgMap.serializedCharas;
802 map.deadCharas = orgMap.deadCharas;
803 byte[] array2 = orgMap.TryLoadFile(base.pathSave, "flags", EClass._map.Size * EClass._map.Size);
804 if (array2 != null && array2.Length == EClass._map.Size * EClass._map.Size)
805 {
806 for (int j = 0; j < EClass._map.Size; j++)
807 {
808 for (int k = 0; k < EClass._map.Size; k++)
809 {
810 map.cells[j, k].isSeen = array2[j * EClass._map.Size + k].GetBit(1);
811 }
812 }
813 }
814 foreach (Chara item in serializedCharas)
815 {
816 Debug.Log("Importing New Chara:" + item.id + "/" + item.Name + "/" + item.orgPos);
818 }
819 map.things.ForeachReverse(delegate(Thing t)
820 {
821 if (t.trait is TraitNewZone || t.trait is TraitPowerStatue)
822 {
823 foreach (Thing thing in orgMap.things)
824 {
825 if (t.id == thing.id && t.pos.Equals(thing.pos))
826 {
827 if (t.trait is TraitNewZone)
828 {
829 RemoveCard(t);
830 map.things.Insert(0, thing);
831 thing.stackOrder = 0;
832 }
833 else
834 {
835 t.ChangeMaterial(thing.material);
836 t.isOn = thing.isOn;
837 }
838 break;
839 }
840 }
841 return;
842 }
843 if (t.trait is TraitStairsLocked)
844 {
845 foreach (Thing thing2 in orgMap.things)
846 {
847 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
848 {
849 RemoveCard(t);
850 map.things.Add(thing2);
851 break;
852 }
853 }
854 return;
855 }
856 if (t.id == "medal" || t.id == "856")
857 {
858 foreach (Thing thing3 in orgMap.things)
859 {
860 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
861 {
862 return;
863 }
864 }
865 RemoveCard(t);
866 }
867 });
868 foreach (KeyValuePair<int, int> item2 in EClass._map.backerObjs.ToList())
869 {
870 EClass._map.GetCell(item2.Key);
871 SourceBacker.Row row = EClass.sources.backers.map[item2.Value];
873 {
874 map.backerObjs.Remove(item2.Key);
875 }
876 }
877 foreach (Chara serializedChara in map.serializedCharas)
878 {
879 if (serializedChara.orgPos != null && serializedChara.orgPos.IsValid)
880 {
881 serializedChara.pos.Set(serializedChara.orgPos);
882 }
883 }
884 foreach (Thing thing4 in orgMap.things)
885 {
886 if (thing4.trait is TraitTent && !thing4.isNPCProperty)
887 {
888 thing4.AddEditorTag(EditorTag.NoNpcProperty);
889 thing4.isSubsetCard = false;
890 map.things.Add(thing4);
891 Debug.Log(thing4);
892 }
893 }
894 }
895 }
896 foreach (Thing thing5 in map.things)
897 {
898 map.AddCardOnActivate(thing5);
899 }
900 foreach (Chara c3 in map.serializedCharas)
901 {
902 if (c3.c_uidMaster == 0 || EClass.player.listCarryoverMap.Find((Chara c2) => c2.uid == c3.uid) == null)
903 {
904 map.charas.Add(c3);
906 }
907 }
908 map.serializedCharas.Clear();
909 if (isImported && IsTown)
910 {
912 }
915 map.OnLoad();
916 if (flag5)
917 {
918 foreach (Card item3 in map.Cards.ToList())
919 {
920 if (item3.isSubsetCard)
921 {
922 item3.Destroy();
923 }
924 }
925 }
926 if (isImported)
927 {
929 if (idCurrentSubset != null)
930 {
932 subset.Apply();
933 }
934 }
935 if (isImported)
936 {
938 {
939 foreach (Thing thing6 in map.things)
940 {
941 thing6.isNPCProperty = !thing6.isHidden && !thing6.HasEditorTag(EditorTag.NoNpcProperty);
942 }
943 }
944 else
945 {
946 foreach (Thing thing7 in map.things)
947 {
948 thing7.isNPCProperty = false;
949 }
950 }
952 if (instance != null)
953 {
955 }
956 }
957 if (isImported && !flag5 && !RevealRoom)
958 {
959 foreach (Room item4 in map.rooms.listRoom)
960 {
961 if (!item4.HasRoof || item4.data.atrium)
962 {
963 continue;
964 }
965 foreach (Point point2 in item4.points)
966 {
967 point2.cell.isSeen = false;
968 }
969 }
970 }
971 if (flag5)
972 {
973 OnRegenerate();
974 }
975 }
976 PathManager.Instance._pathfinder.PunishChangeDirection = false;
977 isImported = false;
978 if (this is Zone_Tent && IsUnderwater)
979 {
980 EClass._map.config.idSceneProfile = "indoor_water";
981 EClass.scene.profile = SceneProfile.Load(EClass._map.config.idSceneProfile);
982 }
983 if (flag && IsTown && base.lv == 0)
984 {
986 }
987 if (base.visitCount == 0)
988 {
989 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
990 }
991 map.ForeachCell(delegate(Cell c)
992 {
993 if (c.HasFire)
994 {
995 map.effectManager.GetOrCreate(c.GetSharedPoint());
996 }
997 if (IsRegion)
998 {
999 c.decal = 0;
1000 }
1001 });
1003 {
1004 RainWater();
1005 }
1007 {
1008 map.ForeachCell(delegate(Cell c)
1009 {
1010 c.isSeen = true;
1011 });
1012 }
1013 isStarted = true;
1014 Map.isDirtySunMap = true;
1016 if (events.listPreEnter.Count > 0)
1017 {
1018 foreach (ZonePreEnterEvent item5 in events.listPreEnter)
1019 {
1020 item5.Execute();
1021 }
1022 events.listPreEnter.Clear();
1023 }
1024 foreach (Card card in map.Cards)
1025 {
1026 card.CalculateFOV();
1027 if (card.isChara)
1028 {
1029 Chara chara = card.Chara;
1030 chara.dirtySpeed = true;
1031 if (!card.isDyed && card.HasTag(CTAG.random_color))
1032 {
1033 card.DyeRandom();
1034 }
1035 if (card.IsUnique && !card.IsPCFaction && !card.IsPCParty)
1036 {
1037 Point point = chara.orgPos ?? card.pos;
1038 card.c_uniqueData = new UniqueData
1039 {
1040 x = point.x,
1041 y = point.z,
1042 uidZone = base.uid
1043 };
1044 }
1045 int @int = card.GetInt(55);
1046 if (@int != 0)
1047 {
1048 foreach (Chara chara2 in map.charas)
1049 {
1050 if (chara2.uid == @int)
1051 {
1052 if (chara.IsHostile(chara2))
1053 {
1054 chara.enemy = chara2;
1055 chara.SetAI(new GoalCombat());
1056 chara.calmCheckTurn = 20 + EClass.rnd(30);
1057 }
1058 break;
1059 }
1060 }
1061 card.SetInt(55);
1062 }
1063 chara.SyncRide();
1064 if (card.c_uidMaster != 0 && chara.master == null)
1065 {
1066 chara.FindMaster();
1067 }
1068 if (!EClass.game.isLoading)
1069 {
1070 chara.enemy = null;
1071 if (chara.IsInCombat)
1072 {
1073 chara.SetNoGoal();
1074 }
1075 }
1076 }
1077 else if (card.IsInstalled && card.trait is TraitDoor traitDoor && card.pos.HasChara && !traitDoor.IsOpen())
1078 {
1079 traitDoor.ToggleDoor(sound: false, refresh: false);
1080 }
1081 }
1082 RefreshHat();
1083 forceRegenerate = false;
1084 forceSubset = null;
1085 EClass.ui.OnActivateZone();
1087 EClass.Sound.LoadAmbience(IDAmbience);
1088 if (EClass.Branch != null)
1089 {
1091 }
1092 OnVisit();
1093 if (flag)
1094 {
1096 }
1098 if (IsPCFaction)
1099 {
1100 EClass.player.uidLastTown = 0;
1101 }
1102 else if (IsTown && base.lv == 0)
1103 {
1104 EClass.player.uidLastTown = base.uid;
1105 }
1106 RefreshBGM();
1107 Rand.InitBytes(map.seed + 1);
1109 okaerinko = 0;
1110 if (EClass.debug.enable)
1111 {
1112 ModInfluence(2000);
1113 }
1114 if (this is Zone_TinkerCamp)
1115 {
1116 Tutorial.Reserve("tinker");
1117 }
1118 else if (this is Zone_Town && !(this is Zone_SubTown))
1119 {
1120 Tutorial.Reserve("town");
1121 }
1122 }
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
SourceMaterial.Row material
Definition: Card.cs:2103
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3214
int c_uidMaster
Definition: Card.cs:1489
void AddEditorTag(EditorTag tag)
Definition: Card.cs:2738
Point pos
Definition: Card.cs:60
int uid
Definition: Card.cs:125
Trait trait
Definition: Card.cs:54
void Destroy()
Definition: Card.cs:5305
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2733
bool isOn
Definition: Card.cs:545
Definition: Cell.cs:7
bool isSeen
Definition: Cell.cs:290
bool HasFire
Definition: Cell.cs:684
AIAct SetNoGoal()
Definition: Chara.cs:9408
bool IsInCombat
Definition: Chara.cs:911
AIAct SetAI(AIAct g)
Definition: Chara.cs:9413
Point orgPos
Definition: Chara.cs:21
GlobalData global
Definition: Chara.cs:76
Chara master
Definition: Chara.cs:88
Chara FindMaster()
Definition: Chara.cs:2618
void SyncRide()
Definition: Chara.cs:4181
bool IsHostile()
Definition: Chara.cs:6873
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:570
bool revealMap
Definition: CoreDebug.cs:169
bool enable
Definition: CoreDebug.cs:301
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:311
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:2405
Cell GetCell(int index)
Definition: Map.cs:900
IEnumerable< Card > Cards
Definition: Map.cs:135
void AddCardOnActivate(Card c)
Definition: Map.cs:795
void SetZone(Zone _zone)
Definition: Map.cs:181
List< Thing > things
Definition: Map.cs:49
byte[] TryLoadFile(string path, string s, int size)
Definition: Map.cs:541
Dictionary< int, int > backerObjs
Definition: Map.cs:67
List< Chara > deadCharas
Definition: Map.cs:46
int seed
Definition: Map.cs:19
RoomManager rooms
Definition: Map.cs:31
void SetReference()
Definition: Map.cs:195
void OnLoad()
Definition: Map.cs:720
void OnImport(ZoneExportData data)
Definition: Map.cs:726
List< Chara > serializedCharas
Definition: Map.cs:43
Cell[,] cells
Definition: Map.cs:85
MapConfig config
Definition: Map.cs:37
void Load(string path, bool import=false, PartialMap partial=null)
Definition: Map.cs:552
List< Chara > charas
Definition: Map.cs:81
void RefreshAllTiles()
Definition: Map.cs:2154
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:1293
HashSet< int > doneBackers
Definition: Player.cs:1140
bool simulatingZone
Definition: Player.cs:1249
Definition: Point.cs:9
Point Set(int _x, int _z)
Definition: Point.cs:503
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool Equals(int _x, int _z)
Definition: Point.cs:966
bool IsValid
Definition: Point.cs:88
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:993
EloMapActor elomapActor
Definition: Scene.cs:101
SourceBacker backers
string idCurrentSubset
Definition: Spatial.cs:28
virtual bool IsRegion
Definition: Spatial.cs:515
virtual string Name
Definition: Spatial.cs:509
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:85
bool isSimulating
Definition: Zone.cs:75
void RefreshElectricity()
Definition: Zone.cs:3105
ZoneExportData Import(string path)
Definition: Zone.cs:3380
void Generate()
Definition: Zone.cs:2479
ZoneEventManager events
Definition: Zone.cs:40
static string forceSubset
Definition: Zone.cs:27
virtual bool RegenerateOnEnter
Definition: Zone.cs:269
static int okaerinko
Definition: Zone.cs:31
virtual string idExport
Definition: Zone.cs:154
virtual bool MakeTownProperties
Definition: Zone.cs:249
virtual void OnRegenerate()
Definition: Zone.cs:1233
bool isStarted
Definition: Zone.cs:73
virtual string pathExport
Definition: Zone.cs:129
MapSubset subset
Definition: Zone.cs:65
Zone GetTopZone()
Definition: Zone.cs:2054
virtual string IDSubset
Definition: Zone.cs:216
ZoneBlueprint bp
Definition: Zone.cs:67
void RefreshBGM()
Definition: Zone.cs:3233
void Deactivate()
Definition: Zone.cs:1737
void SpawnLostItems()
Definition: Zone.cs:3972
void AddGlobalCharasOnActivate()
Definition: Zone.cs:1656
bool IsInstance
Definition: Zone.cs:493
void ClearZones(Zone current=null)
Definition: Zone.cs:2023
void OnVisit()
Definition: Zone.cs:1134
virtual bool IsTown
Definition: Zone.cs:227
void RainWater()
Definition: Zone.cs:3618
virtual bool UseFog
Definition: Zone.cs:395
virtual string IDAmbience
Definition: Zone.cs:182
void RemoveCard(Card t)
Definition: Zone.cs:2138
void RefreshHat()
Definition: Zone.cs:1124
void ModInfluence(int a)
Definition: Zone.cs:3830
virtual void OnGenerateMap()
Definition: Zone.cs:2697
static bool forceRegenerate
Definition: Zone.cs:25
bool IsPCFaction
Definition: Zone.cs:477
virtual bool IsUnderwater
Definition: Zone.cs:273
virtual bool ShouldRegenerate
Definition: Zone.cs:381
string NameWithLevel
Definition: Zone.cs:433
ZoneInstance instance
Definition: Zone.cs:55
virtual bool RevealRoom
Definition: Zone.cs:397
bool IsLoaded
Definition: Zone.cs:495
void RefreshListCitizen()
Definition: Zone.cs:3788
virtual int ExpireDays
Definition: Zone.cs:175
virtual void OnVisitNewMapOrRegenerate()
Definition: Zone.cs:1273

References $, EClass._map, Game.activeZone, ActPlan.List.Add(), Map.AddCardOnActivate(), Card.AddEditorTag(), AddGlobalCharasOnActivate(), MapSubset.Apply(), TextureManager.ApplyLocalReplace(), AreaData.atrium, Map.backerObjs, SourceManager.backers, GameSetting.balance, bp, EClass.Branch, Card.c_uidMaster, card, Map.Cards, Map.cells, Card.ChangeMaterial(), Map.charas, ClearZones(), Core.config, Map.config, EClass.core, Game.countLoadedMaps, BaseArea.data, World.date, GameSetting.BalanceSetting.dateRegenerateZone, GameSetting.BalanceSetting.dateRevive, Deactivate(), Map.deadCharas, EClass.debug, Debug, Card.Destroy(), Spatial.destryoed, Player.doneBackers, Region.elomap, Scene.elomapActor, CoreDebug.enable, Point.Equals(), events, ZonePreEnterEvent.Execute(), ExpireDays, Chara.FindMaster(), forceRegenerate, forceSubset, Map.ForeachCell(), EClass.game, Generate(), Map.GetCell(), Guild.GetCurrentGuild(), Date.GetRaw(), GetTopZone(), Chara.global, Card.HasEditorTag(), Cell.HasFire, Room.HasRoof, Card.id, SourceBacker.Row.id, IDAmbience, Spatial.idCurrentSubset, idExport, MapConfig.idSceneProfile, IDSubset, if(), CoreConfig.Test.ignoreBackerDestoryFlag, Import(), Rand.InitBytes(), EloMapActor.Initialize(), instance, Date.IsExpired(), Chara.IsHostile(), Spatial.isImported, Chara.IsInCombat, IsInstance, IsLoaded, Game.isLoading, Card.isNPCProperty, Card.isOn, IsPCFaction, Weather.IsRaining, Spatial.IsRegion, Cell.isSeen, isSimulating, isStarted, Card.isSubsetCard, IsTown, IsUnderwater, Point.IsValid, item, Player.listCarryoverMap, ZoneEventManager.listPreEnter, RoomManager.listRoom, MapSubset.Load(), SceneProfile.Load(), Map.Load(), MakeTownProperties, map, Chara.master, Card.material, ModInfluence(), Spatial.Name, NameWithLevel, okaerinko, FactionBranch.OnActivateZone(), OnGenerateMap(), ZoneInstance.OnGenerateMap(), Map.OnImport(), Map.OnLoad(), OnRegenerate(), OnVisit(), OnVisitNewMapOrRegenerate(), ZoneExportData.orgMap, Chara.orgPos, pathExport, pathTemp, EClass.pc, EClass.player, BaseArea.points, Card.pos, RainWater(), Scene.RebuildActorEx(), Map.RefreshAllTiles(), RefreshBGM(), Guild.RefreshDevelopment(), RefreshElectricity(), RefreshHat(), RefreshListCitizen(), RegenerateOnEnter, RemoveCard(), Tutorial.Reserve(), CoreDebug.revealMap, RevealRoom, EClass.rnd(), Map.rooms, Msg.Say(), EClass.scene, Map.seed, Map.serializedCharas, Point.Set(), Chara.SetAI(), Chara.SetNoGoal(), Map.SetReference(), EClass.setting, Map.SetZone(), ShouldRegenerate, Player.simulatingZone, MapBounds.Size, EClass.Sound, EClass.sources, SpawnLostItems(), subset, Chara.SyncRide(), CoreConfig.test, Core.textures, Card.things, Map.things, Card.trait, GlobalData.transition, Map.TryLoadFile(), EClass.ui, Card.uid, UnloadMap(), UseFog, World.weather, EClass.world, Point.x, Spatial.x, Spatial.y, Point.z, ZoneFullName, and CorePath.ZoneSave.

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

◆ AddCard() [1/3]

Card Zone.AddCard ( Card  t)
inline

Definition at line 2103 of file Zone.cs.

2104 {
2105 return AddCard(t, 0, 0);
2106 }
Card AddCard(Card t, Point point)
Definition: Zone.cs:2098

References AddCard().

◆ AddCard() [2/3]

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

Definition at line 2108 of file Zone.cs.

2109 {
2110 if (t.parent != null)
2111 {
2112 t.parent.RemoveCard(t);
2113 }
2114 t.parent = this;
2115 Chara chara = t.Chara;
2116 if (chara != null)
2117 {
2118 chara.currentZone = this;
2119 chara.SetAI(new NoGoal());
2120 }
2121 if (IsActiveZone)
2122 {
2123 map.OnCardAddedToZone(t, x, z);
2124 if (isStarted && t.isThing && t.placeState == PlaceState.roaming && !ignoreSpawnAnime)
2125 {
2126 t.PlayAnimeLoot();
2127 }
2128 ignoreSpawnAnime = false;
2129 }
2130 if (chara != null && EClass.player != null && !chara.hasSpawned)
2131 {
2132 EClass.player.codex.AddSpawn(chara.id);
2133 chara.hasSpawned = true;
2134 }
2135 return t;
2136 }
PlaceState
Definition: PlaceState.cs:2
virtual bool isThing
Definition: Card.cs:2133
virtual Chara Chara
Definition: Card.cs:2122
ICardParent parent
Definition: Card.cs:56
bool hasSpawned
Definition: Card.cs:905
PlaceState placeState
Definition: Card.cs:86
void PlayAnimeLoot()
Definition: Card.cs:6662
void AddSpawn(string id)
Definition: CodexManager.cs:65
void OnCardAddedToZone(Card t, int x, int z)
Definition: Map.cs:818
Definition: NoGoal.cs:4
CodexManager codex
Definition: Player.cs:1182
static bool ignoreSpawnAnime
Definition: Zone.cs:81
void RemoveCard(Card c)

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

◆ AddCard() [3/3]

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

Definition at line 2098 of file Zone.cs.

2099 {
2100 return AddCard(t, point.x, point.z);
2101 }

References AddCard(), Point.x, and Point.z.

Referenced by InvOwnerChaosOffering._OnProcess(), TraitShrine._OnUse(), Game.AddAdventurers(), AddCard(), AddCardSplinkle(), AddChara(), ZoneUtil.AddMerchant(), Quest.AddResident(), AddThing(), 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(), Simulate(), ZoneEventMusic.Spawn(), CoreDebug.Spawn(), SpawnAltar(), ReligionExtension.SpawnAltar(), Card.SpawnLoot(), SpawnLostItems(), SurvivalManager.StartRaid(), ActThrow.Throw(), TryAddThing(), TryAddThingInSpot< T >(), 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 2063 of file Zone.cs.

2064 {
2065 Point point = new Point(center);
2066 for (int i = 0; i < 1000; i++)
2067 {
2068 point.x = center.x + EClass.rnd(radius) - EClass.rnd(radius);
2069 point.z = center.z + EClass.rnd(radius) - EClass.rnd(radius);
2070 if (point.IsValid && !point.IsBlocked && !point.HasChara)
2071 {
2072 return AddCard(t, point);
2073 }
2074 }
2075 return AddCard(t, center);
2076 }
bool IsBlocked
Definition: Point.cs:363
bool HasChara
Definition: Point.cs:238

References AddCard(), 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 2083 of file Zone.cs.

2084 {
2085 return AddChara(id, p.x, p.z);
2086 }
Chara AddChara(string id, int x, int z)
Definition: Zone.cs:2078

References AddChara(), Point.x, and Point.z.

◆ AddGlobalCharasOnActivate()

void Zone.AddGlobalCharasOnActivate ( )
inline

Definition at line 1656 of file Zone.cs.

1657 {
1658 Point spawnPosPC = null;
1659 if (EClass.pc.currentZone == this)
1660 {
1661 spawnPosPC = GetSpawnPos(EClass.pc);
1662 }
1663 if (spawnPosPC == null)
1664 {
1665 spawnPosPC = map.GetCenterPos();
1666 }
1667 if (spawnPosPC.IsValid && EClass.pc.global.transition != null && spawnPosPC.HasBlock)
1668 {
1669 spawnPosPC = spawnPosPC.GetNearestPoint();
1670 }
1671 spawnPosPC = spawnPosPC.Clamp(useBounds: true).GetNearestPoint();
1672 foreach (Chara c in EClass.game.cards.globalCharas.Values)
1673 {
1674 if (c.currentZone != this)
1675 {
1676 continue;
1677 }
1678 if (c.parent is Chara)
1679 {
1680 Chara chara = c.parent as Chara;
1681 c.currentZone = chara.currentZone;
1682 }
1683 else
1684 {
1685 if (c.isDead)
1686 {
1687 continue;
1688 }
1689 if (c.isRestrained && c.currentZone == EClass.pc.currentZone && (!c.pos.IsValid || c.pos.FindThing<TraitShackle>() == null))
1690 {
1691 c.isRestrained = false;
1692 }
1693 if (c.global.transition != null)
1694 {
1695 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true) : GetSpawnPos(c)));
1696 if (c.IsPCParty && !c.IsPC)
1697 {
1698 if (c.host == EClass.pc)
1699 {
1700 pos.Set(spawnPosPC);
1701 }
1702 else if (pos.Equals(spawnPosPC) || !PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
1703 {
1704 c.pos.Set(spawnPosPC);
1705 if (!spawnPosPC.ForeachNearestPoint(delegate(Point p)
1706 {
1707 if (PathManager.Instance.IsPathClear(spawnPosPC, p, c, 10) && !p.Equals(spawnPosPC))
1708 {
1709 pos.Set(p);
1710 return true;
1711 }
1712 return false;
1713 }, allowBlock: false, EClass.pc.party.members.Count >= 12, allowInstalled: true, ignoreCenter: true, EClass._zone.IsRegion ? 2 : 6))
1714 {
1715 pos.Set(spawnPosPC);
1716 }
1717 }
1718 }
1719 c.pos.Set(pos);
1720 c.global.transition = null;
1721 }
1722 map.charas.Add(c);
1724 }
1725 }
1727 {
1728 Point nearestPoint = spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true);
1729 item.enemy = null;
1730 item.pos.Set(nearestPoint);
1731 map.charas.Add(item);
1733 }
1735 }
GlobalCharaList globalCharas
Definition: CardManager.cs:46
bool isRestrained
Definition: Card.cs:569
override bool IsPC
Definition: Chara.cs:630
Chara host
Definition: Chara.cs:33
Zone currentZone
Definition: Chara.cs:259
bool isDead
Definition: Chara.cs:393
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:624
bool ForeachNearestPoint(Func< Point, bool > endFunc, bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int maxRange=30)
Definition: Point.cs:696
Point Clamp(bool useBounds=false)
Definition: Point.cs:1014
bool HasBlock
Definition: Point.cs:141
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1146
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
Definition: Zone.cs:1445

References Map.AddCardOnActivate(), Game.cards, Map.charas, Point.Clamp(), Chara.currentZone, Point.Equals(), Point.FindThing(), EClass.game, MapBounds.GetCenterPos(), Point.GetNearestPoint(), GetSpawnPos(), 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, map, 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 3514 of file Zone.cs.

3515 {
3516 Trait random = map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
3517 if (random == null)
3518 {
3519 return null;
3520 }
3521 Point point = random.GetPoint();
3522 Chara chara = null;
3523 if (guest)
3524 {
3525 Zone z = EClass.world.FindZone("wilds");
3526 chara = EClass.game.cards.ListGlobalChara(z).RandomItem();
3527 if (chara != null)
3528 {
3529 AddCard(chara, point);
3530 Msg.Say("guestArrive", chara);
3531 chara.visitorState = VisitorState.Arrived;
3532 }
3533 }
3534 else
3535 {
3536 chara = CharaGen.CreateFromFilter("c_wilds");
3537 AddCard(chara, point);
3538 chara.goalListType = GoalListType.Enemy;
3539 }
3540 return chara;
3541 }
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:123
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:841
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 2093 of file Zone.cs.

2094 {
2095 return AddThing(id, p.x, p.z);
2096 }
Card AddThing(string id, int x, int z)
Definition: Zone.cs:2088

References AddThing(), Point.x, and Point.z.

◆ ApplyBackerPet()

void Zone.ApplyBackerPet ( bool  draw)
inline

Definition at line 4017 of file Zone.cs.

4018 {
4019 bool flag = this is Zone_Yowyn && base.lv == -1;
4020 IList<SourceBacker.Row> list = EClass.sources.backers.listPet.Copy();
4021 list.Shuffle();
4023 {
4024 list.ForeachReverse(delegate(SourceBacker.Row a)
4025 {
4026 if (EClass.player.doneBackers.Contains(a.id))
4027 {
4028 list.Remove(a);
4029 }
4030 });
4031 }
4032 foreach (Chara chara in EClass._map.charas)
4033 {
4034 if (chara.IsGlobal || chara.IsMinion)
4035 {
4036 continue;
4037 }
4038 if (chara.isBackerContent)
4039 {
4040 if (chara.sourceBacker.isStatic != 0)
4041 {
4042 continue;
4043 }
4044 if (chara.id != "follower")
4045 {
4046 chara.RemoveBacker();
4047 }
4048 }
4049 if ((flag && chara.race.id != "cat") || (!EClass.debug.enable && EClass.rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0))
4050 {
4051 continue;
4052 }
4053 foreach (SourceBacker.Row item in list)
4054 {
4055 if (item.chara == chara.id)
4056 {
4057 chara.ApplyBacker(item.id);
4058 list.Remove(item);
4059 break;
4060 }
4061 }
4062 }
4063 }
SourceBacker.Row sourceBacker
Definition: Card.cs:955
void RemoveBacker()
Definition: Card.cs:7524
void ApplyBacker(int bid)
Definition: Card.cs:7488
bool isBackerContent
Definition: Card.cs:952
override bool IsGlobal
Definition: Chara.cs:628
override bool IsMinion
Definition: Chara.cs:645
SourceRace.Row race
Definition: Chara.cs:468
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 1903 of file Zone.cs.

1904 {
1906 {
1907 return false;
1908 }
1909 if (IsInstance)
1910 {
1911 return true;
1912 }
1913 bool flag = false;
1914 switch (id)
1915 {
1916 case "cave_dragon":
1917 if (!(this is Zone_DungeonDragon))
1918 {
1919 flag = true;
1920 }
1921 break;
1922 case "cave_yeek":
1923 if (!(this is Zone_DungeonYeek))
1924 {
1925 flag = true;
1926 }
1927 break;
1928 case "cave_mino":
1929 if (!(this is Zone_DungeonMino))
1930 {
1931 flag = true;
1932 }
1933 break;
1934 case "cave_dead":
1935 if (!(this is Zone_DungeonDead))
1936 {
1937 flag = true;
1938 }
1939 break;
1940 }
1941 Zone topZone = GetTopZone();
1942 if (!flag)
1943 {
1944 if (base.dateExpire == 0 || !EClass.world.date.IsExpired(base.dateExpire))
1945 {
1946 return false;
1947 }
1948 if (!base.isRandomSite && !(this is Zone_Field) && (topZone == null || topZone == this || topZone.FindDeepestZone() == this))
1949 {
1950 return false;
1951 }
1952 }
1953 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()))
1954 {
1955 return false;
1956 }
1958 {
1960 if (zone != null && zone.GetTopZone() == this)
1961 {
1962 return false;
1963 }
1964 }
1965 return true;
1966 }
SpatialManager spatials
Definition: Game.cs:153
Zone nextZone
Definition: Player.cs:1297
Zone Find(string id)
Zone FindDeepestZone()
Definition: Spatial.cs:715

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

Referenced by _OnBeforeSave(), and Region.OnActivate().

◆ ClaimZone()

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

Definition at line 1833 of file Zone.cs.

1834 {
1837 branch = new FactionBranch();
1838 branch.OnCreate(this);
1839 if (base.icon == 0)
1840 {
1841 base.icon = 332;
1842 }
1843 instance = null;
1844 base.dateExpire = 0;
1846 Register();
1847 foreach (Thing thing in map.things)
1848 {
1849 thing.isNPCProperty = false;
1850 }
1853 if (debug)
1854 {
1855 for (int i = 0; i < 7; i++)
1856 {
1857 Chara chara = CharaGen.CreateFromFilter("c_neutral");
1858 EClass._zone.AddCard(chara, EClass._map.bounds.GetRandomPoint().GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false));
1859 branch.AddMemeber(chara);
1860 }
1861 }
1862 else
1863 {
1864 Msg.Say("claimedZone");
1865 EClass.Branch.Log("claimedZone");
1866 EClass.Sound.Play("jingle_embark");
1867 EClass.pc.PlaySound("build");
1868 if (pos == null)
1869 {
1870 pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: true, allowInstalled: false);
1871 }
1872 Effect.Get("aura_heaven").Play(pos);
1873 EClass._zone.AddCard(ThingGen.Create("core_zone"), pos).SetPlaceState(PlaceState.installed);
1874 }
1875 base.idPrefix = 0;
1877 {
1878 EClass.player.spawnZone = EClass._zone;
1879 }
1881 {
1882 EClass._zone.SetBGM(new List<int> { 41, 90, 44, 43 });
1884 }
1885 }
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3925
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6633
Faction faction
Definition: Chara.cs:431
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:918
MapBounds bounds
Definition: Map.cs:52
EloMap elomap
Definition: Scene.cs:149
void SetInt(int id, int value=0)
Definition: Spatial.cs:580
void Register()
Definition: Spatial.cs:630
void RefreshPlaylist()
Definition: Zone.cs:3217
void SetBGM(List< int > ids, bool refresh=true, float fadeDuration=0f)
Definition: Zone.cs:3175

References EClass._map, EClass._zone, AddCard(), FactionBranch.AddMemeber(), Map.bounds, EClass.Branch, branch, ThingGen.Create(), CharaGen.CreateFromFilter(), World.date, EClass.debug, Scene.elomap, Chara.faction, EClass.game, Effect.Get(), Point.GetNearestPoint(), MapBounds.GetRandomPoint(), Date.GetRaw(), instance, FactionBranch.Log(), map, FactionBranch.OnClaimZone(), FactionBranch.OnCreate(), EClass.pc, Effect.Play(), Card.PlaySound(), Card.pos, RefreshPlaylist(), Spatial.Register(), Map.RevealAll(), Msg.Say(), EClass.scene, SetBGM(), Spatial.SetInt(), Spatial.SetMainFaction(), 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 2023 of file Zone.cs.

2024 {
2025 if (map != null)
2026 {
2027 UnloadMap();
2028 }
2029 base.isGenerated = false;
2030 Zone topZone = GetTopZone();
2031 if (topZone != this)
2032 {
2033 topZone.ClearZones(this);
2034 return;
2035 }
2036 children.ForeachReverse(delegate(Spatial c)
2037 {
2038 if (c != current)
2039 {
2040 c.Destroy();
2041 }
2042 });
2043 }
virtual void Destroy()
Definition: Spatial.cs:690
List< Spatial > children
Definition: Spatial.cs:37

References Spatial.children, ClearZones(), Spatial.Destroy(), GetTopZone(), map, and UnloadMap().

Referenced by Activate(), and ClearZones().

◆ CountMinions()

int Zone.CountMinions ( Chara  c)
inline

Definition at line 3949 of file Zone.cs.

3950 {
3951 int num = 0;
3952 foreach (Chara chara in EClass._map.charas)
3953 {
3954 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3955 {
3956 num++;
3957 }
3958 }
3959 return num;
3960 }
MinionType
Definition: MinionType.cs:2
MinionType c_minionType
Definition: Card.cs:1015

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

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

◆ CreateBP()

void Zone.CreateBP ( )
inline

Definition at line 2467 of file Zone.cs.

2468 {
2469 bp = new ZoneBlueprint();
2470 bp.Create();
2471 bp.genSetting.seed = base.Seed;
2472 OnCreateBP();
2473 }
virtual void OnCreateBP()
Definition: Zone.cs:2475

References bp, ZoneBlueprint.Create(), and OnCreateBP().

Referenced by Generate().

◆ CreatePlaylist()

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

Definition at line 3273 of file Zone.cs.

3274 {
3275 return ModUtil.CreatePlaylist(ref list, mold);
3276 }

Referenced by Generate().

◆ Deactivate()

void Zone.Deactivate ( )
inline

Definition at line 1737 of file Zone.cs.

1738 {
1739 if (!IsUserZone && !IsPCFaction && map != null)
1740 {
1741 List<Thing> list = new List<Thing>();
1742 foreach (Thing thing in map.things)
1743 {
1744 if (thing.rarity >= Rarity.Artifact && thing.HasTag(CTAG.godArtifact))
1745 {
1746 list.Add(thing);
1747 }
1748 }
1749 if (this is Zone_Tent)
1750 {
1751 foreach (Thing item in map.props.stocked.Things.Concat(map.props.roaming.Things))
1752 {
1753 if (item.IsContainer)
1754 {
1755 foreach (Thing thing2 in item.things)
1756 {
1757 if (thing2.trait is TraitTent)
1758 {
1759 list.Add(thing2);
1760 }
1761 }
1762 }
1763 if (item.trait is TraitTent)
1764 {
1765 list.Add(item);
1766 }
1767 }
1768 }
1769 if (list.Count > 0)
1770 {
1771 Msg.Say("pick_valuable");
1772 foreach (Thing item2 in list)
1773 {
1774 Msg.Say("pick_valuable2", item2);
1775 EClass.pc.AddCard(item2);
1776 }
1777 }
1778 }
1780 {
1781 base.isPeace = false;
1782 }
1784 if (IsPCFaction)
1785 {
1786 foreach (Chara member in branch.members)
1787 {
1788 member.ValidateWorks();
1789 }
1790 }
1791 EClass.game.lastActiveZone = EClass.game.activeZone;
1792 base.lastActive = EClass.world.date.GetRaw();
1793 map.OnDeactivate();
1794 EClass.scene.Clear();
1795 EClass.game.activeZone = null;
1796 if (IsInstance)
1797 {
1798 UnloadMap();
1799 base.isGenerated = false;
1800 }
1801 if (forceRegenerate)
1802 {
1803 UnloadMap();
1804 }
1805 OnDeactivate();
1806 }
Rarity
Definition: Rarity.cs:2
Card AddCard(Card c)
Definition: Card.cs:3263
Rarity rarity
Definition: Card.cs:317
bool HasTag(CTAG tag)
Definition: Card.cs:2728
void ValidateWorks()
Definition: Chara.cs:9764
void OnDeactivate()
Definition: Map.cs:205
PropsManager props
Definition: Map.cs:91
PropsRoaming roaming
Definition: PropsManager.cs:10
PropsStocked stocked
Definition: PropsManager.cs:6
List< Thing > Things
Definition: Props.cs:37
void Clear()
Definition: Scene.cs:355
virtual void OnBeforeDeactivate()
Definition: Zone.cs:1261
virtual bool IsUserZone
Definition: Zone.cs:275
virtual void OnDeactivate()
Definition: Zone.cs:1265

References Game.activeZone, Card.AddCard(), branch, Scene.Clear(), World.date, forceRegenerate, EClass.game, Date.GetRaw(), Card.HasTag(), IsInstance, IsPCFaction, IsUserZone, item, map, FactionBranch.members, OnBeforeDeactivate(), Map.OnDeactivate(), 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, UnloadMap(), Chara.ValidateWorks(), and EClass.world.

Referenced by Activate().

◆ Destroy()

override void Zone.Destroy ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 2004 of file Zone.cs.

2005 {
2006 children.ForeachReverse(delegate(Spatial z)
2007 {
2008 z.Destroy();
2009 });
2010 if (map != null)
2011 {
2012 UnloadMap();
2013 }
2014 if (parent != null && parent.IsRegion && instance == null)
2015 {
2016 EClass.scene.elomap.SetZone(base.x, base.y, null, updateMesh: true);
2017 }
2018 EClass.game.spatials.Remove(this);
2019 destryoed = true;
2020 base.isGenerated = false;
2021 }
void Remove(Spatial s)
Spatial parent
Definition: Spatial.cs:10

References Spatial.children, Spatial.Destroy(), Spatial.destryoed, Scene.elomap, EClass.game, instance, Spatial.IsRegion, map, Spatial.parent, SpatialManager.Remove(), EClass.scene, EloMap.SetZone(), Game.spatials, and UnloadMap().

Referenced by _OnBeforeSave().

◆ Evalue() [1/2]

int Zone.Evalue ( int  ele)
inline

Definition at line 572 of file Zone.cs.

573 {
574 return elements.Value(ele);
575 }
int Value(int ele)
ElementContainerZone elements
Definition: Zone.cs:43

References elements, and ElementContainer.Value().

Referenced by TraitWrench.IsValidTarget().

◆ Evalue() [2/2]

int Zone.Evalue ( string  alias)
inline

Definition at line 577 of file Zone.cs.

578 {
579 return elements.Value(EClass.sources.elements.alias[alias].id);
580 }
SourceElement elements

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

◆ Export() [1/2]

void Zone.Export ( )
inline

Definition at line 3472 of file Zone.cs.

3473 {
3475 string text = pathExport;
3476 IO.Copy(text, CorePath.ZoneSave + "Backup/");
3477 Export(text);
3478 Msg.Say("Exported Map:" + text);
3479 }
static void Copy(string fromPath, string toPath)
Definition: IO.cs:309
void ResetEditorPos()
Definition: Map.cs:357
void Export()
Definition: Zone.cs:3472

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 3389 of file Zone.cs.

3390 {
3391 if (subset != null)
3392 {
3393 SE.Beep();
3394 return;
3395 }
3396 try
3397 {
3398 ZoneExportData zoneExportData = new ZoneExportData
3399 {
3400 name = name,
3401 usermap = usermap
3402 };
3404 if (!map.config.retainDecal)
3405 {
3407 }
3408 map.Save(IO.TempPath + "/", zoneExportData, partial);
3409 map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(path), partial);
3410 if (partial == null)
3411 {
3412 IO.CopyDir(base.pathSave + "Texture Replace", IO.TempPath + "/Texture Replace");
3413 }
3414 IO.SaveFile(IO.TempPath + "/export", zoneExportData, compress: true);
3415 using (ZipFile zipFile = new ZipFile())
3416 {
3417 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3418 zipFile.AddDirectory(IO.TempPath);
3419 zipFile.Save(path);
3420 zipFile.Dispose();
3421 }
3423 }
3424 catch (Exception ex)
3425 {
3426 EClass.ui.Say(ex.Message + ":" + path);
3427 }
3428 }
static void CreateTempDirectory(string path=null)
Definition: IO.cs:419
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:424
bool retainDecal
Definition: MapConfig.cs:44
void ExportMetaData(string _path, string id, PartialMap partial=null)
Definition: Map.cs:732
void ClearRainAndDecal()
Definition: Map.cs:1572
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 3430 of file Zone.cs.

3431 {
3433 {
3434 string text = StandaloneFileBrowser.SaveFilePanel("Export Zone", dir ?? CorePath.ZoneSave, "new zone", "z");
3435 if (!string.IsNullOrEmpty(text))
3436 {
3437 Export(text);
3438 Msg.SayRaw("Exported Zone");
3439 }
3440 });
3441 }
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 3283 of file Zone.cs.

3284 {
3285 return map.charas.Find((Chara c) => c.uid == uid);
3286 }
int uid
Definition: Spatial.cs:70

References Map.charas, and Card.uid.

◆ FindChara() [2/2]

Chara Zone.FindChara ( string  id)
inline

Definition at line 3278 of file Zone.cs.

3279 {
3280 return map.charas.Find((Chara c) => c.id == id);
3281 }

References Map.charas, and Card.id.

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

◆ FindDeadChara()

Chara Zone.FindDeadChara ( string  id)
inline

Definition at line 3288 of file Zone.cs.

3289 {
3290 return map.deadCharas.Find((Chara c) => c.id == id);
3291 }

References Map.deadCharas, and Card.id.

Referenced by Zone_Aquli.OnVisitNewMapOrRegenerate().

◆ FindOrCreateLevel()

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

Definition at line 531 of file Zone.cs.

532 {
533 if (destLv == base.lv)
534 {
535 return this;
536 }
537 Zone zone = FindZone(destLv);
538 if (zone != null)
539 {
540 return zone;
541 }
542 if (!(SpatialGen.Create(subId.IsEmpty(GetNewZoneID(destLv)), this, register: true) is Zone zone2))
543 {
544 return null;
545 }
546 zone2.lv = destLv;
547 zone2.x = base.x;
548 zone2.y = base.y;
549 return zone2;
550 }
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:592

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

◆ Generate()

void Zone.Generate ( )
inline

Definition at line 2479 of file Zone.cs.

2480 {
2481 base.isGenerated = true;
2482 if (bp == null)
2483 {
2484 CreateBP();
2485 }
2486 if (bp.map == null)
2487 {
2488 bp.GenerateMap(this);
2489 }
2490 map.SetZone(this);
2491 Zone_Field zone_Field = this as Zone_Field;
2492 bool flag = IdBiome == "Sand" || IdBiome == "Water" || IsUnderwater;
2493 if (flag)
2494 {
2495 int num = 1 + EClass.rnd((IdBiome == "Water") ? 3 : 2);
2496 for (int i = 0; i < num; i++)
2497 {
2498 Point randomSurface = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2499 if (!randomSurface.HasObj && !randomSurface.HasThing)
2500 {
2501 Thing t = ThingGen.Create("pearl_oyster", new string[3] { "wood_birch", "poplar", "coralwood" }.RandomItem(), ContentLv);
2502 EClass._zone.AddCard(t, randomSurface).Install();
2503 }
2504 }
2505 num = 4 + EClass.rnd(5);
2506 for (int j = 0; j < num; j++)
2507 {
2508 Point randomSurface2 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2509 if (!randomSurface2.HasObj && !randomSurface2.HasThing && (IsUnderwater || randomSurface2.cell.IsTopWaterAndNoSnow || EClass.rnd(6) == 0))
2510 {
2511 EClass._zone.AddCard(ThingGen.Create("70", -1, ContentLv), randomSurface2);
2512 }
2513 }
2514 for (int k = 0; k < EClass.rnd(EClass.rnd(base.isBeach ? 5 : 3) + 1); k++)
2515 {
2516 Point randomSurface3 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2517 if (!randomSurface3.HasObj)
2518 {
2519 EClass._zone.AddCard(ThingGen.Create("bottle_message"), randomSurface3);
2520 }
2521 }
2522 }
2523 if (IsUnderwater)
2524 {
2525 for (int l = 0; l < 30 + EClass.rnd(30); l++)
2526 {
2527 SpawnMob(null, SpawnSetting.Fish());
2528 }
2529 Crawler crawler = Crawler.Create("pasture");
2530 int num2 = (EClass.debug.enable ? 3 : EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(5) + 1) + 1) + 1));
2531 bool flag2 = this is Zone_Field;
2532 Thing seed = null;
2533 if (IsNefia)
2534 {
2535 int num3 = Mathf.Min(EClass._zone.DangerLv, EClass.pc.Evalue(286) * 2 / 3);
2536 if (num3 > 0)
2537 {
2539 Rand.SetSeed(EClass._zone.uid * 10 + num3);
2540 TraitSeed.LevelSeed(seed, (seed.trait as TraitSeed).row, num3);
2541 Rand.SetSeed();
2542 seed.elements.SetBase(2, EClass.curve(seed.encLV, 50, 10, 80));
2543 }
2544 }
2545 crawler.CrawlUntil(EClass._map, () => EClass._map.GetRandomPoint(), num2 + (flag2 ? 4 : 0), delegate(Crawler.Result r)
2546 {
2547 int num6 = 137;
2548 foreach (Point point in r.points)
2549 {
2550 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
2551 {
2552 map.SetObj(point.x, point.z, num6);
2553 int idx = 3 + ((EClass.rnd(3) == 0) ? 1 : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0);
2554 point.growth.SetStage(idx);
2555 if (seed != null)
2556 {
2557 EClass._map.AddPlant(point, seed);
2558 }
2559 }
2560 }
2561 return false;
2562 });
2563 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)
2564 {
2565 int num5 = 136;
2566 foreach (Point point2 in r.points)
2567 {
2568 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
2569 {
2570 map.SetObj(point2.x, point2.z, num5, 1, EClass.rnd(4));
2571 }
2572 }
2573 return false;
2574 });
2575 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)
2576 {
2577 int idFloor = 121;
2578 foreach (Point point3 in r.points)
2579 {
2580 map.SetFloor(point3.x, point3.z, 97, idFloor, Mathf.Clamp(4 - r.startPos.Distance(point3) + EClass.rnd(3) - EClass.rnd(3), 0, 3));
2581 }
2582 return false;
2583 });
2584 }
2585 if (zone_Field != null)
2586 {
2587 if (EClass.rnd(3) == 0)
2588 {
2589 int num4 = EClass.rnd(2);
2590 for (int m = 0; m < num4; m++)
2591 {
2592 Point randomSurface4 = EClass._map.bounds.GetRandomSurface();
2593 if (!randomSurface4.HasObj && !randomSurface4.HasThing)
2594 {
2596 EClass._zone.AddCard(t2, randomSurface4).Install();
2597 }
2598 }
2599 }
2600 if (EClass.rnd(8) == 0)
2601 {
2602 SpawnAltar();
2603 }
2605 if (!flag && EClass.rnd(EClass.debug.enable ? 1 : 10) == 0)
2606 {
2607 Point randomSurface5 = EClass._map.bounds.GetRandomSurface();
2608 if (randomSurface5.IsValid)
2609 {
2610 EClass._zone.AddCard(CharaGen.Create("priest"), randomSurface5);
2611 }
2612 }
2613 if (base.Tile.isRoad)
2614 {
2615 for (int n = 0; n < EClass.rnd(4); n++)
2616 {
2617 EClass._zone.SpawnMob(map.GetCenterPos().GetRandomPointInRadius(2, 6, requireLos: false, allowChara: false), SpawnSetting.HomeGuest(EClass._zone.DangerLv));
2618 }
2619 }
2620 }
2621 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList) ?? EClass.Sound.GetPlaylist("Day"));
2622 }
@ seed
int Evalue(int ele)
Definition: Card.cs:2704
Card Install()
Definition: Card.cs:3919
bool IsTopWaterAndNoSnow
Definition: Cell.cs:720
bool isModified
Definition: Cell.cs:446
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:451
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:2261
List< int > _plDay
Definition: Map.cs:55
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:970
PlantData AddPlant(Point pos, Thing seed)
Definition: Map.cs:1998
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1581
bool HasThing
Definition: Point.cs:251
bool HasObj
Definition: Point.cs:137
Point GetRandomPointInRadius(int minRadius, int maxRadius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=2000)
Definition: Point.cs:788
Cell cell
Definition: Point.cs:51
GrowSystem growth
Definition: Point.cs:77
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:145
override int ContentLv
Definition: Zone.cs:100
void SpawnAltar()
Definition: Zone.cs:2658
Playlist CreatePlaylist(ref List< int > list, Playlist mold=null)
Definition: Zone.cs:3273
virtual bool IsNefia
Definition: Zone.cs:289
BiomeProfile biome
Definition: Zone.cs:131
Chara SpawnMob(string id, Point pos=null)
Definition: Zone.cs:2910
virtual string IdBiome
Definition: Zone.cs:133
override int DangerLv
Definition: Zone.cs:112
void TrySpawnFollower()
Definition: Zone.cs:2624
void CreateBP()
Definition: Zone.cs:2467

References EClass._map, Map._plDay, EClass._zone, AddCard(), Map.AddPlant(), biome, Map.bounds, bp, Point.cell, Card.ChangeMaterial(), ContentLv, Crawler.CrawlUntil(), Crawler.Create(), ThingGen.Create(), CharaGen.Create(), CreateBP(), CreatePlaylist(), 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(), IdBiome, IDPlayList, Card.Install(), Cell.isModified, IsNefia, Cell.IsTopWaterAndNoSnow, IsUnderwater, Point.IsValid, TraitSeed.LevelSeed(), TraitSeed.MakeSeed(), map, 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, SpawnAltar(), SpawnMob(), BiomeProfile.style, TrySpawnFollower(), Spatial.uid, Point.x, and Point.z.

Referenced by Activate().

◆ GetCostSkyTravel()

int Zone.GetCostSkyTravel ( )
inline

Definition at line 3312 of file Zone.cs.

3313 {
3314 if (base.source.costSkyTravel > 0)
3315 {
3316 return base.source.costSkyTravel;
3317 }
3319 {
3320 return Mathf.Clamp(10 + EClass.curve(DangerLv, 50, 10), 1, 200);
3321 }
3322 return 0;
3323 }
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 3293 of file Zone.cs.

3294 {
3295 int max = base.lv;
3296 return GetDeepestLv(ref max);
3297 }
int GetDeepestLv()
Definition: Zone.cs:3293

◆ GetDeepestLv() [2/2]

int Zone.GetDeepestLv ( ref int  max)
inline

Definition at line 3299 of file Zone.cs.

3300 {
3301 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
3302 {
3303 max = base.lv;
3304 }
3305 foreach (Spatial child in children)
3306 {
3307 (child as Zone).GetDeepestLv(ref max);
3308 }
3309 return max;
3310 }

◆ GetDungenID()

virtual string Zone.GetDungenID ( )
inlinevirtual

◆ GetElectricity()

int Zone.GetElectricity ( bool  cost = false)
inline

Definition at line 3136 of file Zone.cs.

3137 {
3138 bool flag = GetSoilCost() > MaxSoil;
3139 int sum = 0;
3140 foreach (Thing thing in EClass._map.things)
3141 {
3142 if (!thing.IsInstalled || thing.trait.Electricity == 0)
3143 {
3144 continue;
3145 }
3146 if (cost)
3147 {
3148 if (thing.trait.Electricity < 0)
3149 {
3150 sum += -thing.trait.Electricity;
3151 }
3152 }
3153 else if (thing.trait.Electricity > 0)
3154 {
3155 sum += thing.trait.Electricity;
3156 }
3157 }
3158 if (!cost)
3159 {
3160 sum += elements.Value(2201) * 10 + BaseElectricity;
3161 if (!flag)
3162 {
3163 EClass._map.bounds.ForeachCell(delegate(Cell c)
3164 {
3165 if (c.sourceObj.id == 118 && c.growth.IsMature)
3166 {
3167 sum += 20;
3168 }
3169 });
3170 }
3171 }
3172 return sum;
3173 }
bool IsInstalled
Definition: Card.cs:2451
GrowSystem growth
Definition: Cell.cs:233
SourceObj.Row sourceObj
Definition: Cell.cs:1084
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:497
virtual int MaxSoil
Definition: Zone.cs:520
int GetSoilCost()
Definition: Zone.cs:3962

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, and Zone_Vernis.

Definition at line 592 of file Zone.cs.

593 {
594 return base.source.id;
595 }

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

◆ GetOrCreateFortuneRollData()

FortuneRollData Zone.GetOrCreateFortuneRollData ( bool  refresh = true)
inline

Definition at line 4065 of file Zone.cs.

4066 {
4067 if (fortuneRoll == null)
4068 {
4070 fortuneRoll.seed = EClass._zone.uid * 100 + EClass.game.seed;
4071 }
4072 if (refresh || fortuneRoll.count == 0)
4073 {
4075 }
4076 return fortuneRoll;
4077 }
int seed
Definition: Game.cs:201
FortuneRollData fortuneRoll
Definition: Zone.cs:61

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 2427 of file Zone.cs.

2428 {
2429 string text = IdProfile;
2430 if (text.IsEmpty())
2431 {
2432 Region region = parent as Region;
2433 if (base.lv != 0)
2434 {
2435 text = ((base.lv < 0) ? "Underground" : "Sky");
2436 }
2437 else if (region != null)
2438 {
2440 text = EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2441 if (bp != null)
2442 {
2443 name = Lang.GetList("zone_" + text.Split('/')[1]).RandomItem();
2444 bp.surrounding = new EloMap.TileInfo[3, 3];
2445 for (int i = 0; i < 3; i++)
2446 {
2447 for (int j = 0; j < 3; j++)
2448 {
2449 bp.surrounding[j, i] = EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2450 }
2451 }
2452 if (text == "Random/R_Shore")
2453 {
2454 base.isBeach = true;
2455 }
2456 }
2457 }
2458 else
2459 {
2460 text = "Random";
2461 }
2462 idProfile = text;
2463 }
2464 return ZoneProfile.Load(text);
2465 }
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:143
Region Region
Definition: Zone.cs:167

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

Referenced by ZoneBlueprint.GenerateMap().

◆ GetRandomSpot< T >()

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

Definition at line 2159 of file Zone.cs.

2159 : Trait
2160 {
2161 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
2162 }
PropsInstalled installed
Definition: PropsManager.cs:8

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

◆ GetRandomVisitPos()

Point Zone.GetRandomVisitPos ( Chara  c)
inline

Definition at line 1634 of file Zone.cs.

1635 {
1636 Point point = null;
1637 if (EClass.rnd(3) == 0 && map.rooms.listRoom.Count > 0)
1638 {
1639 point = map.rooms.listRoom.RandomItem().points.RandomItem();
1640 }
1641 if (point == null && EClass.rnd(4) != 0)
1642 {
1643 IEnumerable<Chara> ie = map.charas.Where((Chara t) => t.trait.ShopType != 0 && t.pos != null && t.pos.IsValid);
1644 if (ie.Count() > 0)
1645 {
1646 point = ie.RandomItem().pos.GetRandomPoint(3);
1647 }
1648 }
1649 if (point == null)
1650 {
1651 point = map.bounds.GetRandomSurface(centered: false, walkable: true, !IsPCFaction && !(this is Zone_Civilized)) ?? map.bounds.GetRandomPoint();
1652 }
1653 return point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false) ?? EClass._map.GetCenterPos().GetNearestPoint();
1654 }
new TraitChara trait
Definition: Chara.cs:509
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:774
virtual ShopType ShopType
Definition: Trait.cs:532

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

Referenced by GetSpawnPos().

◆ GetRoot()

ICardParent Zone.GetRoot ( )
inline

Implements ICardParent.

Definition at line 2049 of file Zone.cs.

2050 {
2051 return this;
2052 }

◆ GetSoilCost()

int Zone.GetSoilCost ( )
inline

Definition at line 3962 of file Zone.cs.

3963 {
3964 int i = 0;
3965 EClass._map.bounds.ForeachCell(delegate(Cell c)
3966 {
3967 i += c.sourceObj.costSoil;
3968 });
3969 return i / 10;
3970 }

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 3489 of file Zone.cs.

3490 {
3491 if (IsPCFaction)
3492 {
3493 return -10000000 + base.uid;
3494 }
3495 if (this is Zone_SubTown)
3496 {
3497 return -8000000 + base.uid;
3498 }
3499 if (this is Zone_Town)
3500 {
3501 return -9000000 + base.uid;
3502 }
3503 if (this is Zone_Civilized)
3504 {
3505 return -7000000 + base.uid;
3506 }
3507 if (this is Zone_RandomDungeon)
3508 {
3509 return 1000000 + base.uid;
3510 }
3511 return base.uid;
3512 }

Referenced by SpatialManager.ListReturnLocations().

◆ GetSpawnPos() [1/2]

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

Definition at line 1445 of file Zone.cs.

1446 {
1447 ZoneTransition zoneTransition = c.global?.transition;
1448 Zone zone = zoneTransition?.lastZone;
1449 ZoneTransition.EnterState enterState = zoneTransition?.state ?? destState;
1450 bool flag = zone == null || zone.lv > base.lv;
1451 if (IsRegion)
1452 {
1453 if (zone != null && !EClass.player.simulatingZone)
1454 {
1455 Zone topZone = zone.GetTopZone();
1456 if (GetZoneAt(topZone.x, topZone.y) != null)
1457 {
1458 return new Point(topZone.mapX, topZone.mapY);
1459 }
1460 }
1461 }
1462 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))
1463 {
1464 return EClass.player.lastZonePos;
1465 }
1466 if (enterState == ZoneTransition.EnterState.Region)
1467 {
1468 enterState = RegionEnterState;
1469 }
1470 if (this is Zone_Kapul && enterState == ZoneTransition.EnterState.Left)
1471 {
1472 enterState = ZoneTransition.EnterState.Right;
1473 }
1474 float rate = zoneTransition?.ratePos ?? (-1f);
1475 if (IsPCFaction)
1476 {
1477 if ((uint)(enterState - 3) <= 4u || enterState == ZoneTransition.EnterState.Return)
1478 {
1480 if (spot != null)
1481 {
1482 Point nearestPoint = (spot.trait as TraitSpotGuidePC).GetRandomPoint((Point p) => !p.IsBlocked && !p.Equals(spot.pos)).GetNearestPoint();
1483 if (nearestPoint != null && nearestPoint.IsValid)
1484 {
1485 return nearestPoint;
1486 }
1487 }
1488 }
1489 }
1490 while (true)
1491 {
1492 switch (enterState)
1493 {
1494 case ZoneTransition.EnterState.UndergroundOrSky:
1495 return new Point(zoneTransition.x, zoneTransition.z);
1496 case ZoneTransition.EnterState.Teleport:
1497 {
1498 foreach (Thing thing2 in map.things)
1499 {
1500 if (thing2.IsInstalled)
1501 {
1502 TraitTeleporter traitTeleporter = thing2.trait as TraitTeleporter;
1503 if (traitTeleporter != null)
1504 {
1505 Debug.Log(zoneTransition.idTele + "/" + traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)) + "/" + traitTeleporter.GetParam(3));
1506 }
1507 if (traitTeleporter != null && !zoneTransition.idTele.IsEmpty() && zoneTransition.idTele == traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)))
1508 {
1509 return thing2.pos.GetNearestPoint();
1510 }
1511 }
1512 }
1513 foreach (Thing thing3 in map.things)
1514 {
1515 if (thing3.IsInstalled && thing3.trait is TraitTeleporter traitTeleporter2 && traitTeleporter2.IsFor(zoneTransition.lastZone))
1516 {
1517 return thing3.pos.GetNearestPoint();
1518 }
1519 }
1520 Thing randomThing2 = EClass._map.props.installed.traits.GetRandomThing<TraitTeleporter>();
1521 if (randomThing2 != null)
1522 {
1523 return randomThing2.pos.GetNearestPoint();
1524 }
1525 goto case ZoneTransition.EnterState.Return;
1526 }
1527 case ZoneTransition.EnterState.Return:
1528 case ZoneTransition.EnterState.Elevator:
1529 case ZoneTransition.EnterState.Moongate:
1530 {
1531 if (enterState == ZoneTransition.EnterState.Elevator)
1532 {
1533 foreach (Thing thing4 in map.things)
1534 {
1535 if (thing4.IsInstalled && thing4.trait is TraitElevator traitElevator && traitElevator.IsFor(zoneTransition.lastZone))
1536 {
1537 return thing4.pos.GetNearestPoint();
1538 }
1539 }
1540 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<TraitElevator>();
1541 if (randomThing != null)
1542 {
1543 return randomThing.pos.GetNearestPoint();
1544 }
1545 }
1546 Thing thing = null;
1547 if (enterState == ZoneTransition.EnterState.Return && EClass.game.IsSurvival)
1548 {
1549 thing = map.props.installed.traits.GetRandomThing<TraitLandingPortal>();
1550 if (thing != null)
1551 {
1552 return thing.pos;
1553 }
1554 }
1555 thing = map.props.installed.traits.GetRandomThing<TraitWaystone>();
1556 if (thing != null)
1557 {
1558 return thing.pos.GetNearestPoint();
1559 }
1560 thing = map.props.installed.traits.GetRandomThing<TraitCoreZone>();
1561 if (thing != null)
1562 {
1563 return thing.pos.GetNearestPoint();
1564 }
1565 if (base.lv == 0)
1566 {
1567 goto IL_04da;
1568 }
1569 flag = base.lv <= 0;
1570 break;
1571 }
1572 case ZoneTransition.EnterState.Center:
1573 case ZoneTransition.EnterState.Encounter:
1574 if (map.config.embarkX != 0)
1575 {
1576 return new Point(map.config.embarkX, map.config.embarkY);
1577 }
1578 return map.GetCenterPos().GetNearestPoint(allowBlock: false, allowChara: false);
1579 case ZoneTransition.EnterState.Top:
1580 return map.bounds.GetTopPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1581 case ZoneTransition.EnterState.Right:
1582 return map.bounds.GetRightPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1583 case ZoneTransition.EnterState.Bottom:
1584 return map.bounds.GetBottomPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1585 case ZoneTransition.EnterState.Left:
1586 return map.bounds.GetLeftPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1587 case ZoneTransition.EnterState.Dead:
1588 case ZoneTransition.EnterState.Exact:
1589 case ZoneTransition.EnterState.PortalReturn:
1590 case ZoneTransition.EnterState.Fall:
1591 if (zoneTransition.x == 0 && EClass._map.bounds.x != 0)
1592 {
1593 return new Point(map.config.embarkX, map.config.embarkY);
1594 }
1595 return new Point(zoneTransition.x, zoneTransition.z);
1596 case ZoneTransition.EnterState.RandomVisit:
1597 return GetRandomVisitPos(c);
1598 case ZoneTransition.EnterState.Down:
1599 flag = true;
1600 break;
1601 case ZoneTransition.EnterState.Up:
1602 flag = false;
1603 break;
1604 }
1605 break;
1606 IL_04da:
1607 enterState = ZoneTransition.EnterState.Center;
1608 }
1609 foreach (Thing thing5 in map.things)
1610 {
1611 if (thing5.trait is TraitNewZone { zone: not null } traitNewZone && zone != null && traitNewZone.zone.uid == zone.uid)
1612 {
1613 if (c != null && enterState != 0)
1614 {
1615 c.SetDir(traitNewZone.owner.dir);
1616 }
1617 return traitNewZone.GetExitPos();
1618 }
1619 }
1620 foreach (Thing thing6 in map.things)
1621 {
1622 if (thing6.trait is TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1623 {
1624 if (c != null && enterState != 0)
1625 {
1626 c.SetDir(traitNewZone2.owner.dir);
1627 }
1628 return traitNewZone2.GetExitPos();
1629 }
1630 }
1631 return GetRandomVisitPos(c);
1632 }
override void SetDir(int d)
Definition: Chara.cs:3754
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:86
int embarkX
Definition: MapConfig.cs:83
Point lastZonePos
Definition: Player.cs:1170
Thing Find(int uid)
Definition: Props.cs:389
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:587
EnterState state
virtual ZoneTransition.EnterState RegionEnterState
Definition: Zone.cs:177
Point GetRandomVisitPos(Chara c)
Definition: Zone.cs:1634
Zone GetZoneAt(int _x, int _y)
Definition: Zone.cs:3740

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(), GetRandomVisitPos(), MapBounds.GetRightPos(), MapBounds.GetTopPos(), GetTopZone(), GetZoneAt(), Chara.global, TraitTeleporter.id, ZoneTransition.idTele, PropsManager.installed, TraitNewZone.IsFor(), Card.IsInstalled, Chara.IsPC, IsPCFaction, Spatial.IsRegion, Game.IsSurvival, Point.IsValid, ZoneTransition.lastZone, Player.lastZonePos, Spatial.lv, map, Spatial.mapX, Spatial.mapY, EClass.player, Card.pos, Map.props, ZoneTransition.ratePos, RegionEnterState, 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 AddGlobalCharasOnActivate(), Chara.MoveZone(), Zone_Town.OnRegenerate(), and Revive().

◆ GetSpawnPos() [2/2]

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

Definition at line 2864 of file Zone.cs.

2865 {
2866 Point point = new Point();
2867 for (int i = 0; i < tries; i++)
2868 {
2869 point = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2870 if (!point.IsValid || point.cell.hasDoor || point.IsSync)
2871 {
2872 continue;
2873 }
2874 switch (type)
2875 {
2876 case SpawnPosition.Guest:
2877 {
2878 List<TraitSpotGuest> list = EClass._map.props.installed.traits.List<TraitSpotGuest>();
2879 if (list.Count > 0)
2880 {
2881 list.Shuffle();
2882 foreach (TraitSpotGuest item in list)
2883 {
2884 List<Point> list2 = item.ListPoints(null, onlyPassable: true, allowChara: false);
2885 if (list2.Count > 0)
2886 {
2887 return list2.RandomItem();
2888 }
2889 }
2890 }
2891 Room room = point.cell.room;
2892 if (room != null && room.data.accessType != 0)
2893 {
2894 continue;
2895 }
2896 break;
2897 }
2898 case SpawnPosition.Outside:
2899 if (point.cell.HasRoof || point.cell.light > 0)
2900 {
2901 continue;
2902 }
2903 break;
2904 }
2905 return point;
2906 }
2907 return null;
2908 }
SpawnPosition
Definition: SpawnPosition.cs:2
BaseArea.AccessType accessType
Definition: AreaData.cs:42
Room room
Definition: Cell.cs:110
byte light
Definition: Cell.cs:66
bool HasRoof
Definition: Cell.cs:656
bool hasDoor
Definition: Cell.cs:266
bool IsSync
Definition: Point.cs:344

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 3740 of file Zone.cs.

3741 {
3742 if (IsRegion)
3743 {
3744 foreach (Spatial child in children)
3745 {
3746 if (!(child is Zone_Field) && _x == child.x && _y == child.y)
3747 {
3748 return child as Zone;
3749 }
3750 }
3751 }
3752 foreach (Spatial child2 in children)
3753 {
3754 if (_x == child2.x && _y == child2.y)
3755 {
3756 return child2 as Zone;
3757 }
3758 }
3759 return null;
3760 }

References Spatial.x, and Spatial.y.

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

◆ GrowPlants()

void Zone.GrowPlants ( VirtualDate  date)
inline

Definition at line 3633 of file Zone.cs.

3634 {
3635 bool num = (EClass.player.isAutoFarming = IsPCFaction && EClass.Branch.policies.IsActive(2707));
3636 int weedChance = 1;
3638 {
3639 weedChance += (EClass.debug.enable ? 100000 : 20) + EClass.Branch.Evalue(2703) * 10;
3640 }
3641 if (date.sunMap == null)
3642 {
3643 date.BuildSunMap();
3644 }
3645 if (num)
3646 {
3647 HashSet<int> hashSet = new HashSet<int>();
3648 foreach (Thing thing in EClass._map.things)
3649 {
3650 if (!thing.IsInstalled || !(thing.trait is TraitSpotFarm traitSpotFarm))
3651 {
3652 continue;
3653 }
3654 foreach (Point item in traitSpotFarm.ListPoints(null, onlyPassable: false))
3655 {
3656 hashSet.Add(item.index);
3657 }
3658 }
3659 Perform(hashSet);
3660 EClass.player.isAutoFarming = false;
3661 Perform(hashSet);
3662 }
3663 else
3664 {
3665 Perform(null);
3666 }
3667 void Perform(HashSet<int> farmMap)
3668 {
3669 bool isWinter = date.IsWinter;
3670 EClass._map.bounds.ForeachCell(delegate(Cell c)
3671 {
3672 if (farmMap != null)
3673 {
3675 {
3676 if (!farmMap.Contains(c.index))
3677 {
3678 return;
3679 }
3680 }
3681 else if (farmMap.Contains(c.index))
3682 {
3683 return;
3684 }
3685 }
3686 if (c.decal != 0 && EClass.rnd(3) == 0)
3687 {
3688 c.decal = 0;
3689 }
3690 if (GrowPlant)
3691 {
3692 if (c.growth != null)
3693 {
3694 bool flag = false;
3695 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3696 {
3697 flag = true;
3698 }
3699 PlantData plantData = map.TryGetPlant(c);
3700 if (!flag && (plantData == null || plantData.fert >= 0))
3701 {
3702 c.TryGrow(date);
3703 }
3704 if (isWinter && plantData != null && c.growth != null && c.growth.NeedSunlight && plantData.fert >= 0 && (EClass.rnd(4) == 0 || c.growth.stage.idx == 0))
3705 {
3706 if (date.sunMap == null)
3707 {
3708 date.BuildSunMap();
3709 }
3710 if (!date.sunMap.Contains(c.index) && !c.growth.CanGrow(date))
3711 {
3712 c.growth.Perish();
3713 }
3714 }
3715 }
3716 else if (c.detail != null)
3717 {
3718 c.Things.ForeachReverse(delegate(Thing t)
3719 {
3720 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3721 {
3722 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3723 }
3724 });
3725 }
3726 else if (EClass.rnd(20) == 0 && GrowWeed && c.CanGrowWeed && EClass.rnd(weedChance) == 0)
3727 {
3728 biome.Populate(c.GetPoint());
3729 if (c.growth != null)
3730 {
3731 c.growth.SetStage(0);
3732 }
3733 }
3734 }
3735 c.isWatered = false;
3736 });
3737 }
3738 }
void Populate(Point point, bool interior=false, float mtpDensity=1f)
byte decal
Definition: Cell.cs:46
CellDetail detail
Definition: Cell.cs:100
Point GetPoint()
Definition: Cell.cs:1113
bool CanGrowWeed
Definition: Cell.cs:750
int index
Definition: Cell.cs:122
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:287
PlantData TryGetPlant(Point p)
Definition: Map.cs:1988
bool isAutoFarming
Definition: Player.cs:1251
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:353
virtual bool GrowPlant
Definition: Zone.cs:351

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 3090 of file Zone.cs.

3091 {
3092 return fieldElements.Has(idEle);
3093 }
bool Has(int ele)
ElementContainerField fieldElements
Definition: Zone.cs:46

References ElementContainer.Has().

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

◆ Import()

ZoneExportData Zone.Import ( string  path)
inline

Definition at line 3380 of file Zone.cs.

3381 {
3382 ZipFile zipFile = ZipFile.Read(path);
3383 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3384 zipFile.ExtractAll(pathTemp);
3385 zipFile.Dispose();
3386 return IO.LoadFile<ZoneExportData>(pathTemp + "export") ?? new ZoneExportData();
3387 }

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

◆ ImportDialog()

void Zone.ImportDialog ( string  dir = null)
inline

Definition at line 3443 of file Zone.cs.

3444 {
3446 {
3447 string[] array = StandaloneFileBrowser.OpenFilePanel("Import Zone", dir ?? CorePath.ZoneSave, "z", multiselect: false);
3448 if (array.Length != 0)
3449 {
3450 Zone_User zone_User = SpatialGen.Create("user", EClass.world.region, register: true) as Zone_User;
3451 zone_User.path = array[0];
3452 Thing thing = ThingGen.Create("teleporter");
3453 thing.c_uidZone = zone_User.uid;
3454 EClass._zone.AddCard(thing, EClass.pc.pos);
3455 }
3456 });
3457 }
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 3459 of file Zone.cs.

3460 {
3461 try
3462 {
3463 return Map.GetMetaData(path)?.IsValidVersion() ?? false;
3464 }
3465 catch (Exception ex)
3466 {
3467 EClass.ui.Say(ex.Message);
3468 return false;
3469 }
3470 }
bool IsValidVersion()
Definition: MapMetaData.cs:31
static MapMetaData GetMetaData(string pathZip)
Definition: Map.cs:750

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

Referenced by TraitMoongate.UseMoongate().

◆ ListLandFeats()

List< Element > Zone.ListLandFeats ( )
inline

Definition at line 3325 of file Zone.cs.

3326 {
3327 if (landFeats == null)
3328 {
3329 landFeats = new List<int>();
3331 string[] listBase = IDBaseLandFeat.Split(',');
3332 string[] array = listBase;
3333 foreach (string text in array)
3334 {
3335 if (!text.IsEmpty())
3336 {
3337 landFeats.Add(EClass.sources.elements.alias[text].id);
3338 }
3339 }
3340 if (listBase.Length == 1)
3341 {
3342 List<SourceElement.Row> list = EClass.sources.elements.rows.Where(delegate(SourceElement.Row e)
3343 {
3344 if (e.category != "landfeat" || e.chance == 0)
3345 {
3346 return false;
3347 }
3348 bool flag = true;
3349 string[] tag = e.tag;
3350 foreach (string text2 in tag)
3351 {
3352 if (text2.StartsWith("bf"))
3353 {
3354 flag = false;
3355 if (listBase[0] == text2)
3356 {
3357 flag = true;
3358 break;
3359 }
3360 }
3361 }
3362 return flag ? true : false;
3363 }).ToList();
3364 SourceElement.Row row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3365 landFeats.Add(row.id);
3366 list.Remove(row);
3367 row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3368 landFeats.Add(row.id);
3369 }
3370 Rand.SetSeed();
3371 }
3372 List<Element> list2 = new List<Element>();
3373 foreach (int landFeat in landFeats)
3374 {
3375 list2.Add(Element.Create(landFeat, 1));
3376 }
3377 return list2;
3378 }
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1130
virtual string IDBaseLandFeat
Definition: Zone.cs:151
List< int > landFeats
Definition: Zone.cs:58

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 3936 of file Zone.cs.

3937 {
3938 List<Chara> list = new List<Chara>();
3939 foreach (Chara chara in EClass._map.charas)
3940 {
3941 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3942 {
3943 list.Add(chara);
3944 }
3945 }
3946 return list;
3947 }

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

◆ ModDevelopment()

void Zone.ModDevelopment ( int  a)
inline

Definition at line 3840 of file Zone.cs.

3841 {
3842 base.development += a;
3843 if (a > 0)
3844 {
3845 Msg.Say("gainDevelopment", Name, a.ToString() ?? "");
3846 }
3847 }

References Msg.Say().

◆ ModInfluence()

void Zone.ModInfluence ( int  a)
inline

Definition at line 3830 of file Zone.cs.

3831 {
3832 base.influence += a;
3833 if (a > 0)
3834 {
3835 Msg.Say("gainInfluence", Name, a.ToString() ?? "");
3836 }
3837 Tutorial.Reserve("influence");
3838 }

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

Referenced by Activate(), 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 1237 of file Zone.cs.

1238 {
1239 if (!(id == "startVillage2"))
1240 {
1241 return;
1242 }
1243 if (EClass._map.version.IsBelow(0, 23, 226))
1244 {
1245 SetBGM(121, refresh: false);
1246 }
1247 int num = 0;
1248 foreach (Chara chara in EClass._map.charas)
1249 {
1250 if (chara.id == "cat_silver" && !chara.IsPCFaction)
1251 {
1252 num++;
1253 }
1254 }
1255 if (num > 0)
1256 {
1257 Msg.Say("num_silvercat", num.ToString() ?? "");
1258 }
1259 }
override bool IsPCFaction
Definition: Chara.cs:689
Version version
Definition: Map.cs:28
bool IsBelow(int _major, int _minor, int _batch)
Definition: Version.cs:31

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

Referenced by OnVisit().

◆ OnAdvanceHour()

virtual void Zone.OnAdvanceHour ( )
inlinevirtual

Reimplemented in Region.

Definition at line 1281 of file Zone.cs.

1282 {
1283 }

Referenced by GameDate.AdvanceHour().

◆ OnAfterCreate()

override void Zone.OnAfterCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 621 of file Zone.cs.

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

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

◆ OnAfterSimulate()

virtual void Zone.OnAfterSimulate ( )
inlinevirtual

Reimplemented in Zone_WindRest.

Definition at line 1277 of file Zone.cs.

1278 {
1279 }

Referenced by OnVisit().

◆ OnBeforeDeactivate()

virtual void Zone.OnBeforeDeactivate ( )
inlinevirtual

Reimplemented in Zone_Tent.

Definition at line 1261 of file Zone.cs.

1262 {
1263 }

Referenced by Deactivate().

◆ OnBeforeSimulate()

virtual void Zone.OnBeforeSimulate ( )
inlinevirtual

Reimplemented in Zone_DungeonPuppy, and Zone_Nymelle.

Definition at line 1269 of file Zone.cs.

1270 {
1271 }

Referenced by OnVisit().

◆ OnChildNumChange()

void Zone.OnChildNumChange ( Card  c)
inline

Implements ICardParent.

Definition at line 2045 of file Zone.cs.

2046 {
2047 }

◆ OnCreate()

override void Zone.OnCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 615 of file Zone.cs.

616 {
617 events.zone = this;
618 base.lv = StartLV;
619 }
virtual int StartLV
Definition: Zone.cs:413

References StartLV.

◆ OnCreateBP()

virtual void Zone.OnCreateBP ( )
inlinevirtual

Reimplemented in Zone_Arena2, and Zone_Harvest.

Definition at line 2475 of file Zone.cs.

2476 {
2477 }

Referenced by CreateBP().

◆ OnDeactivate()

virtual void Zone.OnDeactivate ( )
inlinevirtual

Definition at line 1265 of file Zone.cs.

1266 {
1267 }

Referenced by Deactivate().

◆ 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_RandomDungeon, Zone_RandomDungeonFactory, Zone_SnowGrave, Zone_StartSite, Zone_TestRoom, Zone_UnderseaTemple, Zone_VernisMine, Zone_Void, and Zone_WindRest.

Definition at line 2697 of file Zone.cs.

2698 {
2700 {
2701 foreach (Chara chara in EClass._map.charas)
2702 {
2703 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral && chara.OriginalHostility < Hostility.Friend)
2704 {
2705 Hostility hostility2 = (chara.c_originalHostility = Hostility.Neutral);
2706 chara.hostility = hostility2;
2707 }
2708 }
2709 }
2710 if (PrespawnRate != 0f && !IsSkyLevel)
2711 {
2712 for (int i = 0; i < (int)((float)MaxSpawn * PrespawnRate); i++)
2713 {
2714 SpawnMob();
2715 }
2716 }
2721 }
Hostility
Definition: Hostility.cs:2
Hostility OriginalHostility
Definition: Chara.cs:475
Hostility hostility
Definition: Chara.cs:295
virtual float PrespawnRate
Definition: Zone.cs:331
virtual int MaxSpawn
Definition: Zone.cs:317
virtual bool IsSkyLevel
Definition: Zone.cs:271
Chara TryGenerateEvolved(bool force=false, Point p=null)
Definition: Zone.cs:2750
void TryGenerateShrine()
Definition: Zone.cs:2807
void TryGenerateOre()
Definition: Zone.cs:2723
virtual bool MakeEnemiesNeutral
Definition: Zone.cs:238
void TryGenerateBigDaddy()
Definition: Zone.cs:2770

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 2860 of file Zone.cs.

2861 {
2862 }

Referenced by MapGenDungen.OnGenerateTerrain().

◆ OnInspect()

void Zone.OnInspect ( )
inline

Implements IInspect.

Definition at line 3485 of file Zone.cs.

3486 {
3487 }

◆ OnKillGame()

void Zone.OnKillGame ( )
inline

Definition at line 1808 of file Zone.cs.

1809 {
1810 foreach (Thing thing in map.things)
1811 {
1812 if (thing.renderer.hasActor)
1813 {
1814 thing.renderer.KillActor();
1815 }
1816 }
1817 }
void KillActor()
CardRenderer renderer
Definition: Card.cs:64

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

Referenced by Game.Kill().

◆ OnLoad()

override void Zone.OnLoad ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 1995 of file Zone.cs.

1996 {
1997 if (branch != null)
1998 {
1999 branch.SetOwner(this);
2000 }
2001 events.OnLoad(this);
2002 }
void SetOwner(Zone zone)
void OnLoad(Zone _zone)

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

◆ OnRegenerate()

virtual void Zone.OnRegenerate ( )
inlinevirtual

Reimplemented in Zone_LittleGarden, and Zone_Town.

Definition at line 1233 of file Zone.cs.

1234 {
1235 }

Referenced by Activate().

◆ OnSimulateDay()

void Zone.OnSimulateDay ( VirtualDate  date)
inline

Definition at line 3598 of file Zone.cs.

3599 {
3600 if (base.IsPlayerFaction)
3601 {
3602 branch.OnSimulateDay(date);
3603 }
3604 }
void OnSimulateDay(VirtualDate date)

References FactionBranch.OnSimulateDay().

Referenced by VirtualDate.SimulateDay().

◆ OnSimulateHour()

void Zone.OnSimulateHour ( VirtualDate  date)
inline

Definition at line 3543 of file Zone.cs.

3544 {
3545 if (base.IsPlayerFaction)
3546 {
3547 branch.OnSimulateHour(date);
3548 }
3550 if (date.IsRealTime)
3551 {
3552 foreach (Thing thing in EClass._map.things)
3553 {
3554 if (thing.IsInstalled)
3555 {
3556 thing.trait.TryToggle();
3557 }
3558 }
3560 }
3561 EClass._map.things.ForeachReverse(delegate(Thing t)
3562 {
3563 t.OnSimulateHour(date);
3564 });
3565 foreach (Thing sucker in Suckers)
3566 {
3567 sucker.Destroy();
3568 }
3569 Suckers.Clear();
3570 if (RespawnRate != 0f)
3571 {
3572 int num = 0;
3573 foreach (Chara chara in map.charas)
3574 {
3575 if (!chara.IsGlobal)
3576 {
3577 num++;
3578 }
3579 }
3580 if (num < MaxRespawn)
3581 {
3582 for (int i = 0; i < RespawnPerHour; i++)
3583 {
3584 SpawnMob();
3585 }
3586 }
3587 }
3588 if (!date.IsRealTime && EClass.rnd(24) == 0)
3589 {
3590 RainWater();
3591 }
3592 if (date.hour == 6)
3593 {
3594 GrowPlants(date);
3595 }
3596 }
virtual void OnSimulateHour(VirtualDate date)
Definition: Card.cs:7064
void DecayNatural(int hour=1)
Definition: Card.cs:7073
int hour
Definition: Date.cs:74
void OnSimulateHour(VirtualDate date)
virtual void TryToggle()
Definition: Trait.cs:1327
bool IsRealTime
Definition: VirtualDate.cs:7
virtual int RespawnPerHour
Definition: Zone.cs:347
virtual float RespawnRate
Definition: Zone.cs:333
static List< Thing > Suckers
Definition: Zone.cs:83
void GrowPlants(VirtualDate date)
Definition: Zone.cs:3633
int MaxRespawn
Definition: Zone.cs:319

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 3606 of file Zone.cs.

3607 {
3608 if (base.IsPlayerFaction)
3609 {
3610 branch.OnSimulateMonth(date);
3611 }
3612 if (date.IsRealTime)
3613 {
3615 }
3616 }
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 1134 of file Zone.cs.

1135 {
1136 if (EClass.world.date.IsExpired(base.dateRevive))
1137 {
1139 Revive();
1140 List<Chara> list = new List<Chara>();
1141 foreach (Chara chara in EClass._map.charas)
1142 {
1143 chara.TryRestock(onCreate: false);
1144 if (!chara.IsPCFaction)
1145 {
1146 chara.c_fur = 0;
1147 }
1148 if (chara.IsMinion && chara.master != null && !chara.master.IsPCParty)
1149 {
1150 list.Add(chara);
1151 }
1152 }
1153 foreach (Chara item in list)
1154 {
1155 item.Destroy();
1156 }
1157 }
1158 if (!EClass.game.isLoading)
1159 {
1161 }
1164 events.OnVisit();
1165 OnActivate();
1166 UpdateQuests();
1168 isSimulating = true;
1169 Simulate();
1170 isSimulating = false;
1172 if (EClass.Branch != null)
1173 {
1175 }
1176 base.lastActive = EClass.world.date.GetRaw();
1177 if (!EClass.game.isLoading)
1178 {
1179 base.visitCount++;
1180 }
1181 base.version = EClass.core.version.GetInt();
1182 if (HasField(10000))
1183 {
1184 Tutorial.Reserve("field");
1185 }
1186 }
Version version
Definition: BaseCore.cs:17
void TryRestock(bool onCreate)
Definition: Chara.cs:4944
void OnAfterSimulate()
void AssignCharas()
Definition: RoomManager.cs:39
void Revive()
Definition: Zone.cs:1199
void RefreshDeathSentense()
Definition: Zone.cs:1188
void Simulate()
Definition: Zone.cs:1285
virtual void OnAfterSimulate()
Definition: Zone.cs:1277
void RefreshCriminal()
Definition: Zone.cs:3771
bool HasField(int idEle)
Definition: Zone.cs:3090
virtual void OnBeforeSimulate()
Definition: Zone.cs:1269
virtual void OnActivate()
Definition: Zone.cs:1237
void ResetHostility()
Definition: Zone.cs:2844
void UpdateQuests(bool force=false)
Definition: Zone.cs:3849
int GetInt()
Definition: Version.cs:21

References EClass._map, RoomManager.AssignCharas(), EClass.Branch, Map.charas, EClass.core, World.date, events, EClass.game, Version.GetInt(), Date.GetRaw(), HasField(), Date.IsExpired(), Game.isLoading, Chara.IsMinion, Chara.IsPCFaction, Chara.IsPCParty, isSimulating, item, Chara.master, OnActivate(), FactionBranch.OnAfterSimulate(), OnAfterSimulate(), OnBeforeSimulate(), ZoneEventManager.OnVisit(), RefreshCriminal(), RefreshDeathSentense(), Tutorial.Reserve(), ResetHostility(), Revive(), Map.rooms, Simulate(), Chara.TryRestock(), UpdateQuests(), BaseCore.version, and EClass.world.

Referenced by Activate().

◆ OnVisitNewMapOrRegenerate()

virtual void Zone.OnVisitNewMapOrRegenerate ( )
inlinevirtual

Reimplemented in Zone_Aquli, and Zone_Yowyn.

Definition at line 1273 of file Zone.cs.

1274 {
1275 }

Referenced by Activate().

◆ ParseZoneFullName()

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

Definition at line 552 of file Zone.cs.

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

References item, zoneId, and zoneType.

◆ RainWater()

void Zone.RainWater ( )
inline

Definition at line 3618 of file Zone.cs.

3619 {
3621 {
3622 return;
3623 }
3624 EClass._map.bounds.ForeachCell(delegate(Cell c)
3625 {
3626 if (c.IsFarmField && !c.HasRoof)
3627 {
3628 c.isWatered = true;
3629 }
3630 });
3631 }
bool IsFarmField
Definition: Cell.cs:738
bool IsIndoor
Definition: Map.cs:131

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

Referenced by Activate(), and Weather.SetCondition().

◆ RefreshBGM()

void Zone.RefreshBGM ( )
inline

Definition at line 3233 of file Zone.cs.

3234 {
3236 {
3237 return;
3238 }
3240 Playlist playlist = map.plDay;
3241 foreach (ZoneEvent item in events.list)
3242 {
3243 if (item.playlist != null)
3244 {
3245 playlist = item.playlist;
3246 }
3247 }
3248 if (IDPlaylistOverwrite != null)
3249 {
3250 playlist = EClass.Sound.GetPlaylist(IDPlaylistOverwrite);
3251 }
3253 {
3254 Room room = EClass.pc.pos.cell.room;
3255 if (room != null && room.lot != null && room.lot.idBGM != 0)
3256 {
3257 playlist = EClass.Sound.plLot;
3258 if (playlist.list[0].data?.id != room.lot.idBGM)
3259 {
3260 playlist.list[0].data = EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM);
3261 playlist.Reset();
3262 if (!LayerDrama.keepBGM)
3263 {
3264 EClass.Sound.StopBGM(1f);
3265 }
3266 }
3267 }
3268 }
3270 EClass.Sound.SwitchPlaylist(playlist, !LayerDrama.keepBGM);
3271 }
bool IsInActiveZone
Definition: Chara.cs:885
void SetBGMInterval()
Definition: CoreConfig.cs:1022
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:77
Lot lot
Definition: Room.cs:21
List< ZoneEvent > list
virtual string IDPlaylistOverwrite
Definition: Zone.cs:147

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 Activate(), 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 3771 of file Zone.cs.

3772 {
3773 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3774 Hostility hostility = (flag ? Hostility.Neutral : Hostility.Friend);
3775 foreach (Chara chara in EClass._map.charas)
3776 {
3777 if (chara.trait is TraitGuard)
3778 {
3779 chara.hostility = hostility;
3780 if (!flag && chara.enemy != null && chara.enemy.IsPCParty)
3781 {
3782 chara.SetEnemy();
3783 }
3784 }
3785 }
3786 }
Chara enemy
Definition: Chara.cs:86
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6643
virtual bool AllowCriminal
Definition: Zone.cs:251

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

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

◆ RefreshDeathSentense()

void Zone.RefreshDeathSentense ( )
inline

Definition at line 1188 of file Zone.cs.

1189 {
1190 foreach (Chara chara in EClass._map.charas)
1191 {
1192 if (chara.HasCondition<ConDeathSentense>())
1193 {
1194 chara.GetCondition<ConDeathSentense>().TryRemove();
1195 }
1196 }
1197 }
BaseCondition GetCondition(string idCon)
Definition: Chara.cs:10025
bool HasCondition(string alias)
Definition: Chara.cs:9970

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

Referenced by Chara.Die(), and OnVisit().

◆ RefreshElectricity()

void Zone.RefreshElectricity ( )
inline

Definition at line 3105 of file Zone.cs.

3106 {
3107 dirtyElectricity = false;
3108 bool flag = GetSoilCost() > MaxSoil;
3109 base.electricity = elements.Value(2201) * 10 + BaseElectricity;
3110 foreach (Thing thing in EClass._map.things)
3111 {
3112 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
3113 {
3114 base.electricity += thing.trait.Electricity;
3115 }
3116 }
3117 if (!flag)
3118 {
3119 EClass._map.bounds.ForeachCell(delegate(Cell c)
3120 {
3121 if (c.sourceObj.id == 118 && c.growth.IsMature)
3122 {
3123 base.electricity += 20;
3124 }
3125 });
3126 }
3127 foreach (Thing thing2 in EClass._map.things)
3128 {
3129 if (thing2.IsInstalled)
3130 {
3131 thing2.trait.TryToggle();
3132 }
3133 }
3134 }
bool dirtyElectricity
Definition: Zone.cs:71

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 Activate(), TraitLeverBreaker.OnToggle(), Scene.OnUpdate(), TraitGenerator.Recover(), UIHomeInfo.Refresh(), and TraitGenerator.ShortOut().

◆ RefreshHat()

void Zone.RefreshHat ( )
inline

Definition at line 1124 of file Zone.cs.

1125 {
1126 if (idHat != null && EClass.world.date.IsExpired(base.dateHat))
1127 {
1128 idHat = null;
1129 base.dateHat = 0;
1130 }
1131 sourceHat = ((idHat != null) ? EClass.sources.cards.map[idHat] : ((IDHat != null) ? EClass.sources.cards.map[IDHat] : null));
1132 }
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceCard cards
string idHat
Definition: Spatial.cs:31
virtual string IDHat
Definition: Zone.cs:149
static CardRow sourceHat
Definition: Zone.cs:29

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

Referenced by Activate(), and TraitHat.OnUse().

◆ RefreshListCitizen()

void Zone.RefreshListCitizen ( )
inline

Definition at line 3788 of file Zone.cs.

3789 {
3790 if (base.lv != 0)
3791 {
3792 return;
3793 }
3794 dictCitizen.Clear();
3795 foreach (Chara item in map.charas.Concat(map.deadCharas))
3796 {
3797 if (item.trait.IsCitizen && !item.IsGlobal && !item.isSubsetCard)
3798 {
3799 dictCitizen[item.uid] = item.Name;
3800 }
3801 }
3802 }
Dictionary< int, string > dictCitizen
Definition: Zone.cs:52

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

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

◆ RefreshPlaylist()

void Zone.RefreshPlaylist ( )
inline

Definition at line 3217 of file Zone.cs.

3218 {
3219 if (map.plDay == null)
3220 {
3221 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList));
3222 }
3223 }

References Map._plDay, Map.plDay, and EClass.Sound.

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

◆ RemoveCard()

void Zone.RemoveCard ( Card  t)
inline

Implements ICardParent.

Definition at line 2138 of file Zone.cs.

2139 {
2140 if (IsActiveZone)
2141 {
2143 }
2144 t.parent = null;
2145 if (t.isChara)
2146 {
2147 t.Chara.currentZone = null;
2148 }
2149 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
2150 {
2152 }
2153 if (t.renderer.hasActor)
2154 {
2156 }
2157 }
override void OnLeaveScreen()
virtual bool isChara
Definition: Card.cs:2135
void OnCardRemovedFromZone(Card t)
Definition: Map.cs:837
void RemoveActorEx(Card c)
Definition: Scene.cs:1034
virtual string IDActorEx
Definition: Trait.cs:187

References CardRenderer.hasActor, Trait.IDActorEx, IsActiveZone, Card.isChara, Card.isThing, map, 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 3100 of file Zone.cs.

3101 {
3102 fieldElements.Remove(idEle);
3103 }
void Remove(int id)

References ElementContainer.Remove().

Referenced by GameDate.AdvanceMin().

◆ ResetHostility()

void Zone.ResetHostility ( )
inline

Definition at line 2844 of file Zone.cs.

2845 {
2846 foreach (Chara chara in EClass._map.charas)
2847 {
2848 if (!chara.source.hostility.IsEmpty() && chara.source.hostility.ToEnum<Hostility>() >= Hostility.Friend && !chara.IsPCFactionOrMinion)
2849 {
2850 chara.c_originalHostility = (Hostility)0;
2851 }
2852 chara.hostility = chara.OriginalHostility;
2853 if (chara.enemy != null && (chara.enemy.IsPCFaction || chara.IsPCFaction))
2854 {
2855 chara.SetEnemy();
2856 }
2857 }
2858 }
bool IsPCFactionOrMinion
Definition: Card.cs:2342
SourceChara.Row source
Definition: Chara.cs:162

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

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

◆ ResetPlaylist()

void Zone.ResetPlaylist ( )
inline

Definition at line 3225 of file Zone.cs.

3226 {
3227 map._plDay.Clear();
3228 UnityEngine.Object.DestroyImmediate(map.plDay);
3229 map.plDay = null;
3231 }

References Map._plDay, and Map.plDay.

◆ Revive()

void Zone.Revive ( )
inline

Definition at line 1199 of file Zone.cs.

1200 {
1201 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
1202 if (ShouldAutoRevive)
1203 {
1204 foreach (Chara deadChara in map.deadCharas)
1205 {
1206 if (deadChara.trait.CanAutoRevive && deadChara.CanRevive())
1207 {
1208 deadChara.Revive();
1210 {
1211 deadChara.RemoveBacker();
1212 }
1213 EClass._zone.AddCard(deadChara, (deadChara.orgPos != null && deadChara.orgPos.IsInBounds) ? deadChara.orgPos : deadChara.pos);
1214 }
1215 }
1216 }
1217 foreach (Chara value in EClass.game.cards.globalCharas.Values)
1218 {
1219 if (value.isDead && value.CanRevive() && value.homeZone == this)
1220 {
1221 value.Revive();
1222 Point point = GetSpawnPos(value);
1223 if (value.orgPos != null && value.orgPos.IsInBounds)
1224 {
1225 point = value.orgPos.GetNearestPoint() ?? point;
1226 }
1227 EClass._zone.AddCard(value, point);
1228 }
1229 }
1230 map.deadCharas.Clear();
1231 }
int c_idBacker
Definition: Card.cs:1477
bool CanRevive()
Definition: Chara.cs:5417
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:5443
Zone homeZone
Definition: Chara.cs:271
bool IsInBounds
Definition: Point.cs:104
virtual bool CanAutoRevive
Definition: TraitChara.cs:21
virtual bool ShouldAutoRevive
Definition: Zone.cs:384

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, Player.doneBackers, EClass.game, Point.GetNearestPoint(), Date.GetRaw(), GetSpawnPos(), CardManager.globalCharas, Chara.homeZone, CoreConfig.Test.ignoreBackerDestoryFlag, Card.isBackerContent, Chara.isDead, Point.IsInBounds, map, Chara.orgPos, EClass.player, Card.pos, Card.RemoveBacker(), Chara.Revive(), EClass.setting, ShouldAutoRevive, CoreConfig.test, Chara.trait, and EClass.world.

Referenced by OnVisit(), and Map.ResetEditorPos().

◆ SetAlarm()

virtual void Zone.SetAlarm ( bool  enable)
inlinevirtual

Reimplemented in Zone_CurryRuinDungeon.

Definition at line 3804 of file Zone.cs.

3805 {
3806 base.isAlarmSet = enable;
3807 if (enable)
3808 {
3809 foreach (Chara chara in EClass._map.charas)
3810 {
3811 if (!chara.IsPCFactionOrMinion)
3812 {
3813 chara.SetHostility(Hostility.Enemy);
3814 }
3815 }
3816 Msg.Say("alarm");
3817 Msg.Say("alarm2");
3818 SE.Play("alarm");
3819 return;
3820 }
3821 foreach (Chara chara2 in EClass._map.charas)
3822 {
3823 if (!chara2.IsPCFactionOrMinion)
3824 {
3825 chara2.SetHostility(Hostility.Neutral);
3826 }
3827 }
3828 }
Chara SetHostility(Hostility h)
Definition: Chara.cs:1505

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 3212 of file Zone.cs.

3213 {
3214 SetBGM(new List<int> { id }, refresh, fadeDuration);
3215 }

◆ SetBGM() [2/2]

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

Definition at line 3175 of file Zone.cs.

3176 {
3177 map._plDay.Clear();
3178 if (ids.Count > 0)
3179 {
3180 foreach (int id in ids)
3181 {
3182 if (id != -1)
3183 {
3184 map._plDay.Add(id);
3185 }
3186 }
3187 }
3188 UnityEngine.Object.DestroyImmediate(map.plDay);
3189 map.plDay = null;
3191 if (!refresh)
3192 {
3193 return;
3194 }
3195 if (fadeDuration > 0f)
3196 {
3197 EClass.Sound.StopBGM(fadeDuration, playLastBGM: false, delegate
3198 {
3200 {
3201 RefreshBGM();
3202 }
3203 });
3204 }
3205 else
3206 {
3207 EClass.Sound.StopBGM();
3208 RefreshBGM();
3209 }
3210 }
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(), OnActivate(), Zone_DungeonDead.OnActivate(), Zone_Nefu.OnActivate(), ZoneEventDefenseGame.OnVisit(), ZoneEventHarvest.OnVisit(), ZoneEventSubdue.OnVisit(), DramaManager.ParseLine(), GoalCombat.Run(), Zone_CurryRuinDungeon.SetAlarm(), CardRenderer.ShowBossText(), ActThrow.Throw(), and Chara.TryDropBossLoot().

◆ SetFieldEffect()

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

Definition at line 3095 of file Zone.cs.

3096 {
3097 fieldElements.SetBase(idEle, a, duration);
3098 }
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 587 of file Zone.cs.

588 {
589 return false;
590 }

Referenced by SerializedCards.Restore().

◆ Simulate()

void Zone.Simulate ( )
inline

Definition at line 1285 of file Zone.cs.

1286 {
1287 if (!EClass.game.isLoading && base.visitCount > 0)
1288 {
1289 if (Boss != null && IsNefia)
1290 {
1291 Msg.Say("bossLeave", Boss.Name.ToTitleCase(), EClass._zone.Name);
1294 }
1295 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1296 foreach (Chara chara2 in EClass._map.charas)
1297 {
1298 if (chara2.hp < 0)
1299 {
1300 chara2.hp = 0;
1301 }
1302 if (!chara2.IsPCParty)
1303 {
1304 if (chara2.mana.value < 0)
1305 {
1306 chara2.mana.value = 0;
1307 }
1308 if (chara2.stamina.value < 0)
1309 {
1310 chara2.stamina.value = 0;
1311 }
1312 }
1313 if (num > 60)
1314 {
1315 chara2.resistCon = null;
1316 }
1317 if (chara2.rarity >= Rarity.Legendary && !chara2.IsPCFaction && num > 0)
1318 {
1319 Msg.ignoreAll = true;
1320 chara2.Cure(CureType.Boss, 20 + num * 10);
1321 chara2.HealHP((int)((long)Mathf.Max(1, chara2.MaxHP) * (long)Mathf.Min(num, 20) / 20));
1322 chara2.mana.Mod(Mathf.Max(1, chara2.mana.max) * Mathf.Min(num, 20) / 20);
1323 chara2.stamina.Mod(Mathf.Max(1, chara2.stamina.max) * Mathf.Min(num, 20) / 20);
1324 Msg.ignoreAll = false;
1325 }
1326 }
1327 }
1328 Debug.Log("Last Active:" + base.lastActive);
1329 if (base.lastActive == 0 || HourSinceLastActive <= 1 || IsRegion)
1330 {
1331 return;
1332 }
1333 Debug.Log(Name + " Simulate:" + HourSinceLastActive + " hours");
1334 VirtualDate virtualDate = new VirtualDate(HourSinceLastActive);
1335 List<Chara> list = EClass._map.charas.ToList();
1336 int num2 = HourSinceLastActive / 24;
1337 int num3 = 0;
1338 if (num2 > 0)
1339 {
1340 foreach (Chara item in list)
1341 {
1342 if (!item.IsPCParty)
1343 {
1344 item.OnSleep(200, num2);
1345 if (item.conSleep != null)
1346 {
1347 item.conSleep.Kill();
1348 }
1349 if (EClass.rnd(EClass.world.date.IsNight ? 20 : 200) == 0 && !item.IsPCFaction)
1350 {
1351 item.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
1352 }
1353 if (item.things.Count > 20)
1354 {
1355 item.ClearInventory(ClearInventoryType.Purge);
1356 }
1357 }
1358 }
1359 }
1360 VirtualDate.current = virtualDate;
1361 for (int i = 0; i < HourSinceLastActive; i++)
1362 {
1363 virtualDate.SimulateHour();
1364 if (!virtualDate.IsWinter)
1365 {
1366 num3++;
1367 }
1368 }
1369 EClass._map.things.ForeachReverse(delegate(Thing t)
1370 {
1372 });
1373 VirtualDate.current = null;
1374 if (!IsPCFaction)
1375 {
1376 return;
1377 }
1378 int num4 = 0;
1379 foreach (Chara item2 in list)
1380 {
1381 if (item2.IsPCParty)
1382 {
1383 continue;
1384 }
1385 if (!item2.IsHomeMember())
1386 {
1387 if (item2.id == "bee")
1388 {
1389 num4++;
1390 }
1391 if (num2 > 0 && item2.IsGuest())
1392 {
1393 item2.ChooseNewGoal();
1394 item2.ai.SimulateZone(num2);
1395 }
1396 continue;
1397 }
1398 if (num2 > 0)
1399 {
1400 Goal goalWork = item2.GetGoalWork();
1401 item2.SetAI(goalWork);
1402 if (goalWork is GoalWork)
1403 {
1404 (goalWork as GoalWork).FindWork(item2);
1405 }
1406 item2.ai.SimulateZone(num2);
1407 goalWork = item2.GetGoalHobby();
1408 item2.SetAI(goalWork);
1409 if (goalWork is GoalWork)
1410 {
1411 (goalWork as GoalWork).FindWork(item2);
1412 }
1413 item2.ai.SimulateZone(num2);
1414 }
1415 item2.ChooseNewGoal();
1416 if (item2.conSuspend == null)
1417 {
1418 item2.ai.OnSimulatePosition();
1419 }
1420 }
1421 List<Thing> list2 = new List<Thing>();
1422 foreach (Thing thing in map.things)
1423 {
1424 if (thing.IsInstalled && thing.trait is TraitBeekeep)
1425 {
1426 list2.Add(thing);
1427 }
1428 }
1429 if (num4 >= list2.Count)
1430 {
1431 return;
1432 }
1433 for (int j = num4; j < list2.Count; j++)
1434 {
1435 if (EClass.rnd(200) <= HourSinceLastActive)
1436 {
1437 Chara chara = CharaGen.Create("bee");
1438 AddCard(chara, list2.RandomItem().pos);
1439 Hostility c_originalHostility = (chara.hostility = Hostility.Neutral);
1440 chara.c_originalHostility = c_originalHostility;
1441 }
1442 }
1443 }
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:2191
virtual void HealHP(long a, HealSource origin=HealSource.None)
Definition: Card.cs:4185
AIAct ai
Definition: Chara.cs:206
ConSuspend conSuspend
Definition: Chara.cs:104
Goal GetGoalWork()
Definition: Chara.cs:9348
override int MaxHP
Definition: Chara.cs:726
Goal GetGoalHobby()
Definition: Chara.cs:9361
Stats mana
Definition: Chara.cs:1213
Stats stamina
Definition: Chara.cs:1205
bool IsHomeMember()
Definition: Chara.cs:6939
bool IsGuest()
Definition: Chara.cs:6964
void ChooseNewGoal()
Definition: Chara.cs:9284
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:10074
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:127
Chara Boss
Definition: Zone.cs:88
int HourSinceLastActive
Definition: Zone.cs:125

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

Referenced by OnVisit().

◆ SpawnAltar()

void Zone.SpawnAltar ( )
inline

Definition at line 2658 of file Zone.cs.

2659 {
2661 {
2662 if (r.points.Count <= 4)
2663 {
2664 return false;
2665 }
2666 map.poiMap.OccyupyPOI(r.points[0]);
2667 List<Point> points = r.points;
2668 Religion randomReligion = EClass.game.religions.GetRandomReligion();
2669 "altarPoint".lang(randomReligion.NameDomain.lang());
2670 Thing thing = ThingGen.Create("altar");
2671 (thing.trait as TraitAltar).SetDeity(randomReligion.id);
2672 Chara t = CharaGen.Create("twintail");
2673 EClass._zone.AddCard(t, points.RandomItem());
2674 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2675 {
2676 Chara t2 = CharaGen.Create("twintail");
2677 EClass._zone.AddCard(t2, points.RandomItem());
2678 }
2679 if (points[0].Installed == null)
2680 {
2681 EClass._zone.AddCard(thing, points[0]).Install();
2682 }
2683 foreach (Point item in points)
2684 {
2685 if (item.x % 3 == 0 && item.z % 2 == 0 && item != points[0] && !item.Equals(points[0].Front) && item.Installed == null)
2686 {
2687 thing = ThingGen.Create("pillar1");
2688 EClass._zone.AddCard(thing, item).Install();
2689 }
2690 item.SetObj();
2691 item.SetFloor(3, 6);
2692 }
2693 return true;
2694 });
2695 }
$ Installed
Definition: ModManager.cs:306
Crawler start
Definition: CoreRef.cs:217
Crawlers crawlers
Definition: CoreRef.cs:346
ReligionManager religions
Definition: Game.cs:159
POIMap poiMap
Definition: Map.cs:97
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, map, POIMap.OccyupyPOI(), Map.poiMap, Core.refs, Game.religions, EClass.rnd(), CoreRef.Crawlers.start, and Card.trait.

Referenced by Generate().

◆ SpawnLostItems()

void Zone.SpawnLostItems ( )
inline

Definition at line 3972 of file Zone.cs.

3973 {
3974 for (int i = 0; i < 2 + EClass.rnd(4); i++)
3975 {
3976 Point point = GetPos();
3977 if (point == null)
3978 {
3979 continue;
3980 }
3981 if (EClass.rnd(30) == 0)
3982 {
3983 Thing thing = ThingGen.Create("purse");
3984 thing.isLostProperty = true;
3985 thing.things.DestroyAll();
3986 int num2 = (thing.c_lockLv = EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3987 thing.Add("money", EClass.rndHalf(num2 * 60 + 1000));
3988 if (EClass.rnd(2) == 0)
3989 {
3990 thing.Add("plat", EClass.rnd(4));
3991 }
3992 else
3993 {
3994 thing.Add("medal", EClass.rnd(2));
3995 }
3996 EClass._zone.AddCard(thing, point);
3997 }
3998 else
3999 {
4001 }
4002 }
4003 static Point GetPos()
4004 {
4005 for (int j = 0; j < 10; j++)
4006 {
4007 Point randomPoint = EClass._zone.bounds.GetRandomPoint();
4008 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
4009 {
4010 return randomPoint;
4011 }
4012 }
4013 return null;
4014 }
4015 }
ThingContainer things
Definition: Card.cs:39
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3254
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:49

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.

Referenced by Activate().

◆ SpawnMob() [1/2]

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

Definition at line 2918 of file Zone.cs.

2919 {
2920 if (setting == null)
2921 {
2923 }
2924 if (pos == null)
2925 {
2926 pos = GetSpawnPos(setting.position, setting.tries);
2927 if (pos == null)
2928 {
2929 pos = GetSpawnPos(SpawnPosition.Random, setting.tries);
2930 if (pos == null)
2931 {
2932 return null;
2933 }
2934 }
2935 }
2937 if (IsUnderwater && EClass.rnd(15) != 0)
2938 {
2940 }
2941 SpawnList spawnList = null;
2942 if (setting.idSpawnList != null)
2943 {
2944 spawnList = SpawnList.Get(setting.idSpawnList);
2945 }
2946 else if (EClass._zone is Zone_DungeonYeek && EClass.rnd(5) != 0)
2947 {
2948 spawnList = SpawnListChara.Get("dungeon_yeek", (SourceChara.Row r) => r.race == "yeek" && r.quality == 0);
2949 }
2950 else if (EClass._zone is Zone_DungeonDragon && EClass.rnd(5) != 0)
2951 {
2952 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);
2953 }
2954 else if (EClass._zone is Zone_DungeonMino && EClass.rnd(5) != 0)
2955 {
2956 spawnList = SpawnListChara.Get("dungeon_mino", (SourceChara.Row r) => r.race == "minotaur" && r.quality == 0);
2957 }
2958 else if (setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) < ChanceSpawnNeutral))
2959 {
2960 spawnList = SpawnList.Get(IsInstance ? "c_neutral_war" : "c_neutral");
2961 }
2962 else if (biome.spawn.chara.Count > 0)
2963 {
2964 string randomCharaId = biome.spawn.GetRandomCharaId();
2965 spawnList = ((!IsInstance) ? SpawnList.Get(randomCharaId) : SpawnList.Get("instance_" + randomCharaId, randomCharaId, new CharaFilter
2966 {
2967 ShouldPass = (SourceChara.Row s) => (!(s.hostility != "") || (!s.tag.Contains("cat") && !s.race_row.tag.Contains("cat"))) ? true : false
2968 }));
2969 }
2970 else
2971 {
2972 spawnList = SpawnList.Get(biome.name, "chara", new CharaFilter
2973 {
2974 ShouldPass = delegate(SourceChara.Row s)
2975 {
2976 if (s.hostility != "")
2977 {
2978 return false;
2979 }
2980 return s.biome == biome.name || s.biome.IsEmpty();
2981 }
2982 });
2983 }
2984 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
2985 CardBlueprint cardBlueprint = new CardBlueprint
2986 {
2987 rarity = Rarity.Normal,
2988 idEle = setting.idEle
2989 };
2990 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
2991 if (ScaleType == ZoneScaleType.Void)
2992 {
2993 num2 = ((num - 1) % 50 + 5) * 150 / 100;
2994 if (num2 >= 20 && EClass.rnd(100) < num2)
2995 {
2996 num2 = num;
2997 }
2998 }
2999 CardRow cardRow = (setting.id.IsEmpty() ? spawnList.Select(num2, setting.levelRange) : EClass.sources.cards.map[setting.id]);
3000 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)
3001 {
3002 cardRow = EClass.sources.cards.map["santa"];
3004 }
3005 long num3 = ((setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv);
3006 bool flag = setting.fixedLv != -1 || DangerLvBoost > 0;
3007 num3 += setting.addLv;
3008 if (ScaleType == ZoneScaleType.Void)
3009 {
3010 num3 = (50L + (long)cardRow.LV) * Mathf.Max(1, (num - 1) / 50);
3011 flag = true;
3012 }
3013 num3 += DangerLvBoost;
3014 if (setting.rarity == Rarity.Random && cardRow.quality == 0)
3015 {
3016 if (EClass.rnd(EClass.pc.HasElement(1271) ? 80 : 100) == 0)
3017 {
3018 cardBlueprint.rarity = Rarity.Legendary;
3019 num3 = num3 * 125 / 100;
3020 }
3021 }
3022 else
3023 {
3024 cardBlueprint.rarity = setting.rarity;
3025 }
3026 if (setting.isBoss)
3027 {
3028 num3 = num3 * 150 / 100;
3029 }
3030 if (setting.isEvolved)
3031 {
3032 num3 = num3 * 2 + 20;
3033 }
3034 if (num3 != cardRow.LV)
3035 {
3036 cardBlueprint.lv = (int)Mathf.Min(num3, 100000000f);
3037 }
3038 CardBlueprint.Set(cardBlueprint);
3039 Chara chara = CharaGen.Create(cardRow.id, num2);
3040 if (!flag)
3041 {
3042 chara.isScaled = false;
3043 }
3044 AddCard(chara, pos);
3045 if (setting.forcedHostility.HasValue)
3046 {
3047 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
3048 chara.c_originalHostility = c_originalHostility;
3049 }
3050 else
3051 {
3052 switch (chara.id)
3053 {
3054 case "unicorn":
3055 if (EClass.pc.HasElement(1216) && EClass.pc.Evalue(418) < 1)
3056 {
3057 chara.SetHostility(Hostility.Enemy);
3058 }
3059 break;
3060 case "santa":
3061 case "silverwolf":
3062 case "twintail":
3063 case "test17":
3064 if (EClass.pc.HasElement(1270))
3065 {
3066 chara.SetHostility(Hostility.Friend);
3067 }
3068 else if (EClass.pc.HasElement(1271))
3069 {
3070 chara.SetHostility(Hostility.Enemy);
3071 }
3072 break;
3073 }
3074 }
3075 if (setting.isBoss)
3076 {
3077 chara.c_bossType = BossType.Boss;
3078 }
3079 if (setting.isEvolved)
3080 {
3081 chara.c_bossType = BossType.Evolved;
3082 }
3083 if (DangerLv >= 20 && !IsPCFaction && !IsTown && EClass.rnd(200) == 0)
3084 {
3086 }
3087 return chara;
3088 }
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:6371
BiomeProfile biome
Definition: Cell.cs:1087
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9798
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:1161
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:415
virtual float ChanceSpawnNeutral
Definition: Zone.cs:349

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 602 of file Zone.cs.

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

References ToString().

◆ ToString()

override string Zone.ToString ( )
inline

Definition at line 597 of file Zone.cs.

598 {
599 return Name + "(" + base.uid + ")(" + RegionPos?.ToString() + ") instance?" + IsInstance + "/" + EClass.world.date.GetRemainingHours(base.dateExpire) + "h";
600 }
int GetRemainingHours(int rawDeadLine)
Definition: Date.cs:343
override string ToString()
Definition: Point.cs:524
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 2338 of file Zone.cs.

2339 {
2340 int num = 0;
2341 if (p.cell.detail != null)
2342 {
2343 foreach (Thing thing in p.cell.detail.things)
2344 {
2345 if (thing.placeState == PlaceState.roaming)
2346 {
2347 if (target.TryStackTo(thing))
2348 {
2349 return true;
2350 }
2351 num++;
2352 }
2353 }
2354 }
2355 if (num == 0 || !destroyIfFail)
2356 {
2357 EClass._zone.AddCard(target, p);
2358 return true;
2359 }
2360 target.Destroy();
2361 return false;
2362 }
bool TryStackTo(Thing to)
Definition: Card.cs:3575
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 2241 of file Zone.cs.

2242 {
2243 Thing dest = null;
2244 int priority = -1;
2245 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
2246 if (flag == ContainerFlag.none)
2247 {
2248 flag = ContainerFlag.other;
2249 }
2250 if (containers == null)
2251 {
2252 containers = EClass._map.props.installed.containers;
2253 }
2254 if (SearchDest() != null)
2255 {
2256 return true;
2257 }
2258 if (dest == null)
2259 {
2260 return false;
2261 }
2262 if (add)
2263 {
2264 if (msg)
2265 {
2266 chara.Say("putSharedItem", chara, t, dest.GetName(NameStyle.Full));
2267 }
2268 dest.AddThing(t);
2269 }
2270 return true;
2271 Thing SearchDest()
2272 {
2273 foreach (Thing container in containers)
2274 {
2275 Thing thing = container;
2276 if (thing.trait is TraitShippingChest)
2277 {
2279 }
2280 if ((!sharedOnly || thing.IsSharedContainer) && thing.c_lockLv <= 0 && (thing.things.Count < thing.things.MaxCapacity || thing.things.CanStack(t) != t))
2281 {
2282 Window.SaveData windowSaveData = thing.GetWindowSaveData();
2283 if (windowSaveData != null)
2284 {
2285 if (windowSaveData.priority <= priority || (windowSaveData.noRotten && t.IsDecayed) || (windowSaveData.onlyRottable && t.trait.Decay == 0))
2286 {
2287 continue;
2288 }
2290 if (windowSaveData.userFilter)
2291 {
2292 filterResult = windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1));
2293 if (filterResult == Window.SaveData.FilterResult.Block)
2294 {
2295 continue;
2296 }
2297 }
2298 if (filterResult != Window.SaveData.FilterResult.PassWithoutFurtherTest)
2299 {
2300 if (windowSaveData.advDistribution)
2301 {
2302 bool flag2 = false;
2303 foreach (int cat in windowSaveData.cats)
2304 {
2305 if (t.category.uid == cat)
2306 {
2307 flag2 = true;
2308 break;
2309 }
2310 }
2311 if (!flag2)
2312 {
2313 continue;
2314 }
2315 }
2316 else if (windowSaveData.flag.HasFlag(flag))
2317 {
2318 continue;
2319 }
2320 }
2321 priority = windowSaveData.priority;
2322 }
2323 else
2324 {
2325 if (priority != -1)
2326 {
2327 continue;
2328 }
2329 priority = 0;
2330 }
2331 dest = thing;
2332 }
2333 }
2334 return null;
2335 }
2336 }
ContainerFlag
Definition: ContainerFlag.cs:5
NameStyle
Definition: NameStyle.cs:2
Thing container_shipping
Definition: CardManager.cs:52
bool IsDecayed
Definition: Card.cs:2357
int c_lockLv
Definition: Card.cs:991
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3277
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2649
SourceCategory.Row category
Definition: Card.cs:2101
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7311
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:532
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, Card.AddThing(), 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.Say(), Card.things, Card.trait, and Window.SaveData.userFilter.

Referenced by FactionBranch.AutoClean(), AI_Haul.GetThingToClean(), AI_Haul.Run(), TryAddThingInSpot< T >(), 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 2164 of file Zone.cs.

2164 : Trait
2165 {
2166 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<T>();
2167 if (randomThing == null)
2168 {
2170 return false;
2171 }
2172 if (useContainer && (!t.IsContainer || t.things.Count == 0))
2173 {
2174 List<Thing> list = new List<Thing>();
2175 foreach (Point item in randomThing.trait.ListPoints(null, onlyPassable: false))
2176 {
2177 foreach (Card item2 in item.ListCards())
2178 {
2179 if (item2.IsContainer && !(item2.trait is TraitDeliveryChest))
2180 {
2181 list.Add(item2.Thing);
2182 }
2183 }
2184 }
2185 if (TryAddThingInSharedContainer(t, list, add: true, msg: false, null, sharedOnly: false))
2186 {
2187 return true;
2188 }
2189 }
2190 AddCard(t, randomThing.trait.GetRandomPoint());
2191 return true;
2192 }
virtual Thing Thing
Definition: Card.cs:2110
bool IsContainer
Definition: Card.cs:2141
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:846
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true, bool allowChara=true)
Definition: Trait.cs:864
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2241

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

◆ TryGenerateBigDaddy()

void Zone.TryGenerateBigDaddy ( )
inline

Definition at line 2770 of file Zone.cs.

2771 {
2772 if (!(BigDaddyChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f) <= EClass.rndf(1f)))
2773 {
2774 Point spawnPos = GetSpawnPos(SpawnPosition.Random, 10000);
2775 List<string> list = new List<string> { "big_daddy", "big_daddy2" };
2776 list.Shuffle();
2777 Spawn(list[0], spawnPos);
2778 if (EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
2779 {
2780 Spawn(list[1], spawnPos.GetNearestPoint(allowBlock: false, allowChara: false));
2781 }
2782 Msg.Say("sign_bigdaddy");
2783 }
2784 void Spawn(string id, Point pos)
2785 {
2786 int num = (int)((long)DangerLv * 125L / 100);
2787 if (num >= 30)
2788 {
2790 {
2791 lv = num
2792 });
2793 }
2794 Chara chara = CharaGen.Create(id);
2795 if (EClass.pc.HasElement(1270))
2796 {
2797 chara.SetHostility(Hostility.Friend);
2798 }
2799 else if (EClass.pc.HasElement(1271))
2800 {
2801 chara.SetHostility(Hostility.Enemy);
2802 }
2803 EClass._zone.AddCard(chara, pos);
2804 }
2805 }
static float rndf(float a)
Definition: EClass.cs:102
virtual float BigDaddyChance
Definition: Zone.cs:325

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 2750 of file Zone.cs.

2751 {
2752 float num = EvolvedChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f);
2753 if (!force && num <= EClass.rndf(1f))
2754 {
2755 return null;
2756 }
2757 Chara chara = SpawnMob(p, SpawnSetting.Evolved());
2758 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2759 {
2760 chara.ability.AddRandom();
2761 }
2762 chara.AddThing(chara.MakeGene(DNA.Type.Default));
2763 if (EClass.rnd(2) == 0)
2764 {
2765 chara.AddThing(chara.MakeGene(DNA.Type.Superior));
2766 }
2767 return chara;
2768 }
void AddRandom()
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:8641
CharaAbility ability
Definition: Chara.cs:428
Definition: DNA.cs:8
Type
Definition: DNA.cs:10
static SpawnSetting Evolved(int fixedLv=-1)
Definition: SpawnSetting.cs:37
virtual float EvolvedChance
Definition: Zone.cs:327

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 2723 of file Zone.cs.

2724 {
2725 if (OreChance <= 0f)
2726 {
2727 return;
2728 }
2729 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)
2730 {
2731 byte b = 18;
2732 string group = "ore";
2733 if (EClass.rnd(5) == 0)
2734 {
2735 b++;
2736 group = "gem";
2737 }
2738 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(DangerLv, group);
2739 foreach (Point point in r.points)
2740 {
2741 if (point.sourceBlock.ContainsTag("ore"))
2742 {
2743 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2744 }
2745 }
2746 return false;
2747 });
2748 }
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:323

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 2807 of file Zone.cs.

2808 {
2809 float num = ShrineChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f);
2810 for (int i = 0; i < 3; i++)
2811 {
2812 Rand.SetSeed(base.uid + i);
2813 if (num <= EClass.rndf(1f))
2814 {
2815 continue;
2816 }
2817 Point randomSpace = EClass._map.GetRandomSpace(3, 3);
2818 if (randomSpace == null)
2819 {
2820 continue;
2821 }
2822 randomSpace.x++;
2823 randomSpace.z++;
2824 if (randomSpace.HasThing || randomSpace.HasChara)
2825 {
2826 continue;
2827 }
2828 randomSpace.SetObj();
2831 if (EClass.rnd(EClass.debug.test ? 2 : 15) == 0)
2832 {
2833 EClass._zone.AddCard(ThingGen.Create("pedestal_power"), randomSpace).Install();
2834 EClass._zone.AddCard(ThingGen.Create(EClass.gamedata.godStatues.RandomItemWeighted((GodStatueData a) => a.chance).idThing, -1, DangerLv), randomSpace).Install();
2835 }
2836 else
2837 {
2838 EClass._zone.AddCard(ThingGen.Create("statue_power", -1, DangerLv), randomSpace).Install().SetRandomDir();
2839 }
2840 }
2841 Rand.SetSeed();
2842 }
void SetRandomDir()
Definition: Card.cs:6695
bool test
Definition: CoreDebug.cs:185
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:1008
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:934
virtual float ShrineChance
Definition: Zone.cs:329

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 2380 of file Zone.cs.

2380 : TraitSpot
2381 {
2382 List<T> list = new List<T>();
2383 foreach (Thing thing2 in EClass._map.things)
2384 {
2385 if (thing2.IsInstalled && thing2.trait is T)
2386 {
2387 list.Add(thing2.trait as T);
2388 }
2389 }
2390 foreach (T item in list)
2391 {
2392 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2393 {
2394 foreach (Thing thing3 in item2.Things)
2395 {
2396 if (!thing3.IsInstalled || thing3.isSale)
2397 {
2398 continue;
2399 }
2400 if (thing3.things.Count == 0)
2401 {
2402 if (IsValid(thing3, insideContainer: false))
2403 {
2404 return thing3;
2405 }
2406 continue;
2407 }
2408 Thing thing = thing3.things.Find((Thing _t) => IsValid(_t, insideContainer: true));
2409 if (thing != null)
2410 {
2411 return thing;
2412 }
2413 }
2414 }
2415 }
2416 return null;
2417 bool IsValid(Thing t, bool insideContainer)
2418 {
2419 if (t.category.id != idCat || !TraitSalesTag.CanTagSale(t, insideContainer))
2420 {
2421 return false;
2422 }
2423 return true;
2424 }
2425 }
bool isSale
Definition: Card.cs:869
List< Thing > Things
Definition: Point.cs:338
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 2364 of file Zone.cs.

2365 {
2366 foreach (Thing container in EClass._map.props.installed.containers)
2367 {
2368 if (container.IsSharedContainer)
2369 {
2370 Thing thing = container.things.Find(func);
2371 if (thing != null)
2372 {
2373 return thing;
2374 }
2375 }
2376 }
2377 return null;
2378 }

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 2194 of file Zone.cs.

2194 : TraitSpot
2195 {
2196 List<T> list = new List<T>();
2197 List<Thing> list2 = new List<Thing>();
2198 foreach (Thing thing in EClass._map.things)
2199 {
2200 if (thing.IsInstalled && thing.trait is T)
2201 {
2202 list.Add(thing.trait as T);
2203 }
2204 }
2205 foreach (T item in list)
2206 {
2207 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2208 {
2209 foreach (Thing thing2 in item2.Things)
2210 {
2211 if (!thing2.IsInstalled)
2212 {
2213 continue;
2214 }
2215 if (thing2.things.Count == 0)
2216 {
2217 if (IsValid(thing2))
2218 {
2219 list2.Add(thing2);
2220 }
2221 continue;
2222 }
2223 foreach (Thing item3 in thing2.things.List((Thing _t) => IsValid(_t)))
2224 {
2225 list2.Add(item3);
2226 }
2227 }
2228 }
2229 }
2230 return list2;
2231 bool IsValid(Thing t)
2232 {
2233 if (func != null && !func(t))
2234 {
2235 return false;
2236 }
2237 return true;
2238 }
2239 }
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 2624 of file Zone.cs.

2625 {
2626 bool flag = EClass.pc.HasCondition<ConDrawBacker>();
2627 if (!EClass.debug.enable && EClass.rnd(flag ? 3 : 20) != 0)
2628 {
2629 return;
2630 }
2631 Point randomSurface = EClass._map.bounds.GetRandomSurface();
2632 if (!randomSurface.IsValid)
2633 {
2634 return;
2635 }
2636 Chara c = CharaGen.Create("follower");
2637 EClass._zone.AddCard(c, randomSurface);
2638 (EClass._zone.AddThing("gallows", randomSurface).Install().trait as TraitShackle).Restrain(c);
2639 c.c_rescueState = RescueState.WaitingForRescue;
2640 if (EClass.rnd(flag ? 1 : 2) == 0 || EClass.debug.enable)
2641 {
2643 if (row != null)
2644 {
2645 c.ApplyBacker(row.id);
2646 }
2647 }
2648 Religion faith = EClass.game.religions.dictAll.Values.Where((Religion a) => a != c.faith).RandomItem();
2649 for (int i = 0; i < 3 + EClass.rnd(4); i++)
2650 {
2651 Chara chara = CharaGen.Create("fanatic");
2652 chara.SetFaith(faith);
2653 Point point = randomSurface.GetRandomPoint(4) ?? randomSurface.GetNearestPoint();
2654 EClass._zone.AddCard(chara, point);
2655 }
2656 }
RescueState
Definition: RescueState.cs:2
static int indexFollower
Religion faith
Definition: Chara.cs:443
void SetFaith(string id)
Definition: Chara.cs:1776
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.

Referenced by Generate().

◆ UnloadMap()

void Zone.UnloadMap ( )
inline

Definition at line 1819 of file Zone.cs.

1820 {
1821 map = null;
1822 if (bp != null)
1823 {
1824 bp.map = null;
1825 }
1826 if (branch != null)
1827 {
1829 }
1830 Debug.Log("Unloaded Map:" + this);
1831 }
void OnUnloadMap()

References bp, branch, Debug, map, and FactionBranch.OnUnloadMap().

Referenced by _OnBeforeSave(), Activate(), ClearZones(), Deactivate(), and Destroy().

◆ UpdateQuests()

void Zone.UpdateQuests ( bool  force = false)
inline

Definition at line 3849 of file Zone.cs.

3850 {
3851 if (!IsPCFaction && (!(this is Zone_Town) || base.lv != 0))
3852 {
3853 return;
3854 }
3855 Debug.Log("Updating Quest:" + force);
3856 List<SourceQuest.Row> list = EClass.sources.quests.rows.Where((SourceQuest.Row a) => a.group == "random").ToList();
3857 int num = 0;
3858 foreach (Chara item in map.charas.Concat(map.deadCharas))
3859 {
3860 if (item.quest != null && !EClass.game.quests.list.Contains(item.quest))
3861 {
3862 if (item.quest.IsExpired || completedQuests.Contains(item.quest.uid) || force)
3863 {
3864 item.quest = null;
3865 }
3866 else
3867 {
3868 num++;
3869 }
3870 }
3871 }
3872 if (EClass._zone.dateQuest > EClass.world.date.GetRaw() && !force)
3873 {
3874 return;
3875 }
3876 EClass._zone.dateQuest = EClass.world.date.GetRaw() + 1440;
3877 int maxQuest = 3;
3878 Rand.UseSeed(base.uid + EClass.player.stats.days / 7 % 100, delegate
3879 {
3880 maxQuest = 4 + EClass.rnd(4);
3881 });
3882 completedQuests.Clear();
3883 List<Zone> list2 = Quest.ListDeliver();
3884 List<Tuple<string, int>> listTag = new List<Tuple<string, int>>();
3885 string[] array = EClass._zone.source.questTag;
3887 {
3888 array = new string[9] { "supply/8", "deliver/7", "food/8", "escort/4", "deliver/4", "monster/0", "war/0", "farm/0", "music/0" };
3889 }
3890 string[] array2 = array;
3891 for (int i = 0; i < array2.Length; i++)
3892 {
3893 string[] array3 = array2[i].Split('/');
3894 listTag.Add(new Tuple<string, int>(array3[0], array3[1].ToInt()));
3895 }
3896 for (int j = 0; j < map.charas.Count * 2; j++)
3897 {
3898 if (num > maxQuest)
3899 {
3900 break;
3901 }
3902 if (num > 15)
3903 {
3904 break;
3905 }
3906 Chara chara = map.charas.RandomItem();
3907 if (!chara.trait.CanGiveRandomQuest || chara.isSubsetCard || chara.homeZone != EClass._zone || chara.IsGuest() || chara.memberType == FactionMemberType.Livestock || (chara.quest != null && !force))
3908 {
3909 continue;
3910 }
3911 SourceQuest.Row row = list.RandomItemWeighted(delegate(SourceQuest.Row a)
3912 {
3913 int num2 = 1;
3914 foreach (Tuple<string, int> item2 in listTag)
3915 {
3916 if (a.tags.Contains(item2.Item1))
3917 {
3918 num2 = item2.Item2;
3919 break;
3920 }
3921 }
3922 if (!EClass._zone.IsPCFaction && a.tags.Contains("bulk"))
3923 {
3924 num2 = 0;
3925 }
3926 return a.chance * num2;
3927 });
3928 if ((!row.tags.Contains("needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame < EClass.player.fame || EClass.debug.enable))
3929 {
3930 Quest.Create(row.id, null, chara);
3931 num++;
3932 }
3933 }
3934 }
QuestManager quests
Definition: Game.cs:183
int days
Definition: Player.cs:75
Stats stats
Definition: Player.cs:1083
int fame
Definition: Player.cs:948
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:119
HashSet< int > completedQuests
Definition: Zone.cs:37

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(), OnVisit(), 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 3481 of file Zone.cs.

3482 {
3483 }

Member Data Documentation

◆ _biome

BiomeProfile Zone._biome

Definition at line 79 of file Zone.cs.

◆ bounds

◆ bp

ZoneBlueprint Zone.bp

Definition at line 67 of file Zone.cs.

Referenced by Activate(), CreateBP(), Generate(), GetProfile(), and UnloadMap().

◆ branch

◆ completedQuests

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

Definition at line 37 of file Zone.cs.

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

◆ dictCitizen

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

Definition at line 52 of file Zone.cs.

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

◆ dirtyElectricity

bool Zone.dirtyElectricity

Definition at line 71 of file Zone.cs.

Referenced by Scene.OnUpdate().

◆ elements

◆ events

◆ fieldElements

ElementContainerField Zone.fieldElements = new ElementContainerField()

Definition at line 46 of file Zone.cs.

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

◆ fileVariation

int Zone.fileVariation

Definition at line 69 of file Zone.cs.

◆ forceRegenerate

bool Zone.forceRegenerate
static

Definition at line 25 of file Zone.cs.

Referenced by Activate(), and Deactivate().

◆ forceSubset

string Zone.forceSubset
static

Definition at line 27 of file Zone.cs.

Referenced by Activate().

◆ fortuneRoll

FortuneRollData Zone.fortuneRoll
private

Definition at line 61 of file Zone.cs.

◆ ignoreSpawnAnime

bool Zone.ignoreSpawnAnime
static

Definition at line 81 of file Zone.cs.

Referenced by AddCard().

◆ instance

◆ isSimulating

bool Zone.isSimulating

Definition at line 75 of file Zone.cs.

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

◆ isStarted

◆ landFeats

List<int> Zone.landFeats

Definition at line 58 of file Zone.cs.

◆ map

◆ okaerinko

int Zone.okaerinko = 0
static

Definition at line 31 of file Zone.cs.

Referenced by Activate(), and AI_Idle.Run().

◆ sourceHat

CardRow Zone.sourceHat
static

Definition at line 29 of file Zone.cs.

Referenced by CharaRenderer.Draw(), and RefreshHat().

◆ subset

MapSubset Zone.subset

Definition at line 65 of file Zone.cs.

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

◆ Suckers

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

Definition at line 83 of file Zone.cs.

Referenced by TraitSeed.TrySprout().

◆ tempDist

int Zone.tempDist

Definition at line 77 of file Zone.cs.

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

◆ zoneId

string string Zone.zoneId
static

Definition at line 552 of file Zone.cs.

Referenced by ParseZoneFullName().

◆ zoneType

string Zone.zoneType
static

Definition at line 552 of file Zone.cs.

Referenced by ParseZoneFullName().

Property Documentation

◆ AddPrefix

virtual bool Zone.AddPrefix
get

Definition at line 287 of file Zone.cs.

Referenced by OnAfterCreate().

◆ AllowCriminal

virtual bool Zone.AllowCriminal
get

Definition at line 251 of file Zone.cs.

◆ AllowInvest

virtual bool Zone.AllowInvest
get

Definition at line 253 of file Zone.cs.

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

◆ AllowNewZone

virtual bool Zone.AllowNewZone
get

Definition at line 265 of file Zone.cs.

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

◆ AlwaysLowblock

virtual bool Zone.AlwaysLowblock
get

Definition at line 399 of file Zone.cs.

Referenced by BaseTileMap.Draw().

◆ BaseElectricity

virtual int Zone.BaseElectricity
get

Definition at line 497 of file Zone.cs.

◆ BigDaddyChance

virtual float Zone.BigDaddyChance
get

Definition at line 325 of file Zone.cs.

◆ biome

◆ BlockBorderExit

virtual bool Zone.BlockBorderExit
get

Definition at line 173 of file Zone.cs.

Referenced by Player.CanExitBorder().

◆ Boss

Chara Zone.Boss
getset

Definition at line 87 of file Zone.cs.

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

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

◆ CanBeDeliverDestination

virtual bool Zone.CanBeDeliverDestination
get

Definition at line 229 of file Zone.cs.

Referenced by Quest.ListDeliver().

◆ CanDigUnderground

virtual bool Zone.CanDigUnderground
get

Definition at line 277 of file Zone.cs.

Referenced by TaskMine.GetHitResult().

◆ CanEnterBuildMode

bool Zone.CanEnterBuildMode
get

Definition at line 449 of file Zone.cs.

450 {
451 get
452 {
454 {
455 return base.mainFaction == EClass.pc.faction;
456 }
457 return true;
458 }
459 }
bool godBuild
Definition: CoreDebug.cs:319
bool ignoreBuildRule
Definition: CoreDebug.cs:200

◆ CanEnterBuildModeAnywhere

bool Zone.CanEnterBuildModeAnywhere
get

Definition at line 461 of file Zone.cs.

462 {
463 get
464 {
466 {
467 if (base.mainFaction == EClass.pc.faction)
468 {
469 return EClass.Branch.elements.Has(4003);
470 }
471 return false;
472 }
473 return true;
474 }
475 }
ElementContainerZone elements

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

◆ CanInspect

bool Zone.CanInspect
get

Implements IInspect.

Definition at line 501 of file Zone.cs.

502 {
503 get
504 {
505 if (!IsInstance)
506 {
507 return !HiddenInRegionMap;
508 }
509 return false;
510 }
511 }
virtual bool HiddenInRegionMap
Definition: Zone.cs:417

◆ CanUnlockExit

virtual bool Zone.CanUnlockExit
get

Definition at line 281 of file Zone.cs.

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

◆ ChanceSpawnNeutral

virtual float Zone.ChanceSpawnNeutral
get

Definition at line 349 of file Zone.cs.

◆ ContentLv

override int Zone.ContentLv
get

Definition at line 99 of file Zone.cs.

100 {
101 get
102 {
103 if (branch == null)
104 {
105 return DangerLv;
106 }
107 return branch.ContentLV;
108 }
109 }

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

◆ CountDeepestLevel

virtual bool Zone.CountDeepestLevel
get

Definition at line 231 of file Zone.cs.

◆ DangerLv

◆ DefaultActionMode

virtual ActionMode Zone.DefaultActionMode
get

Definition at line 171 of file Zone.cs.

◆ DisableRooms

virtual bool Zone.DisableRooms
get

Definition at line 123 of file Zone.cs.

Referenced by Map.TryAddRoom().

◆ EvolvedChance

virtual float Zone.EvolvedChance
get

Definition at line 327 of file Zone.cs.

◆ ExpireDays

virtual int Zone.ExpireDays
get

Definition at line 175 of file Zone.cs.

Referenced by Activate().

◆ FeatureType

virtual ZoneFeatureType Zone.FeatureType
get

Definition at line 179 of file Zone.cs.

◆ FlockType

virtual FlockController.SpawnType Zone.FlockType
get

Definition at line 419 of file Zone.cs.

Referenced by Scene.Init().

◆ Generator

MapGenerator Zone.Generator
get

Definition at line 141 of file Zone.cs.

Referenced by MapGenDungen.OnGenerateTerrain().

◆ GrowPlant

virtual bool Zone.GrowPlant
get

Definition at line 351 of file Zone.cs.

◆ GrowWeed

virtual bool Zone.GrowWeed
get

Definition at line 353 of file Zone.cs.

◆ HasLaw

virtual bool Zone.HasLaw
get

◆ HiddenInRegionMap

virtual bool Zone.HiddenInRegionMap
get

Definition at line 417 of file Zone.cs.

Referenced by Chara._Move().

◆ HourSinceLastActive

int Zone.HourSinceLastActive
get

Definition at line 125 of file Zone.cs.

Referenced by Simulate().

◆ IDAmbience

virtual string Zone.IDAmbience
get

Definition at line 181 of file Zone.cs.

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

Referenced by Activate().

◆ IDBaseLandFeat

virtual string Zone.IDBaseLandFeat
get

Definition at line 151 of file Zone.cs.

◆ IdBiome

virtual string Zone.IdBiome
get

Definition at line 133 of file Zone.cs.

Referenced by Generate().

◆ idExport

virtual string Zone.idExport
get

Definition at line 153 of file Zone.cs.

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

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

◆ IDGenerator

virtual string Zone.IDGenerator
get

Definition at line 137 of file Zone.cs.

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

◆ IDHat

virtual string Zone.IDHat
get

Definition at line 149 of file Zone.cs.

Referenced by RefreshHat().

◆ IDPlayList

virtual string Zone.IDPlayList
get

Definition at line 145 of file Zone.cs.

Referenced by Generate().

◆ IDPlaylistOverwrite

virtual string Zone.IDPlaylistOverwrite
get

Definition at line 147 of file Zone.cs.

◆ IdProfile

virtual string Zone.IdProfile
get

Definition at line 143 of file Zone.cs.

Referenced by GetProfile().

◆ IDSceneTemplate

virtual string Zone.IDSceneTemplate
get

Definition at line 197 of file Zone.cs.

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

Referenced by BaseGameScreen.RefreshGrading().

◆ IDSubset

virtual string Zone.IDSubset
get

Definition at line 215 of file Zone.cs.

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

Referenced by Activate().

◆ InspectName

string Zone.InspectName
get

Implements IInspect.

Definition at line 513 of file Zone.cs.

◆ InspectPoint

Point Zone.InspectPoint
get

Implements IInspect.

Definition at line 515 of file Zone.cs.

◆ InspectPosition

Vector3 Zone.InspectPosition
get

Implements IInspect.

Definition at line 517 of file Zone.cs.

◆ IsActiveZone

◆ IsExplorable

virtual bool Zone.IsExplorable
get

Definition at line 355 of file Zone.cs.

◆ IsFestival

◆ IsInstance

◆ IsLoaded

bool Zone.IsLoaded
get

Definition at line 495 of file Zone.cs.

Referenced by Activate().

◆ IsNefia

virtual bool Zone.IsNefia
get

◆ IsPCFaction

bool Zone.IsPCFaction
get

Definition at line 477 of file Zone.cs.

Referenced by Chara._Move(), WidgetDate._Refresh(), Map._ValidateInstalled(), Activate(), LayerSleep.Advance(), WidgetStatsBar.Build(), DramaCustomSequence.Build(), CanDestroy(), Chara.CanDestroyPath(), ActRestrain.CanPerform(), QuestIntoDarkness.CanUpdateOnTalk(), QuestVernis.CanUpdateOnTalk(), TraitGeneratorWheel.CanUse(), TraitLoytelMart.CanUse(), TraitMannequin.CanUse(), TraitShackle.CanUse(), GameLang.ConvertDrama(), Faction.CountWealth(), Card.Create(), ActEffect.DamageEle(), Deactivate(), Chara.DoHostileAction(), CoreDebug.Fix_LostCore(), RankedZone.GetFactionName(), TaskBuild.GetHitResult(), TaskDig.GetHitResult(), Card.GetPrice(), GetRandomVisitPos(), Chara.GetRevived(), GetSpawnPos(), 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(), Simulate(), 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 357 of file Zone.cs.

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

Referenced by SpatialManager.ListReturnLocations().

◆ IsSkyLevel

◆ IsStartZone

bool Zone.IsStartZone
get

Definition at line 491 of file Zone.cs.

◆ IsTown

◆ IsUnderwater

◆ IsUserZone

◆ KeepAllyDistance

virtual bool Zone.KeepAllyDistance
get

Definition at line 305 of file Zone.cs.

306 {
307 get
308 {
309 if (!HasLaw)
310 {
311 return IsPCFaction;
312 }
313 return true;
314 }
315 }

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

◆ LockExit

virtual bool Zone.LockExit
get

Definition at line 279 of file Zone.cs.

Referenced by MapGenDungen.OnGenerateTerrain().

◆ MakeEnemiesNeutral

virtual bool Zone.MakeEnemiesNeutral
get

Definition at line 237 of file Zone.cs.

238 {
239 get
240 {
241 if (!IsTown)
242 {
243 return HasLaw;
244 }
245 return true;
246 }
247 }

◆ MakeTownProperties

virtual bool Zone.MakeTownProperties
get

Definition at line 249 of file Zone.cs.

Referenced by Activate().

◆ MaxLv

virtual int Zone.MaxLv
get

Definition at line 283 of file Zone.cs.

◆ MaxRespawn

int Zone.MaxRespawn
get

Definition at line 319 of file Zone.cs.

◆ MaxSoil

virtual int Zone.MaxSoil
get

Definition at line 519 of file Zone.cs.

520 {
521 get
522 {
523 if (branch == null)
524 {
525 return 99999;
526 }
527 return branch.MaxSoil;
528 }
529 }

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

◆ MaxSpawn

virtual int Zone.MaxSpawn
get

Definition at line 317 of file Zone.cs.

◆ MinLv

virtual int Zone.MinLv
get

Definition at line 285 of file Zone.cs.

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

◆ MinsSinceLastActive

int Zone.MinsSinceLastActive
get

Definition at line 127 of file Zone.cs.

Referenced by Simulate().

◆ NameSuffix

override string Zone.NameSuffix
get

Definition at line 421 of file Zone.cs.

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

◆ NameWithLevel

string Zone.NameWithLevel
get

◆ OreChance

virtual float Zone.OreChance
get

Definition at line 323 of file Zone.cs.

◆ ParentZone

◆ pathExport

virtual string Zone.pathExport
get

Definition at line 129 of file Zone.cs.

Referenced by Activate().

◆ pathTemp

string Zone.pathTemp
get

Definition at line 165 of file Zone.cs.

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

◆ PetFollow

virtual bool Zone.PetFollow
get

Definition at line 291 of file Zone.cs.

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

◆ PrespawnRate

virtual float Zone.PrespawnRate
get

Definition at line 331 of file Zone.cs.

◆ RegenerateOnEnter

virtual bool Zone.RegenerateOnEnter
get

Definition at line 269 of file Zone.cs.

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

◆ Region

◆ RegionEnterState

virtual ZoneTransition.EnterState Zone.RegionEnterState
get

Definition at line 177 of file Zone.cs.

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

◆ RespawnPerHour

virtual int Zone.RespawnPerHour
get

Definition at line 347 of file Zone.cs.

◆ RespawnRate

virtual float Zone.RespawnRate
get

Definition at line 333 of file Zone.cs.

◆ RestrictBuild

virtual bool Zone.RestrictBuild
get

Definition at line 293 of file Zone.cs.

294 {
295 get
296 {
297 if (this is Zone_Civilized)
298 {
299 return !IsPCFaction;
300 }
301 return false;
302 }
303 }

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

◆ RevealRoom

virtual bool Zone.RevealRoom
get

Definition at line 397 of file Zone.cs.

Referenced by Activate().

◆ RuinChance

virtual float Zone.RuinChance
get

Definition at line 321 of file Zone.cs.

Referenced by GenBounds.TryAddMapPiece().

◆ ScaleType

virtual ZoneScaleType Zone.ScaleType
get

Definition at line 415 of file Zone.cs.

◆ SetAlarmOnBreakLaw

virtual bool Zone.SetAlarmOnBreakLaw
get

Definition at line 235 of file Zone.cs.

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

◆ ShouldAutoRevive

virtual bool Zone.ShouldAutoRevive
get

Definition at line 383 of file Zone.cs.

384 {
385 get
386 {
387 if (!ShouldRegenerate)
388 {
389 return IsPCFaction;
390 }
391 return true;
392 }
393 }

Referenced by Revive().

◆ ShouldMakeExit

virtual bool Zone.ShouldMakeExit
get

Definition at line 369 of file Zone.cs.

370 {
371 get
372 {
373 if (base.lv > MinLv)
374 {
375 return base.lv < MaxLv;
376 }
377 return false;
378 }
379 }
virtual int MaxLv
Definition: Zone.cs:283
virtual int MinLv
Definition: Zone.cs:285

Referenced by MapGenDungen.OnGenerateTerrain().

◆ ShouldRegenerate

virtual bool Zone.ShouldRegenerate
get

Definition at line 381 of file Zone.cs.

Referenced by Activate().

◆ ShowEnemyOnMinimap

bool Zone.ShowEnemyOnMinimap
get

Definition at line 335 of file Zone.cs.

336 {
337 get
338 {
339 if (instance != null)
340 {
342 }
343 return false;
344 }
345 }
virtual bool ShowEnemyOnMinimap
Definition: ZoneInstance.cs:30

Referenced by WidgetMinimap.RefreshMarkers().

◆ ShrineChance

virtual float Zone.ShrineChance
get

Definition at line 329 of file Zone.cs.

◆ SightRadiusBonus

virtual int Zone.SightRadiusBonus
get

Definition at line 135 of file Zone.cs.

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

◆ StartLV

virtual int Zone.StartLV
get

Definition at line 413 of file Zone.cs.

Referenced by OnCreate().

◆ TextDangerLv

string Zone.TextDangerLv
get

Definition at line 435 of file Zone.cs.

Referenced by WidgetDate._Refresh().

◆ TextDeepestLv

string Zone.TextDeepestLv
get

Definition at line 437 of file Zone.cs.

438 {
439 get
440 {
441 if (GetDeepestLv() != 0)
442 {
443 return "zoneLevelMax".lang(TextLevel(GetDeepestLv()));
444 }
445 return "";
446 }
447 }
string TextLevel(int _lv)
Definition: Zone.cs:602

Referenced by AM_Adv._OnUpdateInput().

◆ TextWidgetDate

virtual string Zone.TextWidgetDate
get

Definition at line 139 of file Zone.cs.

Referenced by WidgetDate._Refresh().

◆ UseFog

virtual bool Zone.UseFog
get

Definition at line 395 of file Zone.cs.

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

◆ UseLight

virtual bool Zone.UseLight
get

Definition at line 401 of file Zone.cs.

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

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

◆ WillAutoSave

virtual bool Zone.WillAutoSave
get

Definition at line 267 of file Zone.cs.

Referenced by Chara.MoveZone().

◆ ZoneFullName

string Zone.ZoneFullName
get

Definition at line 85 of file Zone.cs.

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


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