Elin Decompiled Documentation EA 23.200 Stable
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

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 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)
 
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 (Point pos=null, SpawnSetting setting=null)
 
void RefreshElectricity ()
 
int GetElectricity (bool cost=false)
 
void SetBGM (List< int > ids, bool refresh=true)
 
void SetBGM (int id=-1, bool refresh=true)
 
void RefreshPlaylist ()
 
void RefreshBGM ()
 
Playlist CreatePlaylist (ref List< int > list, Playlist mold=null)
 
Chara FindChara (string id)
 
Chara FindChara (int uid)
 
int GetDeepestLv ()
 
int GetDeepestLv (ref int max)
 
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 ()
 
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 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 (int a, int start, int step, int rate=75)
 
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()
 
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 Public Attributes inherited from EClass
static Core core
 

Properties

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

1819 {
1820 if (CanDestroy())
1821 {
1822 Debug.Log("Deleting Zone:" + this);
1823 if (!destryoed)
1824 {
1825 Destroy();
1826 }
1827 }
1828 else if (map != null)
1829 {
1830 Debug.Log("Saving Zone:" + this);
1831 map.Save(base.pathSave);
1832 if (!base.isMapSaved)
1833 {
1834 base.isMapSaved = true;
1835 IO.DeleteDirectory(base.pathSave + "Texture Replace");
1836 IO.CopyDir(pathTemp + "Texture Replace", base.pathSave + "/Texture Replace");
1837 }
1838 if (!IsActiveZone)
1839 {
1840 UnloadMap();
1841 }
1842 }
1843 }
Definition: IO.cs:11
static void DeleteDirectory(string path)
Definition: IO.cs:353
static void CopyDir(string sourceDirectory, string targetDirectory, Func< string, bool > funcExclude=null)
Definition: IO.cs:245
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:1768
override void Destroy()
Definition: Zone.cs:1854
bool IsActiveZone
Definition: Zone.cs:490
void UnloadMap()
Definition: Zone.cs:1684
string pathTemp
Definition: Zone.cs:158
Map map
Definition: Zone.cs:60

References Debug, and Map.Save().

◆ AbandonZone()

void Zone.AbandonZone ( )
inline

Definition at line 1752 of file Zone.cs.

1753 {
1754 FactionBranch destBranch = ((EClass.pc.homeBranch == branch) ? EClass.game.StartZone.branch : EClass.pc.homeBranch);
1755 branch.members.ForeachReverse(delegate(Chara m)
1756 {
1757 destBranch.AddMemeber(m);
1758 if (!m.IsPCParty)
1759 {
1760 m.MoveZone(destBranch.owner);
1761 }
1762 });
1764 SetMainFaction(null);
1765 base.dateExpire = EClass.world.date.GetRaw() + 10080;
1766 }
Definition: Chara.cs:10
override bool IsPCParty
Definition: Chara.cs:613
FactionBranch homeBranch
Definition: Chara.cs:1052
void MoveZone(string alias)
Definition: Chara.cs:3265
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static World world
Definition: EClass.cs:40
static FactionBranch Branch
Definition: EClass.cs:22
static Chara pc
Definition: EClass.cs:14
void OnUnclaimZone()
List< Chara > members
void AddMemeber(Chara c)
Zone StartZone
Definition: Game.cs:274
virtual void SetMainFaction(Faction f)
Definition: Spatial.cs:634
GameDate date
Definition: World.cs:6
FactionBranch branch
Definition: Zone.cs:34

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

◆ Activate()

void Zone.Activate ( )
inline

Definition at line 586 of file Zone.cs.

587 {
588 if (IsRegion)
589 {
591 }
592 isStarted = (isSimulating = false);
593 base.isKnown = true;
594 EClass.game.config.reverseSnow = false;
596 {
597 Msg.Say("regenerateZone", Name);
598 ClearZones();
599 if (EClass.pc.global.transition != null)
600 {
601 EClass.pc.global.transition.uidLastZone = 0;
602 }
603 }
605 if (EClass.game.activeZone != null)
606 {
608 }
609 EClass.game.activeZone = this;
610 ZoneExportData zoneExportData = null;
611 Debug.Log(NameWithLevel + "/" + id + "/" + base.uid + "/" + base.isGenerated + "/" + IsLoaded + "/" + File.Exists(base.pathSave + "map"));
612 if (base.isGenerated && !IsLoaded && !File.Exists(base.pathSave + "map"))
613 {
614 Debug.Log("(Bug) File does not exist:" + destryoed + "/" + base.pathSave);
615 base.isGenerated = false;
616 }
617 bool flag = false;
618 Debug.Log(idCurrentSubset + "/" + IDSubset);
619 bool flag2 = idCurrentSubset != IDSubset || forceSubset != null;
620 if (flag2 && map != null)
621 {
622 UnloadMap();
623 }
624 Debug.Log(idExport + "/" + File.Exists(pathExport) + "/" + pathExport);
625 if (!base.isGenerated && (idExport.IsEmpty() || !File.Exists(pathExport)))
626 {
627 Debug.Log("generating random map");
628 flag = true;
629 base.dateExpire = EClass.world.date.GetRaw() + 1440 * ExpireDays;
630 Generate();
632 if (instance != null)
633 {
635 }
636 if (!UseFog)
637 {
638 map.ForeachCell(delegate(Cell c)
639 {
640 c.isSeen = true;
641 });
642 }
643 if (!(bp is GameBlueprint))
644 {
646 }
647 }
648 else if (IsLoaded)
649 {
650 Debug.Log("zone is already loaded");
651 map.SetZone(this);
652 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
654 }
655 else
656 {
657 subset = null;
658 bool flag3 = (base.isGenerated && flag2) || (base.isGenerated && !IsInstance && !IsPCFaction && ShouldRegenerate && EClass.world.date.IsExpired(base.dateRegenerate)) || forceRegenerate;
659 if (pathExport.IsEmpty() || !File.Exists(pathExport) || EClass.game.isLoading || EClass.player.simulatingZone)
660 {
661 flag3 = false;
662 flag2 = false;
663 }
664 Debug.Log(base.isGenerated + "/" + flag3 + "/" + flag2 + "/" + IDSubset);
665 if (!base.isGenerated || flag3 || flag2)
666 {
667 Debug.Log("importing map:" + pathExport);
668 flag = true;
669 base.dateRegenerate = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRegenerateZone;
670 if (!flag3)
671 {
672 IO.DeleteDirectory(pathTemp + "Texture Replace");
673 Debug.Log(pathTemp);
674 }
675 try
676 {
677 zoneExportData = Import(pathExport);
678 base.isGenerated = true;
679 isImported = true;
680 if (flag3)
681 {
682 zoneExportData.orgMap = GameIO.LoadFile<Map>(base.pathSave + "map");
683 }
684 }
685 catch (Exception message)
686 {
687 Debug.Log(message);
688 zoneExportData = Import(CorePath.ZoneSave + "fail.z");
689 base.isGenerated = true;
690 isImported = true;
691 }
692 }
694 Debug.Log("loading map: imported? " + isImported + " regenerate? " + flag3);
695 map = GameIO.LoadFile<Map>((isImported ? pathTemp : base.pathSave) + "map");
696 if (map == null)
697 {
698 EClass.ui.Say("System.IO.EndOfStreamException: Unexpected end of stream:" + Environment.NewLine + "File may be corrupted. Try replacing the following file if you have a backup:" + Environment.NewLine + (isImported ? pathTemp : base.pathSave) + "map");
699 return;
700 }
701 map.SetZone(this);
702 map.Load(isImported ? pathTemp : base.pathSave, isImported);
704 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
705 if (isImported)
706 {
707 map.deadCharas.Clear();
708 map.OnImport(zoneExportData);
709 if (UseFog && !flag3)
710 {
711 map.ForeachCell(delegate(Cell c)
712 {
713 c.isSeen = false;
714 });
715 }
716 if (zoneExportData.orgMap != null)
717 {
718 Map orgMap = zoneExportData.orgMap;
719 List<Chara> serializedCharas = map.serializedCharas;
720 map.charas = orgMap.charas;
721 map.serializedCharas = orgMap.serializedCharas;
722 map.deadCharas = orgMap.deadCharas;
723 byte[] array = orgMap.TryLoadFile(base.pathSave, "flags", EClass._map.Size * EClass._map.Size);
724 if (array != null && array.Length == EClass._map.Size * EClass._map.Size)
725 {
726 for (int i = 0; i < EClass._map.Size; i++)
727 {
728 for (int j = 0; j < EClass._map.Size; j++)
729 {
730 map.cells[i, j].isSeen = array[i * EClass._map.Size + j].GetBit(1);
731 }
732 }
733 }
734 foreach (Chara item in serializedCharas)
735 {
736 Debug.Log("Importing New Chara:" + item.id + "/" + item.Name + "/" + item.orgPos);
738 }
739 map.things.ForeachReverse(delegate(Thing t)
740 {
741 if (t.trait is TraitNewZone || t.trait is TraitPowerStatue)
742 {
743 foreach (Thing thing in orgMap.things)
744 {
745 if (t.id == thing.id && t.pos.Equals(thing.pos))
746 {
747 if (t.trait is TraitNewZone)
748 {
749 RemoveCard(t);
750 map.things.Insert(0, thing);
751 thing.stackOrder = 0;
752 }
753 else
754 {
755 t.ChangeMaterial(thing.material);
756 t.isOn = thing.isOn;
757 }
758 break;
759 }
760 }
761 return;
762 }
763 if (t.trait is TraitStairsLocked)
764 {
765 foreach (Thing thing2 in orgMap.things)
766 {
767 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
768 {
769 RemoveCard(t);
770 map.things.Add(thing2);
771 break;
772 }
773 }
774 return;
775 }
776 if (t.id == "medal" || t.id == "856")
777 {
778 foreach (Thing thing3 in orgMap.things)
779 {
780 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
781 {
782 return;
783 }
784 }
785 RemoveCard(t);
786 }
787 });
788 foreach (KeyValuePair<int, int> item2 in EClass._map.backerObjs.ToList())
789 {
790 EClass._map.GetCell(item2.Key);
791 SourceBacker.Row row = EClass.sources.backers.map[item2.Value];
793 {
794 map.backerObjs.Remove(item2.Key);
795 }
796 }
797 foreach (Chara serializedChara in map.serializedCharas)
798 {
799 if (serializedChara.orgPos != null && serializedChara.orgPos.IsValid)
800 {
801 serializedChara.pos.Set(serializedChara.orgPos);
802 }
803 }
804 foreach (Thing thing4 in orgMap.things)
805 {
806 if (thing4.trait is TraitTent && !thing4.isNPCProperty)
807 {
808 thing4.AddEditorTag(EditorTag.NoNpcProperty);
809 thing4.isSubsetCard = false;
810 map.things.Add(thing4);
811 Debug.Log(thing4);
812 }
813 }
814 }
815 }
816 foreach (Thing thing5 in map.things)
817 {
818 map.AddCardOnActivate(thing5);
819 }
820 foreach (Chara c3 in map.serializedCharas)
821 {
822 if (c3.c_uidMaster == 0 || EClass.player.listSummon.Find((Chara c2) => c2.uid == c3.uid) == null)
823 {
824 map.charas.Add(c3);
826 }
827 }
828 map.serializedCharas.Clear();
829 if (isImported && IsTown)
830 {
832 }
835 map.OnLoad();
836 if (flag3)
837 {
838 foreach (Card item3 in map.Cards.ToList())
839 {
840 if (item3.isSubsetCard)
841 {
842 item3.Destroy();
843 }
844 }
845 }
846 if (isImported)
847 {
849 if (idCurrentSubset != null)
850 {
852 subset.Apply();
853 }
854 }
855 if (isImported)
856 {
858 {
859 foreach (Thing thing6 in map.things)
860 {
861 thing6.isNPCProperty = !thing6.isHidden && !thing6.HasEditorTag(EditorTag.NoNpcProperty);
862 }
863 }
864 else
865 {
866 foreach (Thing thing7 in map.things)
867 {
868 thing7.isNPCProperty = false;
869 }
870 }
872 if (instance != null)
873 {
875 }
876 }
877 if (isImported && !flag3 && !RevealRoom)
878 {
879 foreach (Room item4 in map.rooms.listRoom)
880 {
881 if (!item4.HasRoof || item4.data.atrium)
882 {
883 continue;
884 }
885 foreach (Point point2 in item4.points)
886 {
887 point2.cell.isSeen = false;
888 }
889 }
890 }
891 if (flag3)
892 {
893 OnRegenerate();
894 }
895 }
896 PathManager.Instance._pathfinder.PunishChangeDirection = false;
897 isImported = false;
898 if (this is Zone_Tent && IsUnderwater)
899 {
900 EClass._map.config.idSceneProfile = "indoor_water";
901 EClass.scene.profile = SceneProfile.Load(EClass._map.config.idSceneProfile);
902 }
903 if (flag && IsTown && base.lv == 0)
904 {
906 }
907 if (base.visitCount == 0)
908 {
909 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
910 }
911 map.ForeachCell(delegate(Cell c)
912 {
913 if (c.HasFire)
914 {
915 map.effectManager.GetOrCreate(c.GetSharedPoint());
916 }
917 if (IsRegion)
918 {
919 c.decal = 0;
920 }
921 });
923 {
924 RainWater();
925 }
927 {
928 map.ForeachCell(delegate(Cell c)
929 {
930 c.isSeen = true;
931 });
932 }
933 isStarted = true;
934 Map.isDirtySunMap = true;
936 if (events.listPreEnter.Count > 0)
937 {
938 foreach (ZonePreEnterEvent item5 in events.listPreEnter)
939 {
940 item5.Execute();
941 }
942 events.listPreEnter.Clear();
943 }
944 foreach (Card card in map.Cards)
945 {
946 card.CalculateFOV();
947 if (card.isChara)
948 {
949 Chara chara = card.Chara;
950 chara.dirtySpeed = true;
951 if (!card.isDyed && card.HasTag(CTAG.random_color))
952 {
953 card.DyeRandom();
954 }
955 if (card.IsUnique && !card.IsPCFaction && !card.IsPCParty)
956 {
957 Point point = chara.orgPos ?? card.pos;
958 card.c_uniqueData = new UniqueData
959 {
960 x = point.x,
961 y = point.z,
962 uidZone = base.uid
963 };
964 }
965 int @int = card.GetInt(55);
966 if (@int != 0)
967 {
968 foreach (Chara chara2 in map.charas)
969 {
970 if (chara2.uid == @int)
971 {
972 if (chara.IsHostile(chara2))
973 {
974 chara.enemy = chara2;
975 chara.SetAI(new GoalCombat());
976 chara.calmCheckTurn = 20 + EClass.rnd(30);
977 }
978 break;
979 }
980 }
981 card.SetInt(55);
982 }
983 chara.SyncRide();
984 if (card.c_uidMaster != 0 && chara.master == null)
985 {
986 chara.FindMaster();
987 }
988 if (!EClass.game.isLoading)
989 {
990 chara.enemy = null;
991 if (chara.IsInCombat)
992 {
993 chara.SetNoGoal();
994 }
995 }
996 }
997 else if (card.IsInstalled && card.trait is TraitDoor traitDoor && card.pos.HasChara && !traitDoor.IsOpen())
998 {
999 traitDoor.ToggleDoor(sound: false, refresh: false);
1000 }
1001 }
1002 RefreshHat();
1003 forceRegenerate = false;
1004 forceSubset = null;
1005 EClass.ui.OnActivateZone();
1007 EClass.Sound.LoadAmbience(IDAmbience);
1008 if (EClass.Branch != null)
1009 {
1011 }
1012 OnVisit();
1013 if (flag)
1014 {
1016 }
1018 if (IsPCFaction)
1019 {
1020 EClass.player.uidLastTown = 0;
1021 }
1022 else if (IsTown && base.lv == 0)
1023 {
1024 EClass.player.uidLastTown = base.uid;
1025 }
1026 RefreshBGM();
1027 Rand.InitBytes(map.seed + 1);
1029 okaerinko = 0;
1030 if (EClass.debug.enable)
1031 {
1032 ModInfluence(2000);
1033 }
1034 if (this is Zone_TinkerCamp)
1035 {
1036 Tutorial.Reserve("tinker");
1037 }
1038 else if (this is Zone_Town && !(this is Zone_SubTown))
1039 {
1040 Tutorial.Reserve("town");
1041 }
1042 }
CTAG
Definition: CTAG.cs:2
EditorTag
Definition: EditorTag.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
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:33
bool isNPCProperty
Definition: Card.cs:540
bool isSubsetCard
Definition: Card.cs:732
int c_uidMaster
Definition: Card.cs:1423
void AddEditorTag(EditorTag tag)
Definition: Card.cs:2567
Point pos
Definition: Card.cs:57
int uid
Definition: Card.cs:120
Trait trait
Definition: Card.cs:51
void Destroy()
Definition: Card.cs:4931
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2562
Definition: Cell.cs:7
bool isSeen
Definition: Cell.cs:282
bool HasFire
Definition: Cell.cs:676
AIAct SetNoGoal()
Definition: Chara.cs:8522
bool IsInCombat
Definition: Chara.cs:862
AIAct SetAI(AIAct g)
Definition: Chara.cs:8527
Point orgPos
Definition: Chara.cs:21
GlobalData global
Definition: Chara.cs:76
Chara master
Definition: Chara.cs:88
Chara FindMaster()
Definition: Chara.cs:2332
void SyncRide()
Definition: Chara.cs:3826
bool IsHostile()
Definition: Chara.cs:6298
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:557
bool revealMap
Definition: CoreDebug.cs:154
bool enable
Definition: CoreDebug.cs:286
static string ZoneSave
Definition: CorePath.cs:196
TextureManager textures
Definition: Core.cs:45
CoreConfig config
Definition: Core.cs:70
bool IsExpired(int time)
Definition: Date.cs:332
static Scene scene
Definition: EClass.cs:30
static Core core
Definition: EClass.cs:6
static Map _map
Definition: EClass.cs:18
static int rnd(long a)
Definition: EClass.cs:58
static SourceManager sources
Definition: EClass.cs:42
static Player player
Definition: EClass.cs:12
static CoreDebug debug
Definition: EClass.cs:48
static SoundManager Sound
Definition: EClass.cs:46
static UI ui
Definition: EClass.cs:16
static GameSetting setting
Definition: EClass.cs:34
void Initialize(EloMap _elomap)
Definition: EloMapActor.cs:28
void OnActivateZone()
Definition: GameIO.cs:10
BalanceSetting balance
Definition: GameSetting.cs:309
bool isLoading
Definition: Game.cs:238
int countLoadedMaps
Definition: Game.cs:232
Zone activeZone
Definition: Game.cs:248
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:2346
Cell GetCell(int index)
Definition: Map.cs:887
IEnumerable< Card > Cards
Definition: Map.cs:135
void AddCardOnActivate(Card c)
Definition: Map.cs:783
void SetZone(Zone _zone)
Definition: Map.cs:181
List< Thing > things
Definition: Map.cs:49
byte[] TryLoadFile(string path, string s, int size)
Definition: Map.cs:535
Dictionary< int, int > backerObjs
Definition: Map.cs:67
List< 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:708
void OnImport(ZoneExportData data)
Definition: Map.cs:714
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:546
List< Chara > charas
Definition: Map.cs:81
void RefreshAllTiles()
Definition: Map.cs:2108
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
HashSet< int > doneBackers
Definition: Player.cs:1029
List< Chara > listSummon
Definition: Player.cs:1177
bool simulatingZone
Definition: Player.cs:1135
Definition: Point.cs:9
Point Set(int _x, int _z)
Definition: Point.cs:491
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool IsValid
Definition: Point.cs:88
Definition: Rand.cs:4
static void InitBytes(int a)
Definition: Rand.cs:11
Definition: Region.cs:7
EloMap elomap
Definition: Region.cs:8
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:986
EloMapActor elomapActor
Definition: Scene.cs:101
SourceBacker backers
string idCurrentSubset
Definition: Spatial.cs:28
virtual bool IsRegion
Definition: Spatial.cs:503
virtual string Name
Definition: Spatial.cs:497
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()
bool isSimulating
Definition: Zone.cs:72
void RefreshElectricity()
Definition: Zone.cs:2797
ZoneExportData Import(string path)
Definition: Zone.cs:3050
void Generate()
Definition: Zone.cs:2324
ZoneEventManager events
Definition: Zone.cs:40
static string forceSubset
Definition: Zone.cs:27
virtual bool RegenerateOnEnter
Definition: Zone.cs:260
static int okaerinko
Definition: Zone.cs:31
virtual string idExport
Definition: Zone.cs:147
virtual bool MakeTownProperties
Definition: Zone.cs:240
virtual void OnRegenerate()
Definition: Zone.cs:1129
bool isStarted
Definition: Zone.cs:70
virtual string pathExport
Definition: Zone.cs:124
MapSubset subset
Definition: Zone.cs:62
Zone GetTopZone()
Definition: Zone.cs:1904
virtual string IDSubset
Definition: Zone.cs:209
ZoneBlueprint bp
Definition: Zone.cs:64
void RefreshBGM()
Definition: Zone.cs:2903
void Deactivate()
Definition: Zone.cs:1605
void SpawnLostItems()
Definition: Zone.cs:3604
void AddGlobalCharasOnActivate()
Definition: Zone.cs:1524
bool IsInstance
Definition: Zone.cs:484
void ClearZones(Zone current=null)
Definition: Zone.cs:1873
void OnVisit()
Definition: Zone.cs:1054
virtual bool IsTown
Definition: Zone.cs:220
void RainWater()
Definition: Zone.cs:3276
virtual bool UseFog
Definition: Zone.cs:386
virtual string IDAmbience
Definition: Zone.cs:175
void RemoveCard(Card t)
Definition: Zone.cs:1983
void RefreshHat()
Definition: Zone.cs:1044
void ModInfluence(int a)
Definition: Zone.cs:3462
virtual void OnGenerateMap()
Definition: Zone.cs:2518
static bool forceRegenerate
Definition: Zone.cs:25
bool IsPCFaction
Definition: Zone.cs:468
virtual bool IsUnderwater
Definition: Zone.cs:264
virtual bool ShouldRegenerate
Definition: Zone.cs:372
string NameWithLevel
Definition: Zone.cs:424
ZoneInstance instance
Definition: Zone.cs:52
virtual bool RevealRoom
Definition: Zone.cs:388
bool IsLoaded
Definition: Zone.cs:486
void RefreshListCitizen()
Definition: Zone.cs:3446
virtual int ExpireDays
Definition: Zone.cs:168
virtual void OnVisitNewMapOrRegenerate()
Definition: Zone.cs:1149

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

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

◆ AddCard() [1/3]

Card Zone.AddCard ( Card  t)
inline

Definition at line 1948 of file Zone.cs.

1949 {
1950 return AddCard(t, 0, 0);
1951 }
Card AddCard(Card t, Point point)
Definition: Zone.cs:1943

◆ AddCard() [2/3]

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

Definition at line 1953 of file Zone.cs.

1954 {
1955 if (t.parent != null)
1956 {
1957 t.parent.RemoveCard(t);
1958 }
1959 t.parent = this;
1960 Chara chara = t.Chara;
1961 if (chara != null)
1962 {
1963 chara.currentZone = this;
1964 chara.SetAI(new NoGoal());
1965 }
1966 if (IsActiveZone)
1967 {
1968 map.OnCardAddedToZone(t, x, z);
1969 if (isStarted && t.isThing && t.placeState == PlaceState.roaming && !ignoreSpawnAnime)
1970 {
1971 t.PlayAnimeLoot();
1972 }
1973 ignoreSpawnAnime = false;
1974 }
1975 if (chara != null && EClass.player != null && !chara.hasSpawned)
1976 {
1977 EClass.player.codex.AddSpawn(chara.id);
1978 chara.hasSpawned = true;
1979 }
1980 return t;
1981 }
PlaceState
Definition: PlaceState.cs:2
virtual bool isThing
Definition: Card.cs:2043
virtual Chara Chara
Definition: Card.cs:2032
ICardParent parent
Definition: Card.cs:53
bool hasSpawned
Definition: Card.cs:888
PlaceState placeState
Definition: Card.cs:81
void PlayAnimeLoot()
Definition: Card.cs:5968
void AddSpawn(string id)
Definition: CodexManager.cs:65
void OnCardAddedToZone(Card t, int x, int z)
Definition: Map.cs:806
Definition: NoGoal.cs:4
CodexManager codex
Definition: Player.cs:1071
static bool ignoreSpawnAnime
Definition: Zone.cs:78
void RemoveCard(Card c)

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

◆ AddCard() [3/3]

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

Definition at line 1943 of file Zone.cs.

1944 {
1945 return AddCard(t, point.x, point.z);
1946 }

References Point.x, and Point.z.

Referenced by InvOwnerChaosOffering._OnProcess(), TraitShrine._OnUse(), Game.AddAdventurers(), ZoneUtil.AddMerchant(), 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(), Region.OnAdvanceHour(), Zone_WindRest.OnAfterSimulate(), Zone_Nymelle.OnBeforeSimulate(), QuestIntroInspector.OnComplete(), QuestVernis.OnComplete(), TaskHarvest.OnCreateProgress(), TaskBuild.OnDestroy(), QuestDialog.OnDropReward(), 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(), QuestEscort.OnStart(), TraitFarmChest.OnUse(), TraitGiftNewYear.OnUse(), TraitStairsLocked.OnUse(), ZoneEventDefenseGame.OnVisit(), TraitContainer.Open(), 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(), Religion.Reforge(), Map.ReloadRoom(), SerializedCards.Restore(), Revive(), Chara.Revive(), AI_Craft_Snowman.Run(), AI_Slaughter.Run(), AI_UseCrafter.Run(), Meeting.SetChara(), Chara.SetGlobal(), ZoneEventMusic.Spawn(), CoreDebug.Spawn(), SpawnAltar(), Card.SpawnLoot(), SpawnLostItems(), SurvivalManager.StartRaid(), ActThrow.Throw(), TryAddThing(), BiomeProfile.ClusterThing.TryCreate(), Chara.TryDropBossLoot(), 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 1913 of file Zone.cs.

1914 {
1915 Point point = new Point(center);
1916 for (int i = 0; i < 1000; i++)
1917 {
1918 point.x = center.x + EClass.rnd(radius) - EClass.rnd(radius);
1919 point.z = center.z + EClass.rnd(radius) - EClass.rnd(radius);
1920 if (point.IsValid && !point.IsBlocked && !point.HasChara)
1921 {
1922 return AddCard(t, point);
1923 }
1924 }
1925 return AddCard(t, center);
1926 }
bool IsBlocked
Definition: Point.cs:351
bool HasChara
Definition: Point.cs:226

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

Referenced by ZoneUtil.AddBandits().

◆ AddChara()

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

Definition at line 1928 of file Zone.cs.

1929 {
1930 return AddCard(CharaGen.Create(id), x, z) as Chara;
1931 }
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17

References CharaGen.Create().

Referenced by DramaOutcome.event_swordkeeper(), Zone_Specwing.OnActivate(), Zone_Nymelle.OnBeforeSimulate(), DramaOutcome.QuestDefense_0(), and DramaOutcome.QuestDefense_1().

◆ AddGlobalCharasOnActivate()

void Zone.AddGlobalCharasOnActivate ( )
inline

Definition at line 1524 of file Zone.cs.

1525 {
1526 Point spawnPosPC = null;
1527 if (EClass.pc.currentZone == this)
1528 {
1529 spawnPosPC = GetSpawnPos(EClass.pc);
1530 }
1531 if (spawnPosPC == null)
1532 {
1533 spawnPosPC = map.GetCenterPos();
1534 }
1535 if (spawnPosPC.IsValid && EClass.pc.global.transition != null && spawnPosPC.HasBlock)
1536 {
1537 spawnPosPC = spawnPosPC.GetNearestPoint();
1538 }
1539 spawnPosPC = spawnPosPC.Clamp(useBounds: true).GetNearestPoint();
1540 foreach (Chara c in EClass.game.cards.globalCharas.Values)
1541 {
1542 if (c.currentZone != this)
1543 {
1544 continue;
1545 }
1546 if (c.parent is Chara)
1547 {
1548 Chara chara = c.parent as Chara;
1549 c.currentZone = chara.currentZone;
1550 }
1551 else
1552 {
1553 if (c.isDead)
1554 {
1555 continue;
1556 }
1557 if (c.isRestrained && c.currentZone == EClass.pc.currentZone && (!c.pos.IsValid || c.pos.FindThing<TraitShackle>() == null))
1558 {
1559 c.isRestrained = false;
1560 }
1561 if (c.global.transition != null)
1562 {
1563 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true) : GetSpawnPos(c)));
1564 if (c.IsPCParty && !c.IsPC)
1565 {
1566 if (c.host == EClass.pc)
1567 {
1568 pos.Set(spawnPosPC);
1569 }
1570 else if (pos.Equals(spawnPosPC) || !PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
1571 {
1572 c.pos.Set(spawnPosPC);
1573 if (!spawnPosPC.ForeachNearestPoint(delegate(Point p)
1574 {
1575 if (PathManager.Instance.IsPathClear(spawnPosPC, p, c, 10) && !p.Equals(spawnPosPC))
1576 {
1577 pos.Set(p);
1578 return true;
1579 }
1580 return false;
1581 }, allowBlock: false, EClass.pc.party.members.Count >= 12, allowInstalled: true, ignoreCenter: true, EClass._zone.IsRegion ? 2 : 6))
1582 {
1583 pos.Set(spawnPosPC);
1584 }
1585 }
1586 }
1587 c.pos.Set(pos);
1588 c.global.transition = null;
1589 }
1590 map.charas.Add(c);
1592 }
1593 }
1594 foreach (Chara item in EClass.player.listSummon)
1595 {
1596 Point nearestPoint = spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true);
1597 item.enemy = null;
1598 item.pos.Set(nearestPoint);
1599 map.charas.Add(item);
1601 }
1602 EClass.player.listSummon.Clear();
1603 }
GlobalCharaList globalCharas
Definition: CardManager.cs:46
bool isRestrained
Definition: Card.cs:552
override bool IsPC
Definition: Chara.cs:610
Chara host
Definition: Chara.cs:33
Zone currentZone
Definition: Chara.cs:253
bool isDead
Definition: Chara.cs:387
CardManager cards
Definition: Game.cs:155
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:607
bool Equals(int _x, int _z)
Definition: Point.cs:944
bool ForeachNearestPoint(Func< Point, bool > endFunc, bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int maxRange=30)
Definition: Point.cs:679
Point Clamp(bool useBounds=false)
Definition: Point.cs:992
bool HasBlock
Definition: Point.cs:141
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1124
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
Definition: Zone.cs:1321

References Map.AddCardOnActivate(), Game.cards, Map.charas, Point.Clamp(), Chara.currentZone, Point.Equals(), Point.FindThing(), EClass.game, MapBounds.GetCenterPos(), Point.GetNearestPoint(), Chara.global, CardManager.globalCharas, Point.HasBlock, Chara.host, PathManager.Instance, Chara.isDead, PathManager.IsPathClear(), Chara.IsPC, Chara.IsPCParty, Card.isRestrained, Point.IsValid, item, Player.listSummon, 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 3172 of file Zone.cs.

3173 {
3174 Trait random = map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
3175 if (random == null)
3176 {
3177 return null;
3178 }
3179 Point point = random.GetPoint();
3180 Chara chara = null;
3181 if (guest)
3182 {
3183 Zone z = EClass.world.FindZone("wilds");
3184 chara = EClass.game.cards.ListGlobalChara(z).RandomItem();
3185 if (chara != null)
3186 {
3187 AddCard(chara, point);
3188 Msg.Say("guestArrive", chara);
3189 chara.visitorState = VisitorState.Arrived;
3190 }
3191 }
3192 else
3193 {
3194 chara = CharaGen.CreateFromFilter("c_wilds");
3195 AddCard(chara, point);
3196 chara.goalListType = GoalListType.Enemy;
3197 }
3198 return chara;
3199 }
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:716
TraitSet GetTraitSet(Type t)
Definition: TraitManager.cs:94
Definition: Trait.cs:7
Point GetPoint()
Definition: Trait.cs:729
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 1938 of file Zone.cs.

1939 {
1940 return AddThing(id, p.x, p.z);
1941 }
Card AddThing(string id, int x, int z)
Definition: Zone.cs:1933

References Point.x, and Point.z.

◆ ApplyBackerPet()

void Zone.ApplyBackerPet ( bool  draw)
inline

Definition at line 3649 of file Zone.cs.

3650 {
3651 bool flag = this is Zone_Yowyn && base.lv == -1;
3652 IList<SourceBacker.Row> list = EClass.sources.backers.listPet.Copy();
3653 list.Shuffle();
3655 {
3656 list.ForeachReverse(delegate(SourceBacker.Row a)
3657 {
3658 if (EClass.player.doneBackers.Contains(a.id))
3659 {
3660 list.Remove(a);
3661 }
3662 });
3663 }
3664 foreach (Chara chara in EClass._map.charas)
3665 {
3666 if (chara.IsGlobal || chara.IsMinion)
3667 {
3668 continue;
3669 }
3670 if (chara.isBackerContent)
3671 {
3672 if (chara.sourceBacker.isStatic != 0)
3673 {
3674 continue;
3675 }
3676 if (chara.id != "follower")
3677 {
3678 chara.RemoveBacker();
3679 }
3680 }
3681 if ((flag && chara.race.id != "cat") || (!EClass.debug.enable && EClass.rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0))
3682 {
3683 continue;
3684 }
3685 foreach (SourceBacker.Row item in list)
3686 {
3687 if (item.chara == chara.id)
3688 {
3689 chara.ApplyBacker(item.id);
3690 list.Remove(item);
3691 break;
3692 }
3693 }
3694 }
3695 }
SourceBacker.Row sourceBacker
Definition: Card.cs:902
void RemoveBacker()
Definition: Card.cs:6798
void ApplyBacker(int bid)
Definition: Card.cs:6762
bool isBackerContent
Definition: Card.cs:899
override bool IsGlobal
Definition: Chara.cs:608
override bool IsMinion
Definition: Chara.cs:625
SourceRace.Row race
Definition: Chara.cs:462
List< Row > listPet
Definition: SourceBacker.cs:76

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

1769 {
1771 {
1772 return false;
1773 }
1774 if (IsInstance)
1775 {
1776 return true;
1777 }
1778 bool flag = false;
1779 string text = id;
1780 if (!(text == "cave_yeek"))
1781 {
1782 if (text == "cave_mino" && !(this is Zone_DungeonMino))
1783 {
1784 flag = true;
1785 }
1786 }
1787 else if (!(this is Zone_DungeonYeek))
1788 {
1789 flag = true;
1790 }
1791 Zone topZone = GetTopZone();
1792 if (!flag)
1793 {
1794 if (base.dateExpire == 0 || !EClass.world.date.IsExpired(base.dateExpire))
1795 {
1796 return false;
1797 }
1798 if (!base.isRandomSite && !(this is Zone_Field) && (topZone == null || topZone == this || topZone.FindDeepestZone() == this))
1799 {
1800 return false;
1801 }
1802 }
1803 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()))
1804 {
1805 return false;
1806 }
1808 {
1810 if (zone != null && zone.GetTopZone() == this)
1811 {
1812 return false;
1813 }
1814 }
1815 return true;
1816 }
SpatialManager spatials
Definition: Game.cs:152
Zone nextZone
Definition: Player.cs:1181
Zone Find(string id)
string id
Definition: Spatial.cs:13
Zone FindDeepestZone()
Definition: Spatial.cs:703

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

Referenced by Region.OnActivate().

◆ ClaimZone()

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

Definition at line 1698 of file Zone.cs.

1699 {
1702 branch = new FactionBranch();
1703 branch.OnCreate(this);
1704 if (base.icon == 0)
1705 {
1706 base.icon = 332;
1707 }
1708 instance = null;
1709 base.dateExpire = 0;
1711 Register();
1712 foreach (Thing thing in map.things)
1713 {
1714 thing.isNPCProperty = false;
1715 }
1718 if (debug)
1719 {
1720 for (int i = 0; i < 7; i++)
1721 {
1722 Chara chara = CharaGen.CreateFromFilter("c_neutral");
1723 EClass._zone.AddCard(chara, EClass._map.bounds.GetRandomPoint().GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false));
1724 branch.AddMemeber(chara);
1725 }
1726 }
1727 else
1728 {
1729 Msg.Say("claimedZone");
1730 EClass.Branch.Log("claimedZone");
1731 EClass.Sound.Play("jingle_embark");
1732 EClass.pc.PlaySound("build");
1733 if (pos == null)
1734 {
1735 pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: true, allowInstalled: false);
1736 }
1737 Effect.Get("aura_heaven").Play(pos);
1738 EClass._zone.AddCard(ThingGen.Create("core_zone"), pos).SetPlaceState(PlaceState.installed);
1739 }
1740 base.idPrefix = 0;
1742 {
1743 EClass.player.spawnZone = EClass._zone;
1744 }
1746 {
1747 EClass._zone.SetBGM(new List<int> { 41, 90, 44, 43 });
1749 }
1750 }
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3645
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5939
Faction faction
Definition: Chara.cs:425
static Zone _zone
Definition: EClass.cs:20
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:85
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
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:905
MapBounds bounds
Definition: Map.cs:52
EloMap elomap
Definition: Scene.cs:149
void SetInt(int id, int value=0)
Definition: Spatial.cs:568
void Register()
Definition: Spatial.cs:618
void SetBGM(List< int > ids, bool refresh=true)
Definition: Zone.cs:2867
void RefreshPlaylist()
Definition: Zone.cs:2895

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

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

◆ ClearZones()

void Zone.ClearZones ( Zone  current = null)
inline

Definition at line 1873 of file Zone.cs.

1874 {
1875 if (map != null)
1876 {
1877 UnloadMap();
1878 }
1879 base.isGenerated = false;
1880 Zone topZone = GetTopZone();
1881 if (topZone != this)
1882 {
1883 topZone.ClearZones(this);
1884 return;
1885 }
1886 children.ForeachReverse(delegate(Spatial c)
1887 {
1888 if (c != current)
1889 {
1890 c.Destroy();
1891 }
1892 });
1893 }
virtual void Destroy()
Definition: Spatial.cs:678
List< Spatial > children
Definition: Spatial.cs:37

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

Referenced by Activate(), and ClearZones().

◆ CountMinions()

int Zone.CountMinions ( Chara  c)
inline

Definition at line 3581 of file Zone.cs.

3582 {
3583 int num = 0;
3584 foreach (Chara chara in EClass._map.charas)
3585 {
3586 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3587 {
3588 num++;
3589 }
3590 }
3591 return num;
3592 }
MinionType
Definition: MinionType.cs:2
MinionType c_minionType
Definition: Card.cs:962

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

2313 {
2314 bp = new ZoneBlueprint();
2315 bp.Create();
2316 bp.genSetting.seed = base.Seed;
2317 OnCreateBP();
2318 }
virtual void OnCreateBP()
Definition: Zone.cs:2320

References ZoneBlueprint.Create().

◆ CreatePlaylist()

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

Definition at line 2943 of file Zone.cs.

2944 {
2945 Playlist playlist = EClass.Sound.plBlank.Instantiate();
2946 if (list.Count == 0 && (bool)mold)
2947 {
2948 list = mold.ToInts();
2949 playlist.shuffle = mold.shuffle;
2950 playlist.minSwitchTime = mold.minSwitchTime;
2951 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
2952 playlist.ignoreLoop = mold.ignoreLoop;
2953 playlist.keepBGMifSamePlaylist = mold.keepBGMifSamePlaylist;
2954 playlist.name = mold.name;
2955 }
2956 foreach (int item in list)
2957 {
2958 playlist.list.Add(new Playlist.Item
2959 {
2960 data = EClass.core.refs.dictBGM[item]
2961 });
2962 }
2963 return playlist;
2964 }

References item, and EClass.Sound.

◆ Deactivate()

void Zone.Deactivate ( )
inline

Definition at line 1605 of file Zone.cs.

1606 {
1607 if (!IsUserZone && !IsPCFaction && map != null)
1608 {
1609 List<Thing> list = new List<Thing>();
1610 foreach (Thing thing in map.things)
1611 {
1612 if (thing.rarity >= Rarity.Artifact && thing.HasTag(CTAG.godArtifact))
1613 {
1614 list.Add(thing);
1615 }
1616 }
1617 if (this is Zone_Tent)
1618 {
1619 foreach (Thing item in map.props.stocked.Things.Concat(map.props.roaming.Things))
1620 {
1621 if (item.IsContainer)
1622 {
1623 foreach (Thing thing2 in item.things)
1624 {
1625 if (thing2.trait is TraitTent)
1626 {
1627 list.Add(thing2);
1628 }
1629 }
1630 }
1631 if (item.trait is TraitTent)
1632 {
1633 list.Add(item);
1634 }
1635 }
1636 }
1637 if (list.Count > 0)
1638 {
1639 Msg.Say("pick_valuable");
1640 foreach (Thing item2 in list)
1641 {
1642 Msg.Say("pick_valuable2", item2);
1643 EClass.pc.AddCard(item2);
1644 }
1645 }
1646 }
1647 base.isPeace = false;
1649 if (IsPCFaction)
1650 {
1651 foreach (Chara member in branch.members)
1652 {
1653 member.ValidateWorks();
1654 }
1655 }
1656 EClass.game.lastActiveZone = EClass.game.activeZone;
1657 base.lastActive = EClass.world.date.GetRaw();
1658 map.OnDeactivate();
1659 EClass.scene.Clear();
1660 EClass.game.activeZone = null;
1661 if (IsInstance)
1662 {
1663 UnloadMap();
1664 base.isGenerated = false;
1665 }
1666 if (forceRegenerate)
1667 {
1668 UnloadMap();
1669 }
1670 OnDeactivate();
1671 }
Rarity
Definition: Rarity.cs:2
Card AddCard(Card c)
Definition: Card.cs:3043
Rarity rarity
Definition: Card.cs:300
bool HasTag(CTAG tag)
Definition: Card.cs:2557
void ValidateWorks()
Definition: Chara.cs:8868
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:353
virtual void OnBeforeDeactivate()
Definition: Zone.cs:1137
virtual bool IsUserZone
Definition: Zone.cs:266
virtual void OnDeactivate()
Definition: Zone.cs:1141

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

Referenced by Activate().

◆ Destroy()

override void Zone.Destroy ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 1854 of file Zone.cs.

1855 {
1856 children.ForeachReverse(delegate(Spatial z)
1857 {
1858 z.Destroy();
1859 });
1860 if (map != null)
1861 {
1862 UnloadMap();
1863 }
1864 if (parent != null && parent.IsRegion && instance == null)
1865 {
1866 EClass.scene.elomap.SetZone(base.x, base.y, null, updateMesh: true);
1867 }
1868 EClass.game.spatials.Remove(this);
1869 destryoed = true;
1870 base.isGenerated = false;
1871 }
void Remove(Spatial s)
Spatial parent
Definition: Spatial.cs:10

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

◆ Evalue() [1/2]

int Zone.Evalue ( int  ele)
inline

Definition at line 522 of file Zone.cs.

523 {
524 return elements.Value(ele);
525 }
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 527 of file Zone.cs.

528 {
529 return elements.Value(EClass.sources.elements.alias[alias].id);
530 }
SourceElement elements

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

◆ Export() [1/2]

void Zone.Export ( )
inline

Definition at line 3142 of file Zone.cs.

3143 {
3145 string text = pathExport;
3146 IO.Copy(text, CorePath.ZoneSave + "Backup/");
3147 Export(text);
3148 Msg.Say("Exported Map:" + text);
3149 }
static void Copy(string fromPath, string toPath)
Definition: IO.cs:278
void ResetEditorPos()
Definition: Map.cs:357
void Export()
Definition: Zone.cs:3142

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

3060 {
3061 if (subset != null)
3062 {
3063 SE.Beep();
3064 return;
3065 }
3066 try
3067 {
3068 ZoneExportData zoneExportData = new ZoneExportData
3069 {
3070 name = name,
3071 usermap = usermap
3072 };
3074 if (!map.config.retainDecal)
3075 {
3077 }
3078 map.Save(IO.TempPath + "/", zoneExportData, partial);
3079 map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(path), partial);
3080 if (partial == null)
3081 {
3082 IO.CopyDir(base.pathSave + "Texture Replace", IO.TempPath + "/Texture Replace");
3083 }
3084 IO.SaveFile(IO.TempPath + "/export", zoneExportData, compress: true);
3085 using (ZipFile zipFile = new ZipFile())
3086 {
3087 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3088 zipFile.AddDirectory(IO.TempPath);
3089 zipFile.Save(path);
3090 zipFile.Dispose();
3091 }
3093 }
3094 catch (Exception ex)
3095 {
3096 EClass.ui.Say(ex.Message + ":" + path);
3097 }
3098 }
static void CreateTempDirectory(string path=null)
Definition: IO.cs:379
static string TempPath
Definition: IO.cs:64
static void SaveFile(string path, object obj, bool compress=false, JsonSerializerSettings setting=null)
Definition: IO.cs:89
static void DeleteTempDirectory(string path=null)
Definition: IO.cs:384
bool retainDecal
Definition: MapConfig.cs:44
void ExportMetaData(string _path, string id, PartialMap partial=null)
Definition: Map.cs:720
void ClearRainAndDecal()
Definition: Map.cs:1526
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 3100 of file Zone.cs.

3101 {
3103 {
3104 string text = StandaloneFileBrowser.SaveFilePanel("Export Zone", dir ?? CorePath.ZoneSave, "new zone", "z");
3105 if (!string.IsNullOrEmpty(text))
3106 {
3107 Export(text);
3108 Msg.SayRaw("Exported Zone");
3109 }
3110 });
3111 }
void WaitForEndOfFrame(Action action)
Definition: BaseCore.cs:61
static string SayRaw(string text)
Definition: Msg.cs:113
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 2971 of file Zone.cs.

2972 {
2973 return map.charas.Find((Chara c) => c.uid == uid);
2974 }
int uid
Definition: Spatial.cs:70

References Map.charas, and Card.uid.

◆ FindChara() [2/2]

Chara Zone.FindChara ( string  id)
inline

Definition at line 2966 of file Zone.cs.

2967 {
2968 return map.charas.Find((Chara c) => c.id == id);
2969 }

References Map.charas, and Card.id.

Referenced by DramaCustomSequence.Build().

◆ Generate()

void Zone.Generate ( )
inline

Definition at line 2324 of file Zone.cs.

2325 {
2326 base.isGenerated = true;
2327 if (bp == null)
2328 {
2329 CreateBP();
2330 }
2331 if (bp.map == null)
2332 {
2333 bp.GenerateMap(this);
2334 }
2335 map.SetZone(this);
2336 Zone_Field zone_Field = this as Zone_Field;
2337 if (IdBiome == "Sand" || IdBiome == "Water" || IsUnderwater)
2338 {
2339 int num = 1 + EClass.rnd((IdBiome == "Water") ? 3 : 2);
2340 for (int i = 0; i < num; i++)
2341 {
2342 Point randomSurface = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2343 if (!randomSurface.HasObj && !randomSurface.HasThing)
2344 {
2345 Thing t = ThingGen.Create("pearl_oyster", new string[3] { "wood_birch", "poplar", "coralwood" }.RandomItem(), ContentLv);
2346 EClass._zone.AddCard(t, randomSurface).Install();
2347 }
2348 }
2349 num = 4 + EClass.rnd(5);
2350 for (int j = 0; j < num; j++)
2351 {
2352 Point randomSurface2 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2353 if (!randomSurface2.HasObj && !randomSurface2.HasThing && (IsUnderwater || randomSurface2.cell.IsTopWaterAndNoSnow || EClass.rnd(6) == 0))
2354 {
2355 EClass._zone.AddCard(ThingGen.Create("70", -1, ContentLv), randomSurface2);
2356 }
2357 }
2358 }
2359 if (IsUnderwater)
2360 {
2361 for (int k = 0; k < 30 + EClass.rnd(30); k++)
2362 {
2363 SpawnMob(null, SpawnSetting.Fish());
2364 }
2365 Crawler crawler = Crawler.Create("pasture");
2366 int num2 = (EClass.debug.enable ? 3 : EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(5) + 1) + 1) + 1));
2367 bool flag = this is Zone_Field;
2368 Thing seed = null;
2369 if (IsNefia)
2370 {
2371 int num3 = Mathf.Min(EClass._zone.DangerLv, EClass.pc.Evalue(286) * 2 / 3);
2372 if (num3 > 0)
2373 {
2375 Rand.SetSeed(EClass._zone.uid * 10 + num3);
2376 TraitSeed.LevelSeed(seed, (seed.trait as TraitSeed).row, num3);
2377 Rand.SetSeed();
2378 seed.elements.SetBase(2, EClass.curve(seed.encLV, 50, 10, 80));
2379 }
2380 }
2381 crawler.CrawlUntil(EClass._map, () => EClass._map.GetRandomPoint(), num2 + (flag ? 4 : 0), delegate(Crawler.Result r)
2382 {
2383 int num6 = 137;
2384 foreach (Point point in r.points)
2385 {
2386 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
2387 {
2388 map.SetObj(point.x, point.z, num6);
2389 int idx = 3 + ((EClass.rnd(3) == 0) ? 1 : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0);
2390 point.growth.SetStage(idx);
2391 if (seed != null)
2392 {
2393 EClass._map.AddPlant(point, seed);
2394 }
2395 }
2396 }
2397 return false;
2398 });
2399 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(5) + 1) + 1 + (flag ? 20 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2400 {
2401 int num5 = 136;
2402 foreach (Point point2 in r.points)
2403 {
2404 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
2405 {
2406 map.SetObj(point2.x, point2.z, num5, 1, EClass.rnd(4));
2407 }
2408 }
2409 return false;
2410 });
2411 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(10) + 1) + 3 + (flag ? 40 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2412 {
2413 int idFloor = 121;
2414 foreach (Point point3 in r.points)
2415 {
2416 map.SetFloor(point3.x, point3.z, 97, idFloor, Mathf.Clamp(4 - r.startPos.Distance(point3) + EClass.rnd(3) - EClass.rnd(3), 0, 3));
2417 }
2418 return false;
2419 });
2420 }
2421 if (zone_Field != null)
2422 {
2423 if (EClass.rnd(3) == 0)
2424 {
2425 int num4 = EClass.rnd(2);
2426 for (int l = 0; l < num4; l++)
2427 {
2428 Point randomSurface3 = EClass._map.bounds.GetRandomSurface();
2429 if (!randomSurface3.HasObj && !randomSurface3.HasThing)
2430 {
2432 EClass._zone.AddCard(t2, randomSurface3).Install();
2433 }
2434 }
2435 }
2436 if (EClass.rnd(8) == 0)
2437 {
2438 SpawnAltar();
2439 }
2441 }
2442 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList) ?? EClass.Sound.GetPlaylist("Day"));
2443 }
@ seed
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2994
int Evalue(int ele)
Definition: Card.cs:2533
Card Install()
Definition: Card.cs:3639
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712
bool isModified
Definition: Cell.cs:438
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(int a, int start, int step, int rate=75)
Definition: EClass.cs:68
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:432
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:2215
List< int > _plDay
Definition: Map.cs:55
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:957
PlantData AddPlant(Point pos, Thing seed)
Definition: Map.cs:1952
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1535
bool HasThing
Definition: Point.cs:239
bool HasObj
Definition: Point.cs:137
Cell cell
Definition: Point.cs:51
GrowSystem growth
Definition: Point.cs:77
static void SetSeed(int a=-1)
Definition: Rand.cs:37
SourceObj objs
static SpawnSetting Fish()
static Thing MakeSeed(SourceObj.Row obj, PlantData plant=null)
Definition: TraitSeed.cs:88
static void LevelSeed(Thing t, SourceObj.Row obj, int num)
Definition: TraitSeed.cs:140
void GenerateMap(Zone zone)
virtual string IDPlayList
Definition: Zone.cs:138
override int ContentLv
Definition: Zone.cs:95
void SpawnAltar()
Definition: Zone.cs:2479
Playlist CreatePlaylist(ref List< int > list, Playlist mold=null)
Definition: Zone.cs:2943
virtual bool IsNefia
Definition: Zone.cs:280
BiomeProfile biome
Definition: Zone.cs:126
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
Definition: Zone.cs:2697
virtual string IdBiome
Definition: Zone.cs:128
override int DangerLv
Definition: Zone.cs:107
void TrySpawnFollower()
Definition: Zone.cs:2445
void CreateBP()
Definition: Zone.cs:2312

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

Referenced by Activate().

◆ GetDeepestLv() [1/2]

int Zone.GetDeepestLv ( )
inline

Definition at line 2976 of file Zone.cs.

2977 {
2978 int max = base.lv;
2979 return GetDeepestLv(ref max);
2980 }
int GetDeepestLv()
Definition: Zone.cs:2976

Referenced by WindowChara.RefreshProfile().

◆ GetDeepestLv() [2/2]

int Zone.GetDeepestLv ( ref int  max)
inline

Definition at line 2982 of file Zone.cs.

2983 {
2984 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
2985 {
2986 max = base.lv;
2987 }
2988 foreach (Spatial child in children)
2989 {
2990 (child as Zone).GetDeepestLv(ref max);
2991 }
2992 return max;
2993 }

◆ GetDungenID()

virtual string Zone.GetDungenID ( )
inlinevirtual

◆ GetElectricity()

int Zone.GetElectricity ( bool  cost = false)
inline

Definition at line 2828 of file Zone.cs.

2829 {
2830 bool flag = GetSoilCost() > MaxSoil;
2831 int sum = 0;
2832 foreach (Thing thing in EClass._map.things)
2833 {
2834 if (!thing.IsInstalled || thing.trait.Electricity == 0)
2835 {
2836 continue;
2837 }
2838 if (cost)
2839 {
2840 if (thing.trait.Electricity < 0)
2841 {
2842 sum += -thing.trait.Electricity;
2843 }
2844 }
2845 else if (thing.trait.Electricity > 0)
2846 {
2847 sum += thing.trait.Electricity;
2848 }
2849 }
2850 if (!cost)
2851 {
2852 sum += elements.Value(2201) * 10 + BaseElectricity;
2853 if (!flag)
2854 {
2855 EClass._map.bounds.ForeachCell(delegate(Cell c)
2856 {
2857 if (c.sourceObj.id == 118 && c.growth.IsMature)
2858 {
2859 sum += 20;
2860 }
2861 });
2862 }
2863 }
2864 return sum;
2865 }
bool IsInstalled
Definition: Card.cs:2343
GrowSystem growth
Definition: Cell.cs:225
SourceObj.Row sourceObj
Definition: Cell.cs:1072
virtual bool IsMature
Definition: GrowSystem.cs:103
void ForeachCell(Action< Cell > action)
Definition: MapBounds.cs:279
virtual int Electricity
Definition: Trait.cs:102
virtual int BaseElectricity
Definition: Zone.cs:488
virtual int MaxSoil
Definition: Zone.cs:511
int GetSoilCost()
Definition: Zone.cs:3594

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

543 {
544 return base.source.id;
545 }

Referenced by TraitNewZone.CreateZone().

◆ GetOrCreateFortuneRollData()

FortuneRollData Zone.GetOrCreateFortuneRollData ( bool  refresh = true)
inline

Definition at line 3697 of file Zone.cs.

3698 {
3699 if (fortuneRoll == null)
3700 {
3702 fortuneRoll.seed = EClass._zone.uid * 100 + EClass.game.seed;
3703 }
3704 if (refresh || fortuneRoll.count == 0)
3705 {
3707 }
3708 return fortuneRoll;
3709 }
int seed
Definition: Game.cs:197
FortuneRollData fortuneRoll
Definition: Zone.cs:58

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

2273 {
2274 string text = IdProfile;
2275 if (text.IsEmpty())
2276 {
2277 Region region = parent as Region;
2278 if (base.lv != 0)
2279 {
2280 text = ((base.lv < 0) ? "Underground" : "Sky");
2281 }
2282 else if (region != null)
2283 {
2285 text = EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2286 if (bp != null)
2287 {
2288 name = Lang.GetList("zone_" + text.Split('/')[1]).RandomItem();
2289 bp.surrounding = new EloMap.TileInfo[3, 3];
2290 for (int i = 0; i < 3; i++)
2291 {
2292 for (int j = 0; j < 3; j++)
2293 {
2294 bp.surrounding[j, i] = EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2295 }
2296 }
2297 if (text == "Random/R_Shore")
2298 {
2299 base.isBeach = true;
2300 }
2301 }
2302 }
2303 else
2304 {
2305 text = "Random";
2306 }
2307 idProfile = text;
2308 }
2309 return ZoneProfile.Load(text);
2310 }
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:6
static string[] GetList(string id)
Definition: Lang.cs:114
string idProfile
Definition: Spatial.cs:25
EloMap.TileInfo[,] surrounding
static ZoneProfile Load(string id)
Definition: ZoneProfile.cs:73
virtual string IdProfile
Definition: Zone.cs:136
Region Region
Definition: Zone.cs:160

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

Referenced by ZoneBlueprint.GenerateMap().

◆ GetRandomSpot< T >()

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

Definition at line 2004 of file Zone.cs.

2004 : Trait
2005 {
2006 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
2007 }
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 1502 of file Zone.cs.

1503 {
1504 Point point = null;
1505 if (EClass.rnd(3) == 0 && map.rooms.listRoom.Count > 0)
1506 {
1507 point = map.rooms.listRoom.RandomItem().points.RandomItem();
1508 }
1509 if (point == null && EClass.rnd(4) != 0)
1510 {
1511 IEnumerable<Chara> ie = map.charas.Where((Chara t) => t.trait.ShopType != 0 && t.pos != null && t.pos.IsValid);
1512 if (ie.Count() > 0)
1513 {
1514 point = ie.RandomItem().pos.GetRandomPoint(3);
1515 }
1516 }
1517 if (point == null)
1518 {
1519 point = map.bounds.GetRandomSurface(centered: false, walkable: true, !IsPCFaction && !(this is Zone_Civilized)) ?? map.bounds.GetRandomPoint();
1520 }
1521 return point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false) ?? EClass._map.GetCenterPos().GetNearestPoint();
1522 }
new TraitChara trait
Definition: Chara.cs:501
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:757
virtual ShopType ShopType
Definition: Trait.cs:518

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

◆ GetRoot()

ICardParent Zone.GetRoot ( )
inline

Implements ICardParent.

Definition at line 1899 of file Zone.cs.

1900 {
1901 return this;
1902 }

◆ GetSoilCost()

int Zone.GetSoilCost ( )
inline

Definition at line 3594 of file Zone.cs.

3595 {
3596 int i = 0;
3597 EClass._map.bounds.ForeachCell(delegate(Cell c)
3598 {
3599 i += c.sourceObj.costSoil;
3600 });
3601 return i / 10;
3602 }

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

3160 {
3161 if (IsPCFaction)
3162 {
3163 return -100000 + base.uid;
3164 }
3165 if (this is Zone_Civilized)
3166 {
3167 return -90000 + base.uid;
3168 }
3169 return base.uid;
3170 }

Referenced by SpatialManager.ListReturnLocations().

◆ GetSpawnPos() [1/2]

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

Definition at line 1321 of file Zone.cs.

1322 {
1323 ZoneTransition zoneTransition = c.global?.transition;
1324 Zone zone = zoneTransition?.lastZone;
1325 ZoneTransition.EnterState enterState = zoneTransition?.state ?? destState;
1326 bool flag = zone == null || zone.lv > base.lv;
1327 if (IsRegion)
1328 {
1329 if (zone != null && !EClass.player.simulatingZone)
1330 {
1331 Zone topZone = zone.GetTopZone();
1332 if (GetZoneAt(topZone.x, topZone.y) != null)
1333 {
1334 return new Point(topZone.mapX, topZone.mapY);
1335 }
1336 }
1337 }
1338 else if (c.IsPC && EClass.player.lastZonePos != null && zone != null && zone.IsRegion && (enterState == ZoneTransition.EnterState.Left || enterState == ZoneTransition.EnterState.Right || enterState == ZoneTransition.EnterState.Top || enterState == ZoneTransition.EnterState.Bottom))
1339 {
1340 return EClass.player.lastZonePos;
1341 }
1342 if (enterState == ZoneTransition.EnterState.Region)
1343 {
1344 enterState = RegionEnterState;
1345 }
1346 if (this is Zone_Kapul && enterState == ZoneTransition.EnterState.Left)
1347 {
1348 enterState = ZoneTransition.EnterState.Right;
1349 }
1350 float rate = zoneTransition?.ratePos ?? (-1f);
1351 if (IsPCFaction)
1352 {
1353 if ((uint)(enterState - 3) <= 4u || enterState == ZoneTransition.EnterState.Return)
1354 {
1356 if (spot != null)
1357 {
1358 Point nearestPoint = (spot.trait as TraitSpotGuidePC).GetRandomPoint((Point p) => !p.IsBlocked && !p.Equals(spot.pos)).GetNearestPoint();
1359 if (nearestPoint != null && nearestPoint.IsValid)
1360 {
1361 return nearestPoint;
1362 }
1363 }
1364 }
1365 }
1366 while (true)
1367 {
1368 switch (enterState)
1369 {
1370 case ZoneTransition.EnterState.UndergroundOrSky:
1371 return new Point(zoneTransition.x, zoneTransition.z);
1372 case ZoneTransition.EnterState.Teleport:
1373 {
1374 foreach (Thing thing2 in map.things)
1375 {
1376 if (thing2.IsInstalled)
1377 {
1378 TraitTeleporter traitTeleporter = thing2.trait as TraitTeleporter;
1379 if (traitTeleporter != null)
1380 {
1381 Debug.Log(zoneTransition.idTele + "/" + traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)) + "/" + traitTeleporter.GetParam(3));
1382 }
1383 if (traitTeleporter != null && !zoneTransition.idTele.IsEmpty() && zoneTransition.idTele == traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)))
1384 {
1385 return thing2.pos.GetNearestPoint();
1386 }
1387 }
1388 }
1389 foreach (Thing thing3 in map.things)
1390 {
1391 if (thing3.IsInstalled && thing3.trait is TraitTeleporter traitTeleporter2 && traitTeleporter2.IsFor(zoneTransition.lastZone))
1392 {
1393 return thing3.pos.GetNearestPoint();
1394 }
1395 }
1396 Thing randomThing2 = EClass._map.props.installed.traits.GetRandomThing<TraitTeleporter>();
1397 if (randomThing2 != null)
1398 {
1399 return randomThing2.pos.GetNearestPoint();
1400 }
1401 goto case ZoneTransition.EnterState.Return;
1402 }
1403 case ZoneTransition.EnterState.Return:
1404 case ZoneTransition.EnterState.Elevator:
1405 case ZoneTransition.EnterState.Moongate:
1406 {
1407 if (enterState == ZoneTransition.EnterState.Elevator)
1408 {
1409 foreach (Thing thing4 in map.things)
1410 {
1411 if (thing4.IsInstalled && thing4.trait is TraitElevator traitElevator && traitElevator.IsFor(zoneTransition.lastZone))
1412 {
1413 return thing4.pos.GetNearestPoint();
1414 }
1415 }
1416 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<TraitElevator>();
1417 if (randomThing != null)
1418 {
1419 return randomThing.pos.GetNearestPoint();
1420 }
1421 }
1422 Thing thing = null;
1423 thing = map.props.installed.traits.GetRandomThing<TraitWaystone>();
1424 if (thing != null)
1425 {
1426 return thing.pos.GetNearestPoint();
1427 }
1428 thing = map.props.installed.traits.GetRandomThing<TraitCoreZone>();
1429 if (thing != null)
1430 {
1431 return thing.pos.GetNearestPoint();
1432 }
1433 if (base.lv == 0)
1434 {
1435 goto IL_04a1;
1436 }
1437 flag = base.lv <= 0;
1438 break;
1439 }
1440 case ZoneTransition.EnterState.Center:
1441 case ZoneTransition.EnterState.Encounter:
1442 if (map.config.embarkX != 0)
1443 {
1444 return new Point(map.config.embarkX, map.config.embarkY);
1445 }
1446 return map.GetCenterPos().GetNearestPoint(allowBlock: false, allowChara: false);
1447 case ZoneTransition.EnterState.Top:
1448 return map.bounds.GetTopPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1449 case ZoneTransition.EnterState.Right:
1450 return map.bounds.GetRightPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1451 case ZoneTransition.EnterState.Bottom:
1452 return map.bounds.GetBottomPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1453 case ZoneTransition.EnterState.Left:
1454 return map.bounds.GetLeftPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1455 case ZoneTransition.EnterState.Dead:
1456 case ZoneTransition.EnterState.Exact:
1457 case ZoneTransition.EnterState.PortalReturn:
1458 case ZoneTransition.EnterState.Fall:
1459 if (zoneTransition.x == 0 && EClass._map.bounds.x != 0)
1460 {
1461 return new Point(map.config.embarkX, map.config.embarkY);
1462 }
1463 return new Point(zoneTransition.x, zoneTransition.z);
1464 case ZoneTransition.EnterState.RandomVisit:
1465 return GetRandomVisitPos(c);
1466 case ZoneTransition.EnterState.Down:
1467 flag = true;
1468 break;
1469 case ZoneTransition.EnterState.Up:
1470 flag = false;
1471 break;
1472 }
1473 break;
1474 IL_04a1:
1475 enterState = ZoneTransition.EnterState.Center;
1476 }
1477 foreach (Thing thing5 in map.things)
1478 {
1479 if (thing5.trait is TraitNewZone { zone: not null } traitNewZone && zone != null && traitNewZone.zone.uid == zone.uid)
1480 {
1481 if (c != null && enterState != 0)
1482 {
1483 c.SetDir(traitNewZone.owner.dir);
1484 }
1485 return traitNewZone.GetExitPos();
1486 }
1487 }
1488 foreach (Thing thing6 in map.things)
1489 {
1490 if (thing6.trait is TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1491 {
1492 if (c != null && enterState != 0)
1493 {
1494 c.SetDir(traitNewZone2.owner.dir);
1495 }
1496 return traitNewZone2.GetExitPos();
1497 }
1498 }
1499 return GetRandomVisitPos(c);
1500 }
override void SetDir(int d)
Definition: Chara.cs:3453
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:1059
Thing Find(int uid)
Definition: Props.cs:389
int mapX
Definition: Spatial.cs:448
int lv
Definition: Spatial.cs:142
int mapY
Definition: Spatial.cs:460
virtual bool IsFor(Zone z)
string GetParam(int i, string def=null)
Definition: Trait.cs:560
EnterState state
virtual ZoneTransition.EnterState RegionEnterState
Definition: Zone.cs:170
Point GetRandomVisitPos(Chara c)
Definition: Zone.cs:1502
Zone GetZoneAt(int _x, int _y)
Definition: Zone.cs:3398

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

Referenced by Chara.MoveZone().

◆ GetSpawnPos() [2/2]

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

Definition at line 2664 of file Zone.cs.

2665 {
2666 Point point = new Point();
2667 for (int i = 0; i < tries; i++)
2668 {
2669 point = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2670 if (!point.IsValid || point.cell.hasDoor || point.IsSync)
2671 {
2672 continue;
2673 }
2674 switch (type)
2675 {
2676 case SpawnPosition.Guest:
2677 {
2678 Room room = point.cell.room;
2679 if (room != null && room.data.accessType != 0)
2680 {
2681 continue;
2682 }
2683 break;
2684 }
2685 case SpawnPosition.Outside:
2686 if (point.cell.HasRoof || point.cell.light > 0)
2687 {
2688 continue;
2689 }
2690 break;
2691 }
2692 return point;
2693 }
2694 return null;
2695 }
SpawnPosition
Definition: SpawnPosition.cs:2
BaseArea.AccessType accessType
Definition: AreaData.cs:42
Room room
Definition: Cell.cs:102
byte light
Definition: Cell.cs:60
bool HasRoof
Definition: Cell.cs:648
bool hasDoor
Definition: Cell.cs:258
bool IsSync
Definition: Point.cs:332

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

◆ GetTopZone()

◆ GetZoneAt()

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

Definition at line 3398 of file Zone.cs.

3399 {
3400 if (IsRegion)
3401 {
3402 foreach (Spatial child in children)
3403 {
3404 if (!(child is Zone_Field) && _x == child.x && _y == child.y)
3405 {
3406 return child as Zone;
3407 }
3408 }
3409 }
3410 foreach (Spatial child2 in children)
3411 {
3412 if (_x == child2.x && _y == child2.y)
3413 {
3414 return child2 as Zone;
3415 }
3416 }
3417 return null;
3418 }

References Spatial.x, and Spatial.y.

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

◆ GrowPlants()

void Zone.GrowPlants ( VirtualDate  date)
inline

Definition at line 3291 of file Zone.cs.

3292 {
3293 bool num = (EClass.player.isAutoFarming = IsPCFaction && EClass.Branch.policies.IsActive(2707));
3294 int weedChance = 1;
3296 {
3297 weedChance += (EClass.debug.enable ? 100000 : 20) + EClass.Branch.Evalue(2703) * 10;
3298 }
3299 if (date.sunMap == null)
3300 {
3301 date.BuildSunMap();
3302 }
3303 if (num)
3304 {
3305 HashSet<int> hashSet = new HashSet<int>();
3306 foreach (Thing thing in EClass._map.things)
3307 {
3308 if (!thing.IsInstalled || !(thing.trait is TraitSpotFarm traitSpotFarm))
3309 {
3310 continue;
3311 }
3312 foreach (Point item in traitSpotFarm.ListPoints(null, onlyPassable: false))
3313 {
3314 hashSet.Add(item.index);
3315 }
3316 }
3317 Perform(hashSet);
3318 EClass.player.isAutoFarming = false;
3319 Perform(hashSet);
3320 }
3321 else
3322 {
3323 Perform(null);
3324 }
3325 void Perform(HashSet<int> farmMap)
3326 {
3327 bool isWinter = date.IsWinter;
3328 EClass._map.bounds.ForeachCell(delegate(Cell c)
3329 {
3330 if (farmMap != null)
3331 {
3333 {
3334 if (!farmMap.Contains(c.index))
3335 {
3336 return;
3337 }
3338 }
3339 else if (farmMap.Contains(c.index))
3340 {
3341 return;
3342 }
3343 }
3344 if (c.decal != 0 && EClass.rnd(3) == 0)
3345 {
3346 c.decal = 0;
3347 }
3348 if (GrowPlant)
3349 {
3350 if (c.growth != null)
3351 {
3352 bool flag = false;
3353 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3354 {
3355 flag = true;
3356 }
3357 PlantData plantData = map.TryGetPlant(c);
3358 if (!flag && (plantData == null || plantData.fert >= 0))
3359 {
3360 c.TryGrow(date);
3361 }
3362 if (isWinter && plantData != null && c.growth != null && c.growth.NeedSunlight && plantData.fert >= 0 && (EClass.rnd(4) == 0 || c.growth.stage.idx == 0))
3363 {
3364 if (date.sunMap == null)
3365 {
3366 date.BuildSunMap();
3367 }
3368 if (!date.sunMap.Contains(c.index) && !c.growth.CanGrow(date))
3369 {
3370 c.growth.Perish();
3371 }
3372 }
3373 }
3374 else if (c.detail != null)
3375 {
3376 c.Things.ForeachReverse(delegate(Thing t)
3377 {
3378 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3379 {
3380 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3381 }
3382 });
3383 }
3384 else if (EClass.rnd(20) == 0 && GrowWeed && c.CanGrowWeed && EClass.rnd(weedChance) == 0)
3385 {
3386 biome.Populate(c.GetPoint());
3387 if (c.growth != null)
3388 {
3389 c.growth.SetStage(0);
3390 }
3391 }
3392 }
3393 c.isWatered = false;
3394 });
3395 }
3396 }
void Populate(Point point, bool interior=false, float mtpDensity=1f)
byte decal
Definition: Cell.cs:44
CellDetail detail
Definition: Cell.cs:92
Point GetPoint()
Definition: Cell.cs:1101
bool CanGrowWeed
Definition: Cell.cs:742
int index
Definition: Cell.cs:114
bool IsWinter
Definition: Date.cs:186
int Evalue(int ele)
PolicyManager policies
Stage stage
Definition: GrowSystem.cs:101
virtual bool NeedSunlight
Definition: GrowSystem.cs:93
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:268
PlantData TryGetPlant(Point p)
Definition: Map.cs:1942
bool isAutoFarming
Definition: Player.cs:1137
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:344
virtual bool GrowPlant
Definition: Zone.cs:342

References EClass._map, Map.bounds, EClass.Branch, VirtualDate.BuildSunMap(), GrowSystem.CanGrow(), Cell.decal, Cell.detail, 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().

◆ Import()

ZoneExportData Zone.Import ( string  path)
inline

Definition at line 3050 of file Zone.cs.

3051 {
3052 ZipFile zipFile = ZipFile.Read(path);
3053 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3054 zipFile.ExtractAll(pathTemp);
3055 zipFile.Dispose();
3056 return IO.LoadFile<ZoneExportData>(pathTemp + "export") ?? new ZoneExportData();
3057 }

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

◆ ImportDialog()

void Zone.ImportDialog ( string  dir = null)
inline

Definition at line 3113 of file Zone.cs.

3114 {
3116 {
3117 string[] array = StandaloneFileBrowser.OpenFilePanel("Import Zone", dir ?? CorePath.ZoneSave, "z", multiselect: false);
3118 if (array.Length != 0)
3119 {
3120 Zone_User zone_User = SpatialGen.Create("user", EClass.world.region, register: true) as Zone_User;
3121 zone_User.path = array[0];
3122 Thing thing = ThingGen.Create("teleporter");
3123 thing.c_uidZone = zone_User.uid;
3124 EClass._zone.AddCard(thing, EClass.pc.pos);
3125 }
3126 });
3127 }
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

Definition at line 3420 of file Zone.cs.

3421 {
3422 if (act.IsHostileAct && HasLaw && !IsPCFaction && c.IsPC)
3423 {
3424 return true;
3425 }
3426 return false;
3427 }
virtual bool IsHostileAct
Definition: ACT.cs:129
virtual bool HasLaw
Definition: Zone.cs:226

References Act.IsHostileAct, and Chara.IsPC.

Referenced by TaskDig.OnCreateProgress(), TaskHarvest.OnCreateProgress(), TaskMine.OnCreateProgress(), TaskDig.OnProgressComplete(), TaskMine.OnProgressComplete(), and ActPlan.Item.Perform().

◆ IsImportValid()

static bool Zone.IsImportValid ( string  path)
inlinestatic

Definition at line 3129 of file Zone.cs.

3130 {
3131 try
3132 {
3133 return Map.GetMetaData(path)?.IsValidVersion() ?? false;
3134 }
3135 catch (Exception ex)
3136 {
3137 EClass.ui.Say(ex.Message);
3138 return false;
3139 }
3140 }
bool IsValidVersion()
Definition: MapMetaData.cs:31
static MapMetaData GetMetaData(string pathZip)
Definition: Map.cs:738

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

Referenced by TraitMoongate.UseMoongate().

◆ ListLandFeats()

List< Element > Zone.ListLandFeats ( )
inline

Definition at line 2995 of file Zone.cs.

2996 {
2997 if (landFeats == null)
2998 {
2999 landFeats = new List<int>();
3001 string[] listBase = IDBaseLandFeat.Split(',');
3002 string[] array = listBase;
3003 foreach (string text in array)
3004 {
3005 if (!text.IsEmpty())
3006 {
3007 landFeats.Add(EClass.sources.elements.alias[text].id);
3008 }
3009 }
3010 if (listBase.Length == 1)
3011 {
3012 List<SourceElement.Row> list = EClass.sources.elements.rows.Where(delegate(SourceElement.Row e)
3013 {
3014 if (e.category != "landfeat" || e.chance == 0)
3015 {
3016 return false;
3017 }
3018 bool flag = true;
3019 string[] tag = e.tag;
3020 foreach (string text2 in tag)
3021 {
3022 if (text2.StartsWith("bf"))
3023 {
3024 flag = false;
3025 if (listBase[0] == text2)
3026 {
3027 flag = true;
3028 break;
3029 }
3030 }
3031 }
3032 return flag ? true : false;
3033 }).ToList();
3034 SourceElement.Row row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3035 landFeats.Add(row.id);
3036 list.Remove(row);
3037 row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3038 landFeats.Add(row.id);
3039 }
3040 Rand.SetSeed();
3041 }
3042 List<Element> list2 = new List<Element>();
3043 foreach (int landFeat in landFeats)
3044 {
3045 list2.Add(Element.Create(landFeat, 1));
3046 }
3047 return list2;
3048 }
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1100
virtual string IDBaseLandFeat
Definition: Zone.cs:144
List< int > landFeats
Definition: Zone.cs:55

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

3569 {
3570 List<Chara> list = new List<Chara>();
3571 foreach (Chara chara in EClass._map.charas)
3572 {
3573 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3574 {
3575 list.Add(chara);
3576 }
3577 }
3578 return list;
3579 }

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

◆ ModDevelopment()

void Zone.ModDevelopment ( int  a)
inline

Definition at line 3472 of file Zone.cs.

3473 {
3474 base.development += a;
3475 if (a > 0)
3476 {
3477 Msg.Say("gainDevelopment", Name, a.ToString() ?? "");
3478 }
3479 }

References Msg.Say().

◆ ModInfluence()

void Zone.ModInfluence ( int  a)
inline

Definition at line 3462 of file Zone.cs.

3463 {
3464 base.influence += a;
3465 if (a > 0)
3466 {
3467 Msg.Say("gainInfluence", Name, a.ToString() ?? "");
3468 }
3469 Tutorial.Reserve("influence");
3470 }

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

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

◆ OnActivate()

virtual void Zone.OnActivate ( )
inlinevirtual

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

Definition at line 1133 of file Zone.cs.

1134 {
1135 }

◆ OnAdvanceHour()

virtual void Zone.OnAdvanceHour ( )
inlinevirtual

Reimplemented in Region.

Definition at line 1157 of file Zone.cs.

1158 {
1159 }

Referenced by GameDate.AdvanceHour().

◆ OnAfterCreate()

override void Zone.OnAfterCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 571 of file Zone.cs.

572 {
573 if (AddPrefix)
574 {
575 if (GetTopZone() == this)
576 {
577 base.idPrefix = EClass.sources.zoneAffixes.rows.RandomItem().id;
578 }
579 else
580 {
581 base.idPrefix = GetTopZone().idPrefix;
582 }
583 }
584 }
SourceZoneAffix zoneAffixes
int idPrefix
Definition: Spatial.cs:130
virtual bool AddPrefix
Definition: Zone.cs:278

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

◆ OnAfterSimulate()

virtual void Zone.OnAfterSimulate ( )
inlinevirtual

Reimplemented in Zone_WindRest.

Definition at line 1153 of file Zone.cs.

1154 {
1155 }

◆ OnBeforeDeactivate()

virtual void Zone.OnBeforeDeactivate ( )
inlinevirtual

Reimplemented in Zone_Tent.

Definition at line 1137 of file Zone.cs.

1138 {
1139 }

◆ OnBeforeSimulate()

virtual void Zone.OnBeforeSimulate ( )
inlinevirtual

Reimplemented in Zone_DungeonPuppy, and Zone_Nymelle.

Definition at line 1145 of file Zone.cs.

1146 {
1147 }

◆ OnChildNumChange()

void Zone.OnChildNumChange ( Card  c)
inline

Implements ICardParent.

Definition at line 1895 of file Zone.cs.

1896 {
1897 }

◆ OnCreate()

override void Zone.OnCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 565 of file Zone.cs.

566 {
567 events.zone = this;
568 base.lv = StartLV;
569 }
virtual int StartLV
Definition: Zone.cs:404

References StartLV.

◆ OnCreateBP()

virtual void Zone.OnCreateBP ( )
inlinevirtual

Reimplemented in Zone_Arena2, and Zone_Harvest.

Definition at line 2320 of file Zone.cs.

2321 {
2322 }

◆ OnDeactivate()

virtual void Zone.OnDeactivate ( )
inlinevirtual

Definition at line 1141 of file Zone.cs.

1142 {
1143 }

◆ OnGenerateMap()

virtual void Zone.OnGenerateMap ( )
inlinevirtual

Reimplemented in Zone_Arena2, Zone_CurryRuinDungeon, Zone_CursedManor, Zone_CursedManorDungeon, Zone_Dungeon, 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 2518 of file Zone.cs.

2519 {
2521 {
2522 foreach (Chara chara in EClass._map.charas)
2523 {
2524 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral && chara.OriginalHostility < Hostility.Friend)
2525 {
2526 Hostility hostility2 = (chara.c_originalHostility = Hostility.Neutral);
2527 chara.hostility = hostility2;
2528 }
2529 }
2530 }
2531 if (PrespawnRate != 0f && !IsSkyLevel)
2532 {
2533 for (int i = 0; i < (int)((float)MaxSpawn * PrespawnRate); i++)
2534 {
2535 SpawnMob();
2536 }
2537 }
2542 }
Hostility
Definition: Hostility.cs:2
Hostility OriginalHostility
Definition: Chara.cs:469
Hostility hostility
Definition: Chara.cs:289
virtual float PrespawnRate
Definition: Zone.cs:322
virtual int MaxSpawn
Definition: Zone.cs:308
virtual bool IsSkyLevel
Definition: Zone.cs:262
Chara TryGenerateEvolved(bool force=false, Point p=null)
Definition: Zone.cs:2571
void TryGenerateShrine()
Definition: Zone.cs:2608
void TryGenerateOre()
Definition: Zone.cs:2544
virtual bool MakeEnemiesNeutral
Definition: Zone.cs:229
void TryGenerateBigDaddy()
Definition: Zone.cs:2590

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

2661 {
2662 }

Referenced by MapGenDungen.OnGenerateTerrain().

◆ OnInspect()

void Zone.OnInspect ( )
inline

Implements IInspect.

Definition at line 3155 of file Zone.cs.

3156 {
3157 }

◆ OnKillGame()

void Zone.OnKillGame ( )
inline

Definition at line 1673 of file Zone.cs.

1674 {
1675 foreach (Thing thing in map.things)
1676 {
1677 if (thing.renderer.hasActor)
1678 {
1679 thing.renderer.KillActor();
1680 }
1681 }
1682 }
void KillActor()
CardRenderer renderer
Definition: Card.cs:59

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

Referenced by Game.Kill().

◆ OnLoad()

override void Zone.OnLoad ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 1845 of file Zone.cs.

1846 {
1847 if (branch != null)
1848 {
1849 branch.SetOwner(this);
1850 }
1851 events.OnLoad(this);
1852 }
void SetOwner(Zone zone)
void OnLoad(Zone _zone)

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

◆ OnRegenerate()

virtual void Zone.OnRegenerate ( )
inlinevirtual

Reimplemented in Zone_LittleGarden.

Definition at line 1129 of file Zone.cs.

1130 {
1131 }

◆ OnSimulateDay()

void Zone.OnSimulateDay ( VirtualDate  date)
inline

Definition at line 3256 of file Zone.cs.

3257 {
3258 if (base.IsPlayerFaction)
3259 {
3260 branch.OnSimulateDay(date);
3261 }
3262 }
void OnSimulateDay(VirtualDate date)

References FactionBranch.OnSimulateDay().

Referenced by VirtualDate.SimulateDay().

◆ OnSimulateHour()

void Zone.OnSimulateHour ( VirtualDate  date)
inline

Definition at line 3201 of file Zone.cs.

3202 {
3203 if (base.IsPlayerFaction)
3204 {
3205 branch.OnSimulateHour(date);
3206 }
3208 if (date.IsRealTime)
3209 {
3210 foreach (Thing thing in EClass._map.things)
3211 {
3212 if (thing.IsInstalled)
3213 {
3214 thing.trait.TryToggle();
3215 }
3216 }
3218 }
3219 EClass._map.things.ForeachReverse(delegate(Thing t)
3220 {
3221 t.OnSimulateHour(date);
3222 });
3223 foreach (Thing sucker in Suckers)
3224 {
3225 sucker.Destroy();
3226 }
3227 Suckers.Clear();
3228 if (RespawnRate != 0f)
3229 {
3230 int num = 0;
3231 foreach (Chara chara in map.charas)
3232 {
3233 if (!chara.IsGlobal)
3234 {
3235 num++;
3236 }
3237 }
3238 if (num < MaxRespawn)
3239 {
3240 for (int i = 0; i < RespawnPerHour; i++)
3241 {
3242 SpawnMob();
3243 }
3244 }
3245 }
3246 if (!date.IsRealTime && EClass.rnd(24) == 0)
3247 {
3248 RainWater();
3249 }
3250 if (date.hour == 6)
3251 {
3252 GrowPlants(date);
3253 }
3254 }
virtual void OnSimulateHour(VirtualDate date)
Definition: Card.cs:6360
void DecayNatural(int hour=1)
Definition: Card.cs:6369
int hour
Definition: Date.cs:74
void OnSimulateHour(VirtualDate date)
virtual void TryToggle()
Definition: Trait.cs:1129
bool IsRealTime
Definition: VirtualDate.cs:7
virtual int RespawnPerHour
Definition: Zone.cs:338
virtual float RespawnRate
Definition: Zone.cs:324
static List< Thing > Suckers
Definition: Zone.cs:80
void GrowPlants(VirtualDate date)
Definition: Zone.cs:3291
int MaxRespawn
Definition: Zone.cs:310

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

3265 {
3266 if (base.IsPlayerFaction)
3267 {
3268 branch.OnSimulateMonth(date);
3269 }
3270 if (date.IsRealTime)
3271 {
3273 }
3274 }
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 1054 of file Zone.cs.

1055 {
1057 {
1058 EClass.player.stats.deepest = DangerLv;
1059 }
1060 if (EClass.world.date.IsExpired(base.dateRevive))
1061 {
1063 Revive();
1064 foreach (Chara chara in EClass._map.charas)
1065 {
1066 chara.TryRestock(onCreate: false);
1067 if (!chara.IsPCFaction)
1068 {
1069 chara.c_fur = 0;
1070 }
1071 }
1072 }
1075 events.OnVisit();
1076 OnActivate();
1077 UpdateQuests();
1079 isSimulating = true;
1080 Simulate();
1081 isSimulating = false;
1083 if (EClass.Branch != null)
1084 {
1086 }
1087 base.lastActive = EClass.world.date.GetRaw();
1088 if (!EClass.game.isLoading)
1089 {
1090 base.visitCount++;
1091 }
1092 base.version = EClass.core.version.GetInt();
1093 }
Version version
Definition: BaseCore.cs:17
override bool IsPCFaction
Definition: Chara.cs:669
void TryRestock(bool onCreate)
Definition: Chara.cs:4579
void OnAfterSimulate()
int deepest
Definition: Player.cs:111
Stats stats
Definition: Player.cs:972
void AssignCharas()
Definition: RoomManager.cs:39
void Revive()
Definition: Zone.cs:1095
void Simulate()
Definition: Zone.cs:1161
virtual void OnAfterSimulate()
Definition: Zone.cs:1153
virtual bool CountDeepestLevel
Definition: Zone.cs:224
void RefreshCriminal()
Definition: Zone.cs:3429
virtual void OnBeforeSimulate()
Definition: Zone.cs:1145
virtual void OnActivate()
Definition: Zone.cs:1133
void ResetHostility()
Definition: Zone.cs:2644
void UpdateQuests(bool force=false)
Definition: Zone.cs:3481
int GetInt()
Definition: Version.cs:21

References EClass._map, RoomManager.AssignCharas(), EClass.Branch, Map.charas, EClass.core, World.date, Player.Stats.deepest, EClass.game, Version.GetInt(), Date.GetRaw(), Date.IsExpired(), Game.isLoading, Chara.IsPCFaction, FactionBranch.OnAfterSimulate(), ZoneEventManager.OnVisit(), EClass.player, Revive, Map.rooms, Player.stats, Chara.TryRestock(), BaseCore.version, and EClass.world.

◆ OnVisitNewMapOrRegenerate()

virtual void Zone.OnVisitNewMapOrRegenerate ( )
inlinevirtual

Reimplemented in Zone_Yowyn.

Definition at line 1149 of file Zone.cs.

1150 {
1151 }

◆ RainWater()

void Zone.RainWater ( )
inline

Definition at line 3276 of file Zone.cs.

3277 {
3279 {
3280 return;
3281 }
3282 EClass._map.bounds.ForeachCell(delegate(Cell c)
3283 {
3284 if (c.IsFarmField && !c.HasRoof)
3285 {
3286 c.isWatered = true;
3287 }
3288 });
3289 }
bool IsFarmField
Definition: Cell.cs:730
bool IsIndoor
Definition: Map.cs:131

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

Referenced by Weather.SetCondition().

◆ RefreshBGM()

void Zone.RefreshBGM ( )
inline

Definition at line 2903 of file Zone.cs.

2904 {
2906 {
2907 return;
2908 }
2910 Playlist playlist = map.plDay;
2911 foreach (ZoneEvent item in events.list)
2912 {
2913 if (item.playlist != null)
2914 {
2915 playlist = item.playlist;
2916 }
2917 }
2918 if (IDPlaylistOverwrite != null)
2919 {
2920 playlist = EClass.Sound.GetPlaylist(IDPlaylistOverwrite);
2921 }
2923 {
2924 Room room = EClass.pc.pos.cell.room;
2925 if (room != null && room.lot != null && room.lot.idBGM != 0)
2926 {
2927 playlist = EClass.Sound.plLot;
2928 if (playlist.list[0].data?.id != room.lot.idBGM)
2929 {
2930 playlist.list[0].data = EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM);
2931 playlist.Reset();
2932 if (!LayerDrama.keepBGM)
2933 {
2934 EClass.Sound.StopBGM(1f);
2935 }
2936 }
2937 }
2938 }
2940 EClass.Sound.SwitchPlaylist(playlist, !LayerDrama.keepBGM);
2941 }
bool IsInActiveZone
Definition: Chara.cs:836
void SetBGMInterval()
Definition: CoreConfig.cs:1001
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:385
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:140

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

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

◆ RefreshCriminal()

void Zone.RefreshCriminal ( )
inline

Definition at line 3429 of file Zone.cs.

3430 {
3431 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3432 Hostility hostility = (flag ? Hostility.Neutral : Hostility.Friend);
3433 foreach (Chara chara in EClass._map.charas)
3434 {
3435 if (chara.trait is TraitGuard)
3436 {
3437 chara.hostility = hostility;
3438 if (!flag && chara.enemy != null && chara.enemy.IsPCParty)
3439 {
3440 chara.SetEnemy();
3441 }
3442 }
3443 }
3444 }
Chara enemy
Definition: Chara.cs:86
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6072
virtual bool AllowCriminal
Definition: Zone.cs:242

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

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

◆ RefreshElectricity()

void Zone.RefreshElectricity ( )
inline

Definition at line 2797 of file Zone.cs.

2798 {
2799 dirtyElectricity = false;
2800 bool flag = GetSoilCost() > MaxSoil;
2801 base.electricity = elements.Value(2201) * 10 + BaseElectricity;
2802 foreach (Thing thing in EClass._map.things)
2803 {
2804 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
2805 {
2806 base.electricity += thing.trait.Electricity;
2807 }
2808 }
2809 if (!flag)
2810 {
2811 EClass._map.bounds.ForeachCell(delegate(Cell c)
2812 {
2813 if (c.sourceObj.id == 118 && c.growth.IsMature)
2814 {
2815 base.electricity += 20;
2816 }
2817 });
2818 }
2819 foreach (Thing thing2 in EClass._map.things)
2820 {
2821 if (thing2.IsInstalled)
2822 {
2823 thing2.trait.TryToggle();
2824 }
2825 }
2826 }
bool isOn
Definition: Card.cs:528
bool dirtyElectricity
Definition: Zone.cs:68

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

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

◆ RefreshHat()

void Zone.RefreshHat ( )
inline

Definition at line 1044 of file Zone.cs.

1045 {
1046 if (idHat != null && EClass.world.date.IsExpired(base.dateHat))
1047 {
1048 idHat = null;
1049 base.dateHat = 0;
1050 }
1051 sourceHat = ((idHat != null) ? EClass.sources.cards.map[idHat] : ((IDHat != null) ? EClass.sources.cards.map[IDHat] : null));
1052 }
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
SourceCard cards
string idHat
Definition: Spatial.cs:31
virtual string IDHat
Definition: Zone.cs:142
static CardRow sourceHat
Definition: Zone.cs:29

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

Referenced by TraitHat.OnUse().

◆ RefreshListCitizen()

void Zone.RefreshListCitizen ( )
inline

Definition at line 3446 of file Zone.cs.

3447 {
3448 if (base.lv != 0)
3449 {
3450 return;
3451 }
3452 dictCitizen.Clear();
3453 foreach (Chara item in map.charas.Concat(map.deadCharas))
3454 {
3455 if (item.trait.IsCitizen && !item.IsGlobal && !item.isSubsetCard)
3456 {
3457 dictCitizen[item.uid] = item.Name;
3458 }
3459 }
3460 }
Dictionary< int, string > dictCitizen
Definition: Zone.cs:49

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

Referenced by Chara.MakeAlly().

◆ RefreshPlaylist()

void Zone.RefreshPlaylist ( )
inline

Definition at line 2895 of file Zone.cs.

2896 {
2897 if (map.plDay == null)
2898 {
2899 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList));
2900 }
2901 }

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

1984 {
1985 if (IsActiveZone)
1986 {
1988 }
1989 t.parent = null;
1990 if (t.isChara)
1991 {
1992 t.Chara.currentZone = null;
1993 }
1994 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
1995 {
1997 }
1998 if (t.renderer.hasActor)
1999 {
2001 }
2002 }
override void OnLeaveScreen()
virtual bool isChara
Definition: Card.cs:2045
void OnCardRemovedFromZone(Card t)
Definition: Map.cs:825
void RemoveActorEx(Card c)
Definition: Scene.cs:1027
virtual string IDActorEx
Definition: Trait.cs:174

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

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

◆ ResetHostility()

void Zone.ResetHostility ( )
inline

Definition at line 2644 of file Zone.cs.

2645 {
2646 foreach (Chara chara in EClass._map.charas)
2647 {
2648 if (!chara.source.hostility.IsEmpty() && chara.source.hostility.ToEnum<Hostility>() >= Hostility.Friend && !chara.IsPCFactionOrMinion)
2649 {
2650 chara.c_originalHostility = (Hostility)0;
2651 }
2652 chara.hostility = chara.OriginalHostility;
2653 if (chara.enemy != null && (chara.enemy.IsPCFaction || chara.IsPCFaction))
2654 {
2655 chara.SetEnemy();
2656 }
2657 }
2658 }
bool IsPCFactionOrMinion
Definition: Card.cs:2234
SourceChara.Row source
Definition: Chara.cs:156

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

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

◆ Revive()

void Zone.Revive ( )
inline

Definition at line 1095 of file Zone.cs.

1096 {
1097 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
1098 if (ShouldAutoRevive)
1099 {
1100 foreach (Chara deadChara in map.deadCharas)
1101 {
1102 if (deadChara.trait.CanAutoRevive && deadChara.CanRevive())
1103 {
1104 deadChara.Revive();
1106 {
1107 deadChara.RemoveBacker();
1108 }
1109 EClass._zone.AddCard(deadChara, (deadChara.orgPos != null && deadChara.orgPos.IsInBounds) ? deadChara.orgPos : deadChara.pos);
1110 }
1111 }
1112 }
1113 foreach (Chara value in EClass.game.cards.globalCharas.Values)
1114 {
1115 if (value.isDead && value.CanRevive() && value.homeZone == this)
1116 {
1117 value.Revive();
1118 Point point = GetSpawnPos(value);
1119 if (value.orgPos != null && value.orgPos.IsInBounds)
1120 {
1121 point = value.orgPos.GetNearestPoint() ?? point;
1122 }
1123 EClass._zone.AddCard(value, point);
1124 }
1125 }
1126 map.deadCharas.Clear();
1127 }
int c_idBacker
Definition: Card.cs:1411
bool CanRevive()
Definition: Chara.cs:4955
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:4981
Zone homeZone
Definition: Chara.cs:265
bool IsInBounds
Definition: Point.cs:104
virtual bool CanAutoRevive
Definition: TraitChara.cs:20
virtual bool ShouldAutoRevive
Definition: Zone.cs:375

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(), CardManager.globalCharas, Chara.homeZone, CoreConfig.Test.ignoreBackerDestoryFlag, Card.isBackerContent, Chara.isDead, Point.IsInBounds, Chara.orgPos, EClass.player, Card.pos, Card.RemoveBacker(), Chara.Revive(), EClass.setting, CoreConfig.test, Chara.trait, and EClass.world.

Referenced by Map.ResetEditorPos().

◆ SetBGM() [1/2]

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

Definition at line 2890 of file Zone.cs.

2891 {
2892 SetBGM(new List<int> { id }, refresh);
2893 }

◆ SetBGM() [2/2]

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

Definition at line 2867 of file Zone.cs.

2868 {
2869 map._plDay.Clear();
2870 if (ids.Count > 0)
2871 {
2872 foreach (int id in ids)
2873 {
2874 if (id != -1)
2875 {
2876 map._plDay.Add(id);
2877 }
2878 }
2879 }
2880 UnityEngine.Object.DestroyImmediate(map.plDay);
2881 map.plDay = null;
2883 if (refresh)
2884 {
2885 EClass.Sound.StopBGM();
2886 RefreshBGM();
2887 }
2888 }

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

Referenced by ZoneEventSubdue.CheckClear(), ClaimZone(), CardRenderer.Draw(), ZonePreEnterBout.Execute(), ZoneEventDefenseGame.OnVisit(), ZoneEventHarvest.OnVisit(), ZoneEventSubdue.OnVisit(), DramaManager.ParseLine(), GoalCombat.Run(), and Chara.TryDropBossLoot().

◆ ShouldScaleImportedChara()

virtual bool Zone.ShouldScaleImportedChara ( Chara  c)
inlinevirtual

Reimplemented in Zone_QuestDungeon.

Definition at line 537 of file Zone.cs.

538 {
539 return false;
540 }

Referenced by SerializedCards.Restore().

◆ Simulate()

void Zone.Simulate ( )
inline

Definition at line 1161 of file Zone.cs.

1162 {
1163 if (!EClass.game.isLoading && base.visitCount > 0)
1164 {
1165 if (Boss != null && IsNefia)
1166 {
1167 Msg.Say("bossLeave", Boss.Name.ToTitleCase(), EClass._zone.Name);
1170 }
1171 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1172 foreach (Chara chara2 in EClass._map.charas)
1173 {
1174 if (chara2.hp < 0)
1175 {
1176 chara2.hp = 0;
1177 }
1178 if (!chara2.IsPCParty)
1179 {
1180 if (chara2.mana.value < 0)
1181 {
1182 chara2.mana.value = 0;
1183 }
1184 if (chara2.stamina.value < 0)
1185 {
1186 chara2.stamina.value = 0;
1187 }
1188 }
1189 if (num > 60)
1190 {
1191 chara2.resistCon = null;
1192 }
1193 if (chara2.rarity >= Rarity.Legendary && !chara2.IsPCFaction && num > 0)
1194 {
1195 Msg.ignoreAll = true;
1196 chara2.Cure(CureType.Boss, 20 + num * 10);
1197 chara2.HealHP(Mathf.Max(1, chara2.MaxHP) * Mathf.Min(num, 20) / 20);
1198 chara2.mana.Mod(Mathf.Max(1, chara2.mana.max) * Mathf.Min(num, 20) / 20);
1199 chara2.stamina.Mod(Mathf.Max(1, chara2.stamina.max) * Mathf.Min(num, 20) / 20);
1200 Msg.ignoreAll = false;
1201 }
1202 }
1203 }
1204 Debug.Log("Last Active:" + base.lastActive);
1205 if (base.lastActive == 0 || HourSinceLastActive <= 1 || IsRegion)
1206 {
1207 return;
1208 }
1209 Debug.Log(Name + " Simulate:" + HourSinceLastActive + " hours");
1210 VirtualDate virtualDate = new VirtualDate(HourSinceLastActive);
1211 List<Chara> list = EClass._map.charas.ToList();
1212 int num2 = HourSinceLastActive / 24;
1213 int num3 = 0;
1214 if (num2 > 0)
1215 {
1216 foreach (Chara item in list)
1217 {
1218 if (!item.IsPCParty)
1219 {
1220 item.OnSleep(200, num2);
1221 if (item.conSleep != null)
1222 {
1223 item.conSleep.Kill();
1224 }
1225 if (EClass.rnd(EClass.world.date.IsNight ? 20 : 200) == 0 && !item.IsPCFaction)
1226 {
1227 item.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
1228 }
1229 if (item.things.Count > 20)
1230 {
1231 item.ClearInventory(ClearInventoryType.Purge);
1232 }
1233 }
1234 }
1235 }
1236 VirtualDate.current = virtualDate;
1237 for (int i = 0; i < HourSinceLastActive; i++)
1238 {
1239 virtualDate.SimulateHour();
1240 if (!virtualDate.IsWinter)
1241 {
1242 num3++;
1243 }
1244 }
1245 EClass._map.things.ForeachReverse(delegate(Thing t)
1246 {
1248 });
1249 VirtualDate.current = null;
1250 if (!IsPCFaction)
1251 {
1252 return;
1253 }
1254 int num4 = 0;
1255 foreach (Chara item2 in list)
1256 {
1257 if (item2.IsPCParty)
1258 {
1259 continue;
1260 }
1261 if (!item2.IsHomeMember())
1262 {
1263 if (item2.id == "bee")
1264 {
1265 num4++;
1266 }
1267 if (num2 > 0 && item2.IsGuest())
1268 {
1269 item2.ChooseNewGoal();
1270 item2.ai.SimulateZone(num2);
1271 }
1272 continue;
1273 }
1274 if (num2 > 0)
1275 {
1276 Goal goalWork = item2.GetGoalWork();
1277 item2.SetAI(goalWork);
1278 if (goalWork is GoalWork)
1279 {
1280 (goalWork as GoalWork).FindWork(item2);
1281 }
1282 item2.ai.SimulateZone(num2);
1283 goalWork = item2.GetGoalHobby();
1284 item2.SetAI(goalWork);
1285 if (goalWork is GoalWork)
1286 {
1287 (goalWork as GoalWork).FindWork(item2);
1288 }
1289 item2.ai.SimulateZone(num2);
1290 }
1291 item2.ChooseNewGoal();
1292 if (item2.conSuspend == null)
1293 {
1294 item2.ai.OnSimulatePosition();
1295 }
1296 }
1297 List<Thing> list2 = new List<Thing>();
1298 foreach (Thing thing in map.things)
1299 {
1300 if (thing.IsInstalled && thing.trait is TraitBeekeep)
1301 {
1302 list2.Add(thing);
1303 }
1304 }
1305 if (num4 >= list2.Count)
1306 {
1307 return;
1308 }
1309 for (int j = num4; j < list2.Count; j++)
1310 {
1311 if (EClass.rnd(200) <= HourSinceLastActive)
1312 {
1313 Chara chara = CharaGen.Create("bee");
1314 AddCard(chara, list2.RandomItem().pos);
1315 Hostility c_originalHostility = (chara.hostility = Hostility.Neutral);
1316 chara.c_originalHostility = c_originalHostility;
1317 }
1318 }
1319 }
ClearInventoryType
CureType
Definition: CureType.cs:2
virtual void OnSimulatePosition()
Definition: AIAct.cs:590
void SimulateZone(int days)
Definition: AIAct.cs:578
virtual void HealHP(int a, HealSource origin=HealSource.None)
Definition: Card.cs:3901
int hp
Definition: Card.cs:228
string Name
Definition: Card.cs:2099
AIAct ai
Definition: Chara.cs:200
ConSuspend conSuspend
Definition: Chara.cs:104
Goal GetGoalWork()
Definition: Chara.cs:8462
override int MaxHP
Definition: Chara.cs:706
Goal GetGoalHobby()
Definition: Chara.cs:8475
Stats mana
Definition: Chara.cs:1136
Stats stamina
Definition: Chara.cs:1128
bool IsHomeMember()
Definition: Chara.cs:6356
bool IsGuest()
Definition: Chara.cs:6381
void ChooseNewGoal()
Definition: Chara.cs:8398
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:9133
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:122
Chara Boss
Definition: Zone.cs:83
int HourSinceLastActive
Definition: Zone.cs:120

References EClass._map, EClass._zone, 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(), Card.hp, Card.id, Spatial.isConquered, Chara.IsGuest(), Chara.IsHomeMember(), Card.IsInstalled, Game.isLoading, Date.IsNight, Chara.IsPCFaction, Chara.IsPCParty, Date.IsWinter, item, Chara.mana, Stats.max, Chara.MaxHP, Stats.Mod(), 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.

◆ SpawnAltar()

void Zone.SpawnAltar ( )
inline

Definition at line 2479 of file Zone.cs.

2480 {
2482 {
2483 if (r.points.Count <= 4)
2484 {
2485 return false;
2486 }
2487 map.poiMap.OccyupyPOI(r.points[0]);
2488 List<Point> points = r.points;
2489 Religion randomReligion = EClass.game.religions.GetRandomReligion();
2490 "altarPoint".lang(randomReligion.NameDomain.lang());
2491 Thing thing = ThingGen.Create("altar");
2492 (thing.trait as TraitAltar).SetDeity(randomReligion.id);
2493 Chara t = CharaGen.Create("twintail");
2494 EClass._zone.AddCard(t, points.RandomItem());
2495 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2496 {
2497 Chara t2 = CharaGen.Create("twintail");
2498 EClass._zone.AddCard(t2, points.RandomItem());
2499 }
2500 if (points[0].Installed == null)
2501 {
2502 EClass._zone.AddCard(thing, points[0]).Install();
2503 }
2504 foreach (Point item in points)
2505 {
2506 if (item.x % 3 == 0 && item.z % 2 == 0 && item != points[0] && !item.Equals(points[0].Front) && item.Installed == null)
2507 {
2508 thing = ThingGen.Create("pillar1");
2509 EClass._zone.AddCard(thing, item).Install();
2510 }
2511 item.SetObj();
2512 item.SetFloor(3, 6);
2513 }
2514 return true;
2515 });
2516 }
Crawler start
Definition: CoreRef.cs:214
Crawlers crawlers
Definition: CoreRef.cs:343
ReligionManager religions
Definition: Game.cs:158
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(), item, POIMap.OccyupyPOI(), Map.poiMap, Core.refs, Game.religions, EClass.rnd(), CoreRef.Crawlers.start, and Card.trait.

◆ SpawnLostItems()

void Zone.SpawnLostItems ( )
inline

Definition at line 3604 of file Zone.cs.

3605 {
3606 for (int i = 0; i < 2 + EClass.rnd(4); i++)
3607 {
3608 Point point = GetPos();
3609 if (point == null)
3610 {
3611 continue;
3612 }
3613 if (EClass.rnd(30) == 0)
3614 {
3615 Thing thing = ThingGen.Create("purse");
3616 thing.isLostProperty = true;
3617 thing.things.DestroyAll();
3618 int num2 = (thing.c_lockLv = EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3619 thing.Add("money", EClass.rndHalf(num2 * 60 + 1000));
3620 if (EClass.rnd(2) == 0)
3621 {
3622 thing.Add("plat", EClass.rnd(4));
3623 }
3624 else
3625 {
3626 thing.Add("medal", EClass.rnd(2));
3627 }
3628 EClass._zone.AddCard(thing, point);
3629 }
3630 else
3631 {
3633 }
3634 }
3635 static Point GetPos()
3636 {
3637 for (int j = 0; j < 10; j++)
3638 {
3639 Point randomPoint = EClass._zone.bounds.GetRandomPoint();
3640 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
3641 {
3642 return randomPoint;
3643 }
3644 }
3645 return null;
3646 }
3647 }
ThingContainer things
Definition: Card.cs:36
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3034
static int rndHalf(int a)
Definition: EClass.cs:87
void DestroyAll(Func< Thing, bool > funcExclude=null)
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
MapBounds bounds
Definition: Zone.cs:46

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

◆ SpawnMob()

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

Definition at line 2697 of file Zone.cs.

2698 {
2699 if (setting == null)
2700 {
2702 }
2703 if (pos == null)
2704 {
2705 pos = GetSpawnPos(setting.position, setting.tries);
2706 if (pos == null)
2707 {
2708 pos = GetSpawnPos(SpawnPosition.Random, setting.tries);
2709 if (pos == null)
2710 {
2711 return null;
2712 }
2713 }
2714 }
2716 if (IsUnderwater && EClass.rnd(15) != 0)
2717 {
2719 }
2720 SpawnList spawnList = null;
2721 spawnList = ((setting.idSpawnList != null) ? SpawnList.Get(setting.idSpawnList) : ((EClass._zone is Zone_DungeonYeek && EClass.rnd(5) != 0) ? SpawnListChara.Get("dungeon_yeek", (SourceChara.Row r) => r.race == "yeek" && r.quality == 0) : ((EClass._zone is Zone_DungeonMino && EClass.rnd(5) != 0) ? SpawnListChara.Get("dungeon_mino", (SourceChara.Row r) => r.race == "minotaur" && r.quality == 0) : ((setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) < ChanceSpawnNeutral)) ? SpawnList.Get("c_neutral") : ((biome.spawn.chara.Count <= 0) ? SpawnList.Get(biome.name, "chara", new CharaFilter
2722 {
2723 ShouldPass = delegate(SourceChara.Row s)
2724 {
2725 if (s.hostility != "")
2726 {
2727 return false;
2728 }
2729 return s.biome == biome.name || s.biome.IsEmpty();
2730 }
2732 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
2733 CardBlueprint cardBlueprint = new CardBlueprint
2734 {
2735 rarity = Rarity.Normal,
2736 idEle = setting.idEle
2737 };
2738 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
2739 if (ScaleType == ZoneScaleType.Void)
2740 {
2741 num2 = ((num - 1) % 50 + 5) * 150 / 100;
2742 if (num2 >= 20 && EClass.rnd(100) < num2)
2743 {
2744 num2 = num;
2745 }
2746 }
2747 CardRow cardRow = (setting.id.IsEmpty() ? spawnList.Select(num2, setting.levelRange) : EClass.sources.cards.map[setting.id]);
2748 int num3 = ((setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv);
2749 if (ScaleType == ZoneScaleType.Void)
2750 {
2751 num3 = (50 + cardRow.LV) * Mathf.Max(1, (num - 1) / 50);
2752 }
2753 num3 += DangerLvBoost;
2754 if (setting.rarity == Rarity.Random)
2755 {
2756 if (EClass.rnd(100) == 0)
2757 {
2758 cardBlueprint.rarity = Rarity.Legendary;
2759 num3 = num3 * 125 / 100;
2760 }
2761 }
2762 else
2763 {
2764 cardBlueprint.rarity = setting.rarity;
2765 }
2766 if (setting.isBoss)
2767 {
2768 num3 = num3 * 150 / 100;
2769 }
2770 if (setting.isEvolved)
2771 {
2772 num3 = num3 * 2 + 20;
2773 }
2774 if (num3 != cardRow.LV)
2775 {
2776 cardBlueprint.lv = num3;
2777 }
2778 CardBlueprint.Set(cardBlueprint);
2779 Chara chara = CharaGen.Create(cardRow.id, num2);
2780 AddCard(chara, pos);
2781 if (setting.forcedHostility.HasValue)
2782 {
2783 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
2784 chara.c_originalHostility = c_originalHostility;
2785 }
2786 if (setting.isBoss)
2787 {
2788 chara.c_bossType = BossType.Boss;
2789 }
2790 if (setting.isEvolved)
2791 {
2792 chara.c_bossType = BossType.Evolved;
2793 }
2794 return chara;
2795 }
BossType
Definition: BossType.cs:2
SpawnHostility
ZoneScaleType
Definition: ZoneScaleType.cs:2
string GetRandomCharaId()
static void Set(CardBlueprint _bp)
string id
Definition: CardRow.cs:7
BiomeProfile biome
Definition: Cell.cs:1075
BiomeProfile Water
Definition: CoreRef.cs:152
BiomeProfile Sand
Definition: CoreRef.cs:150
Biomes biomes
Definition: CoreRef.cs:341
static int Range(int min, int max)
Definition: Rand.cs:42
int LV
Definition: RenderRow.cs:22
virtual int DangerLvBoost
Definition: Spatial.cs:477
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:31
virtual ZoneScaleType ScaleType
Definition: Zone.cs:406
virtual float ChanceSpawnNeutral
Definition: Zone.cs:340

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

Referenced by TraitShrine._OnUse(), ZoneEventSiege.CreateChara(), ZonePreEnterEncounter.Execute(), Zone_RandomDungeon.OnGenerateMap(), Zone_Void.OnGenerateMap(), SurvivalManager.OnMineWreck(), ZoneEventHarvest.OnVisit(), ZoneEventQuest.Spawn(), ZoneEventQuest.SpawnBoss(), CoreDebug.SpawnBoss(), GenRoom.SpawnMob(), CoreDebug.TestSpawn(), TraitSpotBiome.Update(), TraitSpotSpawn.Update(), and CoreDebug.UpdateInput().

◆ TextLevel()

string Zone.TextLevel ( int  _lv)
inline

Definition at line 552 of file Zone.cs.

553 {
554 if (_lv != 0)
555 {
556 if (base.lv <= 0)
557 {
558 return " " + "zoneLevelB".lang((_lv * -1).ToString() ?? "");
559 }
560 return " " + "zoneLevel".lang((_lv + 1).ToString() ?? "");
561 }
562 return "";
563 }
override string ToString()
Definition: Zone.cs:547

References ToString().

◆ ToString()

override string Zone.ToString ( )
inline

Definition at line 547 of file Zone.cs.

548 {
549 return Name + "(" + base.uid + ")(" + _regionPos?.ToString() + ") instance?" + IsInstance + "/" + EClass.world.date.GetRemainingHours(base.dateExpire) + "h";
550 }
int GetRemainingHours(int rawDeadLine)
Definition: Date.cs:337
override string ToString()
Definition: Point.cs:512
Point _regionPos
Definition: Spatial.cs:55

References Spatial._regionPos, World.date, Date.GetRemainingHours(), IsInstance, Spatial.Name, 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 2183 of file Zone.cs.

2184 {
2185 int num = 0;
2186 if (p.cell.detail != null)
2187 {
2188 foreach (Thing thing in p.cell.detail.things)
2189 {
2190 if (thing.placeState == PlaceState.roaming)
2191 {
2192 if (target.TryStackTo(thing))
2193 {
2194 return true;
2195 }
2196 num++;
2197 }
2198 }
2199 }
2200 if (num == 0 || !destroyIfFail)
2201 {
2202 EClass._zone.AddCard(target, p);
2203 return true;
2204 }
2205 target.Destroy();
2206 return false;
2207 }
bool TryStackTo(Thing to)
Definition: Card.cs:3295
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 2086 of file Zone.cs.

2087 {
2088 Thing dest = null;
2089 int priority = -1;
2090 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
2091 if (flag == ContainerFlag.none)
2092 {
2093 flag = ContainerFlag.other;
2094 }
2095 if (containers == null)
2096 {
2097 containers = EClass._map.props.installed.containers;
2098 }
2099 if (SearchDest() != null)
2100 {
2101 return true;
2102 }
2103 if (dest == null)
2104 {
2105 return false;
2106 }
2107 if (add)
2108 {
2109 if (msg)
2110 {
2111 chara.Say("putSharedItem", chara, t, dest.GetName(NameStyle.Full));
2112 }
2113 dest.AddThing(t);
2114 }
2115 return true;
2116 Thing SearchDest()
2117 {
2118 foreach (Thing container in containers)
2119 {
2120 Thing thing = container;
2121 if (thing.trait is TraitShippingChest)
2122 {
2124 }
2125 if ((!sharedOnly || thing.IsSharedContainer) && thing.c_lockLv <= 0 && (thing.things.Count < thing.things.MaxCapacity || thing.things.CanStack(t) != t))
2126 {
2127 Window.SaveData windowSaveData = thing.GetWindowSaveData();
2128 if (windowSaveData != null)
2129 {
2130 if (windowSaveData.priority <= priority || (windowSaveData.noRotten && t.IsDecayed) || (windowSaveData.onlyRottable && t.trait.Decay == 0))
2131 {
2132 continue;
2133 }
2135 if (windowSaveData.userFilter)
2136 {
2137 filterResult = windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1));
2138 if (filterResult == Window.SaveData.FilterResult.Block)
2139 {
2140 continue;
2141 }
2142 }
2143 if (filterResult != Window.SaveData.FilterResult.PassWithoutFurtherTest)
2144 {
2145 if (windowSaveData.advDistribution)
2146 {
2147 bool flag2 = false;
2148 foreach (int cat in windowSaveData.cats)
2149 {
2150 if (t.category.uid == cat)
2151 {
2152 flag2 = true;
2153 break;
2154 }
2155 }
2156 if (!flag2)
2157 {
2158 continue;
2159 }
2160 }
2161 else if (windowSaveData.flag.HasFlag(flag))
2162 {
2163 continue;
2164 }
2165 }
2166 priority = windowSaveData.priority;
2167 }
2168 else
2169 {
2170 if (priority != -1)
2171 {
2172 continue;
2173 }
2174 priority = 0;
2175 }
2176 dest = thing;
2177 }
2178 }
2179 return null;
2180 }
2181 }
ContainerFlag
Definition: ContainerFlag.cs:5
NameStyle
Definition: NameStyle.cs:2
Thing container_shipping
Definition: CardManager.cs:52
bool IsDecayed
Definition: Card.cs:2249
int c_lockLv
Definition: Card.cs:938
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3057
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2478
SourceCategory.Row category
Definition: Card.cs:2011
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6586
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:527
bool IsSharedContainer
Definition: Thing.cs:112
virtual int Decay
Definition: Trait.cs:120
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(), 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 2009 of file Zone.cs.

2009 : Trait
2010 {
2011 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<T>();
2012 if (randomThing == null)
2013 {
2015 return false;
2016 }
2017 if (useContainer && (!t.IsContainer || t.things.Count == 0))
2018 {
2019 List<Thing> list = new List<Thing>();
2020 foreach (Point item in randomThing.trait.ListPoints(null, onlyPassable: false))
2021 {
2022 foreach (Card item2 in item.ListCards())
2023 {
2024 if (item2.IsContainer && !(item2.trait is TraitDeliveryChest))
2025 {
2026 list.Add(item2.Thing);
2027 }
2028 }
2029 }
2030 if (TryAddThingInSharedContainer(t, list, add: true, msg: false, null, sharedOnly: false))
2031 {
2032 return true;
2033 }
2034 }
2035 AddCard(t, randomThing.trait.GetRandomPoint());
2036 return true;
2037 }
virtual Thing Thing
Definition: Card.cs:2020
bool IsContainer
Definition: Card.cs:2051
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
Definition: Trait.cs:752
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:734
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2086

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

◆ TryGenerateBigDaddy()

void Zone.TryGenerateBigDaddy ( )
inline

Definition at line 2590 of file Zone.cs.

2591 {
2592 if (!(BigDaddyChance <= EClass.rndf(1f)))
2593 {
2594 int num = DangerLv * 125 / 100;
2595 if (num >= 30)
2596 {
2598 {
2599 lv = num
2600 });
2601 }
2602 Chara t = CharaGen.Create("big_daddy");
2603 EClass._zone.AddCard(t, GetSpawnPos(SpawnPosition.Random, 10000));
2604 Msg.Say("sign_bigdaddy");
2605 }
2606 }
static float rndf(float a)
Definition: EClass.cs:92
virtual float BigDaddyChance
Definition: Zone.cs:316

References EClass._zone, AddCard(), CharaGen.Create(), EClass.rndf(), Msg.Say(), and CardBlueprint.Set().

Referenced by Zone_Dungeon.OnGenerateMap().

◆ TryGenerateEvolved()

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

Definition at line 2571 of file Zone.cs.

2572 {
2573 if (!force && EvolvedChance <= EClass.rndf(1f))
2574 {
2575 return null;
2576 }
2577 Chara chara = SpawnMob(p, SpawnSetting.Evolved());
2578 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2579 {
2580 chara.ability.AddRandom();
2581 }
2582 chara.AddThing(chara.MakeGene(DNA.Type.Default));
2583 if (EClass.rnd(2) == 0)
2584 {
2585 chara.AddThing(chara.MakeGene(DNA.Type.Superior));
2586 }
2587 return chara;
2588 }
void AddRandom()
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:7852
CharaAbility ability
Definition: Chara.cs:422
Definition: DNA.cs:8
Type
Definition: DNA.cs:10
static SpawnSetting Evolved(int fixedLv=-1)
Definition: SpawnSetting.cs:35
virtual float EvolvedChance
Definition: Zone.cs:318

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

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

◆ TryGenerateOre()

void Zone.TryGenerateOre ( )
inline

Definition at line 2544 of file Zone.cs.

2545 {
2546 if (OreChance <= 0f)
2547 {
2548 return;
2549 }
2550 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)
2551 {
2552 byte b = 18;
2553 string group = "ore";
2554 if (EClass.rnd(5) == 0)
2555 {
2556 b++;
2557 group = "gem";
2558 }
2559 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(DangerLv, group);
2560 foreach (Point point in r.points)
2561 {
2562 if (point.sourceBlock.ContainsTag("ore"))
2563 {
2564 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2565 }
2566 }
2567 return false;
2568 });
2569 }
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:52
int Width
Definition: MapBounds.cs:26
int Height
Definition: MapBounds.cs:28
virtual float OreChance
Definition: Zone.cs:314

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

2609 {
2610 for (int i = 0; i < 3; i++)
2611 {
2612 Rand.SetSeed(base.uid + i);
2613 if (ShrineChance <= EClass.rndf(1f))
2614 {
2615 continue;
2616 }
2617 Point randomSpace = EClass._map.GetRandomSpace(3, 3);
2618 if (randomSpace == null)
2619 {
2620 continue;
2621 }
2622 randomSpace.x++;
2623 randomSpace.z++;
2624 if (randomSpace.HasThing || randomSpace.HasChara)
2625 {
2626 continue;
2627 }
2628 randomSpace.SetObj();
2631 if (EClass.rnd(EClass.debug.test ? 2 : 15) == 0)
2632 {
2633 EClass._zone.AddCard(ThingGen.Create("pedestal_power"), randomSpace).Install();
2634 EClass._zone.AddCard(ThingGen.Create(EClass.gamedata.godStatues.RandomItemWeighted((GodStatueData a) => a.chance).idThing, -1, DangerLv), randomSpace).Install();
2635 }
2636 else
2637 {
2638 EClass._zone.AddCard(ThingGen.Create("statue_power", -1, DangerLv), randomSpace).Install().SetRandomDir();
2639 }
2640 }
2641 Rand.SetSeed();
2642 }
void SetRandomDir()
Definition: Card.cs:6001
bool test
Definition: CoreDebug.cs:170
static GameData gamedata
Definition: EClass.cs:36
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:900
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:912
virtual float ShrineChance
Definition: Zone.cs:320

References EClass._map, EClass._zone, AddCard(), GodStatueData.chance, ThingGen.Create(), EClass.debug, EClass.gamedata, MapBounds.GetRandomSpace(), GameData.godStatues, Point.HasChara, Point.HasThing, Card.Install(), 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 2225 of file Zone.cs.

2225 : TraitSpot
2226 {
2227 List<T> list = new List<T>();
2228 foreach (Thing thing2 in EClass._map.things)
2229 {
2230 if (thing2.IsInstalled && thing2.trait is T)
2231 {
2232 list.Add(thing2.trait as T);
2233 }
2234 }
2235 foreach (T item in list)
2236 {
2237 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2238 {
2239 foreach (Thing thing3 in item2.Things)
2240 {
2241 if (!thing3.IsInstalled || thing3.isSale)
2242 {
2243 continue;
2244 }
2245 if (thing3.things.Count == 0)
2246 {
2247 if (IsValid(thing3, insideContainer: false))
2248 {
2249 return thing3;
2250 }
2251 continue;
2252 }
2253 Thing thing = thing3.things.Find((Thing _t) => IsValid(_t, insideContainer: true));
2254 if (thing != null)
2255 {
2256 return thing;
2257 }
2258 }
2259 }
2260 }
2261 return null;
2262 bool IsValid(Thing t, bool insideContainer)
2263 {
2264 if (t.category.id != idCat || !TraitSalesTag.CanTagSale(t, insideContainer))
2265 {
2266 return false;
2267 }
2268 return true;
2269 }
2270 }
bool isSale
Definition: Card.cs:852
List< Thing > Things
Definition: Point.cs:326
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 2209 of file Zone.cs.

2210 {
2211 foreach (Thing container in EClass._map.props.installed.containers)
2212 {
2213 if (container.IsSharedContainer)
2214 {
2215 Thing thing = container.things.Find(func);
2216 if (thing != null)
2217 {
2218 return thing;
2219 }
2220 }
2221 }
2222 return null;
2223 }

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

2039 : TraitSpot
2040 {
2041 List<T> list = new List<T>();
2042 List<Thing> list2 = new List<Thing>();
2043 foreach (Thing thing in EClass._map.things)
2044 {
2045 if (thing.IsInstalled && thing.trait is T)
2046 {
2047 list.Add(thing.trait as T);
2048 }
2049 }
2050 foreach (T item in list)
2051 {
2052 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2053 {
2054 foreach (Thing thing2 in item2.Things)
2055 {
2056 if (!thing2.IsInstalled)
2057 {
2058 continue;
2059 }
2060 if (thing2.things.Count == 0)
2061 {
2062 if (IsValid(thing2))
2063 {
2064 list2.Add(thing2);
2065 }
2066 continue;
2067 }
2068 foreach (Thing item3 in thing2.things.List((Thing _t) => IsValid(_t)))
2069 {
2070 list2.Add(item3);
2071 }
2072 }
2073 }
2074 }
2075 return list2;
2076 bool IsValid(Thing t)
2077 {
2078 if (func != null && !func(t))
2079 {
2080 return false;
2081 }
2082 return true;
2083 }
2084 }
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 2445 of file Zone.cs.

2446 {
2447 bool flag = EClass.pc.HasCondition<ConDrawBacker>();
2448 if (!EClass.debug.enable && EClass.rnd(flag ? 3 : 20) != 0)
2449 {
2450 return;
2451 }
2452 Point randomSurface = EClass._map.bounds.GetRandomSurface();
2453 if (!randomSurface.IsValid)
2454 {
2455 return;
2456 }
2457 Chara c = CharaGen.Create("follower");
2458 EClass._zone.AddCard(c, randomSurface);
2459 (EClass._zone.AddThing("gallows", randomSurface).Install().trait as TraitShackle).Restrain(c);
2460 c.c_rescueState = RescueState.WaitingForRescue;
2461 if (EClass.rnd(flag ? 1 : 2) == 0 || EClass.debug.enable)
2462 {
2464 if (row != null)
2465 {
2466 c.ApplyBacker(row.id);
2467 }
2468 }
2469 Religion faith = EClass.game.religions.dictAll.Values.Where((Religion a) => a != c.faith).RandomItem();
2470 for (int i = 0; i < 3 + EClass.rnd(4); i++)
2471 {
2472 Chara chara = CharaGen.Create("fanatic");
2473 chara.SetFaith(faith);
2474 Point point = randomSurface.GetRandomPoint(4) ?? randomSurface.GetNearestPoint();
2475 EClass._zone.AddCard(chara, point);
2476 }
2477 }
RescueState
Definition: RescueState.cs:2
static int indexFollower
bool HasCondition(string alias)
Definition: Chara.cs:9054
Religion faith
Definition: Chara.cs:437
void SetFaith(string id)
Definition: Chara.cs:1688
Dictionary< string, Religion > dictAll
List< Row > listFollower
Definition: SourceBacker.cs:82

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

◆ UnloadMap()

void Zone.UnloadMap ( )
inline

Definition at line 1684 of file Zone.cs.

1685 {
1686 map = null;
1687 if (bp != null)
1688 {
1689 bp.map = null;
1690 }
1691 if (branch != null)
1692 {
1694 }
1695 Debug.Log("Unloaded Map:" + this);
1696 }
void OnUnloadMap()

References Debug, and FactionBranch.OnUnloadMap().

Referenced by Activate().

◆ UpdateQuests()

void Zone.UpdateQuests ( bool  force = false)
inline

Definition at line 3481 of file Zone.cs.

3482 {
3483 if (!IsPCFaction && (!(this is Zone_Town) || base.lv != 0))
3484 {
3485 return;
3486 }
3487 Debug.Log("Updating Quest:" + force);
3488 List<SourceQuest.Row> list = EClass.sources.quests.rows.Where((SourceQuest.Row a) => a.group == "random").ToList();
3489 int num = 0;
3490 foreach (Chara item in map.charas.Concat(map.deadCharas))
3491 {
3492 if (item.quest != null && !EClass.game.quests.list.Contains(item.quest))
3493 {
3494 if (item.quest.IsExpired || completedQuests.Contains(item.quest.uid) || force)
3495 {
3496 item.quest = null;
3497 }
3498 else
3499 {
3500 num++;
3501 }
3502 }
3503 }
3504 if (EClass._zone.dateQuest > EClass.world.date.GetRaw() && !force)
3505 {
3506 return;
3507 }
3508 EClass._zone.dateQuest = EClass.world.date.GetRaw() + 1440;
3509 int maxQuest = 3;
3510 Rand.UseSeed(base.uid + EClass.player.stats.days / 7 % 100, delegate
3511 {
3512 maxQuest = 4 + EClass.rnd(4);
3513 });
3514 completedQuests.Clear();
3515 List<Zone> list2 = Quest.ListDeliver();
3516 List<Tuple<string, int>> listTag = new List<Tuple<string, int>>();
3517 string[] array = EClass._zone.source.questTag;
3519 {
3520 array = new string[9] { "supply/8", "deliver/7", "food/8", "escort/4", "deliver/4", "monster/0", "war/0", "farm/0", "music/0" };
3521 }
3522 string[] array2 = array;
3523 for (int i = 0; i < array2.Length; i++)
3524 {
3525 string[] array3 = array2[i].Split('/');
3526 listTag.Add(new Tuple<string, int>(array3[0], array3[1].ToInt()));
3527 }
3528 for (int j = 0; j < map.charas.Count * 2; j++)
3529 {
3530 if (num > maxQuest)
3531 {
3532 break;
3533 }
3534 if (num > 15)
3535 {
3536 break;
3537 }
3538 Chara chara = map.charas.RandomItem();
3539 if (!chara.trait.CanGiveRandomQuest || chara.isSubsetCard || chara.homeZone != EClass._zone || chara.IsGuest() || chara.memberType == FactionMemberType.Livestock || (chara.quest != null && !force))
3540 {
3541 continue;
3542 }
3543 SourceQuest.Row row = list.RandomItemWeighted(delegate(SourceQuest.Row a)
3544 {
3545 int num2 = 1;
3546 foreach (Tuple<string, int> item2 in listTag)
3547 {
3548 if (a.tags.Contains(item2.Item1))
3549 {
3550 num2 = item2.Item2;
3551 break;
3552 }
3553 }
3554 if (!EClass._zone.IsPCFaction && a.tags.Contains("bulk"))
3555 {
3556 num2 = 0;
3557 }
3558 return a.chance * num2;
3559 });
3560 if ((!row.tags.Contains("needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame < EClass.player.fame || EClass.debug.enable))
3561 {
3562 Quest.Create(row.id, null, chara);
3563 num++;
3564 }
3565 }
3566 }
QuestManager quests
Definition: Game.cs:179
int days
Definition: Player.cs:75
int fame
Definition: Player.cs:840
List< Quest > list
Definition: QuestManager.cs:11
Definition: Quest.cs:7
static List< Zone > ListDeliver()
Definition: Quest.cs:259
static Quest Create(string _id, string _idPerson=null, Chara c=null)
Definition: Quest.cs:241
static void UseSeed(int seed, Action action)
Definition: Rand.cs:22
SourceQuest quests
string[] tags
Definition: SourceQuest.cs:22
int dateQuest
Definition: Spatial.cs:286
SourceZone.Row source
Definition: Spatial.cs:441
virtual bool CanGiveRandomQuest
Definition: TraitChara.cs:116
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(), 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 3151 of file Zone.cs.

3152 {
3153 }

Member Data Documentation

◆ _biome

BiomeProfile Zone._biome

Definition at line 76 of file Zone.cs.

◆ bounds

◆ bp

ZoneBlueprint Zone.bp

Definition at line 64 of file Zone.cs.

Referenced by Activate().

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

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

◆ dirtyElectricity

bool Zone.dirtyElectricity

Definition at line 68 of file Zone.cs.

Referenced by Scene.OnUpdate().

◆ elements

◆ events

◆ fileVariation

int Zone.fileVariation

Definition at line 66 of file Zone.cs.

◆ forceRegenerate

bool Zone.forceRegenerate
static

Definition at line 25 of file Zone.cs.

Referenced by Activate().

◆ forceSubset

string Zone.forceSubset
static

Definition at line 27 of file Zone.cs.

Referenced by Activate().

◆ fortuneRoll

FortuneRollData Zone.fortuneRoll
private

Definition at line 58 of file Zone.cs.

◆ ignoreSpawnAnime

bool Zone.ignoreSpawnAnime
static

Definition at line 78 of file Zone.cs.

◆ instance

◆ isSimulating

bool Zone.isSimulating

Definition at line 72 of file Zone.cs.

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

◆ isStarted

◆ landFeats

List<int> Zone.landFeats

Definition at line 55 of file Zone.cs.

◆ map

◆ okaerinko

int Zone.okaerinko = 0
static

Definition at line 31 of file Zone.cs.

Referenced by AI_Idle.Run().

◆ sourceHat

CardRow Zone.sourceHat
static

Definition at line 29 of file Zone.cs.

Referenced by CharaRenderer.Draw().

◆ subset

MapSubset Zone.subset

Definition at line 62 of file Zone.cs.

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

◆ Suckers

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

Definition at line 80 of file Zone.cs.

Referenced by TraitSeed.TrySprout().

◆ tempDist

int Zone.tempDist

Definition at line 74 of file Zone.cs.

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

Property Documentation

◆ AddPrefix

virtual bool Zone.AddPrefix
get

Definition at line 278 of file Zone.cs.

Referenced by OnAfterCreate().

◆ AllowCriminal

virtual bool Zone.AllowCriminal
get

Definition at line 242 of file Zone.cs.

◆ AllowInvest

virtual bool Zone.AllowInvest
get

Definition at line 244 of file Zone.cs.

245 {
246 get
247 {
248 if (!IsTown && !IsPCFaction)
249 {
250 return Guild.GetCurrentGuild() != null;
251 }
252 return true;
253 }
254 }

Referenced by DramaCustomSequence.Build().

◆ AllowNewZone

virtual bool Zone.AllowNewZone
get

Definition at line 256 of file Zone.cs.

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

◆ AlwaysLowblock

virtual bool Zone.AlwaysLowblock
get

Definition at line 390 of file Zone.cs.

Referenced by BaseTileMap.Draw().

◆ BaseElectricity

virtual int Zone.BaseElectricity
get

Definition at line 488 of file Zone.cs.

◆ BigDaddyChance

virtual float Zone.BigDaddyChance
get

Definition at line 316 of file Zone.cs.

◆ biome

◆ BlockBorderExit

virtual bool Zone.BlockBorderExit
get

Definition at line 166 of file Zone.cs.

Referenced by Player.CanExitBorder().

◆ Boss

Chara Zone.Boss
getset

Definition at line 82 of file Zone.cs.

83 {
84 get
85 {
86 return EClass._map.FindChara(base.uidBoss);
87 }
88 set
89 {
90 base.uidBoss = value?.uid ?? 0;
91 }
92 }
Chara FindChara(string id)
Definition: Map.cs:2568

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

◆ CanBeDeliverDestination

virtual bool Zone.CanBeDeliverDestination
get

Definition at line 222 of file Zone.cs.

Referenced by Quest.ListDeliver().

◆ CanDigUnderground

virtual bool Zone.CanDigUnderground
get

Definition at line 268 of file Zone.cs.

Referenced by TaskMine.GetHitResult().

◆ CanEnterBuildMode

bool Zone.CanEnterBuildMode
get

Definition at line 440 of file Zone.cs.

441 {
442 get
443 {
445 {
446 return base.mainFaction == EClass.pc.faction;
447 }
448 return true;
449 }
450 }
bool godBuild
Definition: CoreDebug.cs:304
bool ignoreBuildRule
Definition: CoreDebug.cs:185

◆ CanEnterBuildModeAnywhere

bool Zone.CanEnterBuildModeAnywhere
get

Definition at line 452 of file Zone.cs.

453 {
454 get
455 {
457 {
458 if (base.mainFaction == EClass.pc.faction)
459 {
460 return EClass.Branch.elements.Has(4003);
461 }
462 return false;
463 }
464 return true;
465 }
466 }
bool Has(int ele)
ElementContainerZone elements

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

◆ CanInspect

bool Zone.CanInspect
get

Implements IInspect.

Definition at line 492 of file Zone.cs.

493 {
494 get
495 {
496 if (!IsInstance)
497 {
498 return !HiddenInRegionMap;
499 }
500 return false;
501 }
502 }
virtual bool HiddenInRegionMap
Definition: Zone.cs:408

◆ CanUnlockExit

virtual bool Zone.CanUnlockExit
get

Definition at line 272 of file Zone.cs.

Referenced by TraitStairsLocked.OnUse().

◆ ChanceSpawnNeutral

virtual float Zone.ChanceSpawnNeutral
get

Definition at line 340 of file Zone.cs.

◆ ContentLv

override int Zone.ContentLv
get

Definition at line 94 of file Zone.cs.

95 {
96 get
97 {
98 if (branch == null)
99 {
100 return DangerLv;
101 }
102 return branch.ContentLV;
103 }
104 }

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

◆ CountDeepestLevel

virtual bool Zone.CountDeepestLevel
get

Definition at line 224 of file Zone.cs.

◆ DangerLv

◆ DefaultActionMode

virtual ActionMode Zone.DefaultActionMode
get

Definition at line 164 of file Zone.cs.

◆ DisableRooms

virtual bool Zone.DisableRooms
get

Definition at line 118 of file Zone.cs.

Referenced by Map.TryAddRoom().

◆ EvolvedChance

virtual float Zone.EvolvedChance
get

Definition at line 318 of file Zone.cs.

◆ ExpireDays

virtual int Zone.ExpireDays
get

Definition at line 168 of file Zone.cs.

Referenced by Activate().

◆ FeatureType

virtual ZoneFeatureType Zone.FeatureType
get

Definition at line 172 of file Zone.cs.

◆ FlockType

virtual FlockController.SpawnType Zone.FlockType
get

Definition at line 410 of file Zone.cs.

Referenced by Scene.Init().

◆ Generator

MapGenerator Zone.Generator
get

Definition at line 134 of file Zone.cs.

Referenced by MapGenDungen.OnGenerateTerrain().

◆ GrowPlant

virtual bool Zone.GrowPlant
get

Definition at line 342 of file Zone.cs.

◆ GrowWeed

virtual bool Zone.GrowWeed
get

Definition at line 344 of file Zone.cs.

◆ HasLaw

virtual bool Zone.HasLaw
get

Definition at line 226 of file Zone.cs.

Referenced by Chara.Die(), QuestManager.HasFarAwayEscort(), and WidgetSearch.Search().

◆ HiddenInRegionMap

virtual bool Zone.HiddenInRegionMap
get

Definition at line 408 of file Zone.cs.

Referenced by Chara._Move().

◆ HourSinceLastActive

int Zone.HourSinceLastActive
get

Definition at line 120 of file Zone.cs.

◆ IDAmbience

virtual string Zone.IDAmbience
get

Definition at line 174 of file Zone.cs.

175 {
176 get
177 {
178 if (!IsRegion && !map.IsIndoor)
179 {
180 if (!IsTown)
181 {
182 return "forest";
183 }
184 return "town";
185 }
186 return null;
187 }
188 }

◆ IDBaseLandFeat

virtual string Zone.IDBaseLandFeat
get

Definition at line 144 of file Zone.cs.

◆ IdBiome

virtual string Zone.IdBiome
get

Definition at line 128 of file Zone.cs.

◆ idExport

virtual string Zone.idExport
get

Definition at line 146 of file Zone.cs.

147 {
148 get
149 {
150 if (base.source.idFile.Length != 0)
151 {
152 return base.source.idFile[fileVariation] + ((base.lv == 0) ? "" : ("_F" + base.lv));
153 }
154 return "";
155 }
156 }
int fileVariation
Definition: Zone.cs:66

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

◆ IDGenerator

virtual string Zone.IDGenerator
get

Definition at line 130 of file Zone.cs.

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

◆ IDHat

virtual string Zone.IDHat
get

Definition at line 142 of file Zone.cs.

◆ IDPlayList

virtual string Zone.IDPlayList
get

Definition at line 138 of file Zone.cs.

◆ IDPlaylistOverwrite

virtual string Zone.IDPlaylistOverwrite
get

Definition at line 140 of file Zone.cs.

◆ IdProfile

virtual string Zone.IdProfile
get

Definition at line 136 of file Zone.cs.

◆ IDSceneTemplate

virtual string Zone.IDSceneTemplate
get

Definition at line 190 of file Zone.cs.

191 {
192 get
193 {
194 if (!EClass._map.IsIndoor)
195 {
196 if (!IsSnowZone)
197 {
198 return "Default";
199 }
200 return "Snow";
201 }
202 return "Indoor";
203 }
204 }
virtual bool IsSnowZone
Definition: Spatial.cs:530

Referenced by BaseGameScreen.RefreshGrading().

◆ IDSubset

virtual string Zone.IDSubset
get

Definition at line 208 of file Zone.cs.

209 {
210 get
211 {
212 if (!IsFestival)
213 {
214 return null;
215 }
216 return "festival";
217 }
218 }
virtual bool IsFestival
Definition: Zone.cs:206

Referenced by Activate().

◆ InspectName

string Zone.InspectName
get

Implements IInspect.

Definition at line 504 of file Zone.cs.

◆ InspectPoint

Point Zone.InspectPoint
get

Implements IInspect.

Definition at line 506 of file Zone.cs.

◆ InspectPosition

Vector3 Zone.InspectPosition
get

Implements IInspect.

Definition at line 508 of file Zone.cs.

◆ IsActiveZone

◆ IsExplorable

virtual bool Zone.IsExplorable
get

Definition at line 346 of file Zone.cs.

◆ IsFestival

virtual bool Zone.IsFestival
get

◆ IsInstance

◆ IsLoaded

bool Zone.IsLoaded
get

Definition at line 486 of file Zone.cs.

Referenced by Activate().

◆ IsNefia

virtual bool Zone.IsNefia
get

Definition at line 280 of file Zone.cs.

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

◆ IsPCFaction

bool Zone.IsPCFaction
get

Definition at line 468 of file Zone.cs.

Referenced by Chara._Move(), WidgetDate._Refresh(), Map._ValidateInstalled(), Activate(), LayerSleep.Advance(), WidgetStatsBar.Build(), DramaCustomSequence.Build(), Chara.CanDestroyPath(), ActRestrain.CanPerform(), QuestVernis.CanUpdateOnTalk(), TraitGeneratorWheel.CanUse(), TraitLoytelMart.CanUse(), TraitMannequin.CanUse(), TraitShackle.CanUse(), GameLang.ConvertDrama(), Faction.CountWealth(), Card.Create(), ActEffect.DamageEle(), Chara.DoHostileAction(), BaseTileMap.DrawTile(), CoreDebug.Fix_LostCore(), RankedZone.GetFactionName(), TaskBuild.GetHitResult(), TaskDig.GetHitResult(), Card.GetPrice(), Chara.GetRevived(), Chara.HasAccess(), QuestManager.HasFarAwayEscort(), TraitFoodEggFertilized.Incubate(), Quest.IsVisibleOnQuestBoard(), Quest.ListDeliver(), QuestDeliver.ListDestThing(), Props.ListThingStack(), Chara.MoveZone(), Region.OnActivate(), TraitHitchingPost.OnActivateTrap(), QuestRandom.OnDropReward(), Player.Flags.OnEnterZone(), LayerQuestBoard.OnInit(), ElementContainerZone.OnLevelUp(), TraitBlueprint.OnRead(), TraitBookSkill.OnRead(), TraitDeedRelocate.OnRead(), AM_Adv.OnRenderTile(), GoalSleep.OnSimulatePosition(), TraitFloorSwitch.OnStepped(), TraitBookResident.OnUse(), TraitFarmChest.OnUse(), TraitPolicyBoard.OnUse(), ActRestrain.Perform(), ActEffect.Proc(), Map.PutAway(), TraitBaseSpellbook.ReadFailEffect(), ContentHomeRanking.Refresh(), TCOrbitChara.RefreshAll(), UIInventory.RefreshMenu(), ContentFaction.RefreshZones(), AI_Eat.Run(), AI_Idle.Run(), WidgetSearch.Search(), Card.SetPlaceState(), UIFactionInfo.SetZone(), TraitTicketFurniture.SetZone(), TraitGeneratorWheel.ShouldWork(), Card.SpawnLoot(), Chara.Tick(), TaskDump.TryPerform(), TraitBed.TrySetAct(), TraitBuildBoard.TrySetAct(), TraitCoreZone.TrySetAct(), TraitCrafter.TrySetAct(), TraitFactionBoard.TrySetAct(), TraitHomeBoard.TrySetAct(), TraitHouseBoard.TrySetAct(), TraitMapBoard.TrySetAct(), TraitPaintBoard.TrySetAct(), TraitResearchBoard.TrySetAct(), TraitResidentBoard.TrySetAct(), TraitRoomPlate.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

bool Zone.IsPCFactionOrTent
get

Definition at line 470 of file Zone.cs.

471 {
472 get
473 {
474 if (base.mainFaction != EClass.pc.faction)
475 {
476 return EClass._zone is Zone_Tent;
477 }
478 return true;
479 }
480 }

Referenced by HotItemHeld.CanRotate(), TaskBuild.CanRotateBlock(), TaskBuild.GetHitResult(), TraitSeed.MakeSeed(), BiomeProfile.ClusterObj.TryCreate(), and TraitSpotBiome.Update().

◆ IsReturnLocation

virtual bool Zone.IsReturnLocation
get

Definition at line 348 of file Zone.cs.

349 {
350 get
351 {
352 if (EClass.pc.homeZone != this)
353 {
354 return base.source.tag.Contains("return");
355 }
356 return true;
357 }
358 }

◆ IsSkyLevel

◆ IsStartZone

bool Zone.IsStartZone
get

Definition at line 482 of file Zone.cs.

◆ IsTown

◆ IsUnderwater

◆ IsUserZone

◆ KeepAllyDistance

virtual bool Zone.KeepAllyDistance
get

Definition at line 296 of file Zone.cs.

297 {
298 get
299 {
300 if (!HasLaw)
301 {
302 return IsPCFaction;
303 }
304 return true;
305 }
306 }

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

◆ LockExit

virtual bool Zone.LockExit
get

Definition at line 270 of file Zone.cs.

Referenced by MapGenDungen.OnGenerateTerrain().

◆ MakeEnemiesNeutral

virtual bool Zone.MakeEnemiesNeutral
get

Definition at line 228 of file Zone.cs.

229 {
230 get
231 {
232 if (!IsTown)
233 {
234 return HasLaw;
235 }
236 return true;
237 }
238 }

◆ MakeTownProperties

virtual bool Zone.MakeTownProperties
get

Definition at line 240 of file Zone.cs.

◆ MaxLv

virtual int Zone.MaxLv
get

Definition at line 274 of file Zone.cs.

◆ MaxRespawn

int Zone.MaxRespawn
get

Definition at line 310 of file Zone.cs.

◆ MaxSoil

virtual int Zone.MaxSoil
get

Definition at line 510 of file Zone.cs.

511 {
512 get
513 {
514 if (branch == null)
515 {
516 return 99999;
517 }
518 return branch.MaxSoil;
519 }
520 }

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

◆ MaxSpawn

virtual int Zone.MaxSpawn
get

Definition at line 308 of file Zone.cs.

◆ MinLv

virtual int Zone.MinLv
get

Definition at line 276 of file Zone.cs.

◆ MinsSinceLastActive

int Zone.MinsSinceLastActive
get

Definition at line 122 of file Zone.cs.

◆ NameSuffix

override string Zone.NameSuffix
get

Definition at line 412 of file Zone.cs.

413 {
414 get
415 {
416 if (!IsNefia || !GetTopZone().isConquered)
417 {
418 return "";
419 }
420 return "conquered".lang();
421 }
422 }

◆ NameWithLevel

string Zone.NameWithLevel
get

◆ OreChance

virtual float Zone.OreChance
get

Definition at line 314 of file Zone.cs.

◆ ParentZone

◆ pathExport

virtual string Zone.pathExport
get

Definition at line 124 of file Zone.cs.

Referenced by Activate().

◆ pathTemp

string Zone.pathTemp
get

Definition at line 158 of file Zone.cs.

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

◆ PetFollow

virtual bool Zone.PetFollow
get

Definition at line 282 of file Zone.cs.

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

◆ PrespawnRate

virtual float Zone.PrespawnRate
get

Definition at line 322 of file Zone.cs.

◆ RegenerateOnEnter

virtual bool Zone.RegenerateOnEnter
get

Definition at line 260 of file Zone.cs.

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

◆ Region

◆ RegionEnterState

virtual ZoneTransition.EnterState Zone.RegionEnterState
get

Definition at line 170 of file Zone.cs.

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

◆ RespawnPerHour

virtual int Zone.RespawnPerHour
get

Definition at line 338 of file Zone.cs.

◆ RespawnRate

virtual float Zone.RespawnRate
get

Definition at line 324 of file Zone.cs.

◆ RestrictBuild

virtual bool Zone.RestrictBuild
get

Definition at line 284 of file Zone.cs.

285 {
286 get
287 {
288 if (this is Zone_Civilized)
289 {
290 return !IsPCFaction;
291 }
292 return false;
293 }
294 }

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

◆ RevealRoom

virtual bool Zone.RevealRoom
get

Definition at line 388 of file Zone.cs.

◆ RuinChance

virtual float Zone.RuinChance
get

Definition at line 312 of file Zone.cs.

Referenced by GenBounds.TryAddMapPiece().

◆ ScaleType

virtual ZoneScaleType Zone.ScaleType
get

Definition at line 406 of file Zone.cs.

◆ ShouldAutoRevive

virtual bool Zone.ShouldAutoRevive
get

Definition at line 374 of file Zone.cs.

375 {
376 get
377 {
378 if (!ShouldRegenerate)
379 {
380 return IsPCFaction;
381 }
382 return true;
383 }
384 }

◆ ShouldMakeExit

virtual bool Zone.ShouldMakeExit
get

Definition at line 360 of file Zone.cs.

361 {
362 get
363 {
364 if (base.lv > MinLv)
365 {
366 return base.lv < MaxLv;
367 }
368 return false;
369 }
370 }
virtual int MaxLv
Definition: Zone.cs:274
virtual int MinLv
Definition: Zone.cs:276

Referenced by MapGenDungen.OnGenerateTerrain().

◆ ShouldRegenerate

virtual bool Zone.ShouldRegenerate
get

Definition at line 372 of file Zone.cs.

Referenced by Activate().

◆ ShowEnemyOnMinimap

bool Zone.ShowEnemyOnMinimap
get

Definition at line 326 of file Zone.cs.

327 {
328 get
329 {
330 if (instance != null)
331 {
333 }
334 return false;
335 }
336 }
virtual bool ShowEnemyOnMinimap
Definition: ZoneInstance.cs:30

Referenced by WidgetMinimap.RefreshMarkers().

◆ ShrineChance

virtual float Zone.ShrineChance
get

Definition at line 320 of file Zone.cs.

◆ StartLV

virtual int Zone.StartLV
get

Definition at line 404 of file Zone.cs.

Referenced by OnCreate().

◆ TextDangerLv

string Zone.TextDangerLv
get

Definition at line 426 of file Zone.cs.

Referenced by WidgetDate._Refresh().

◆ TextDeepestLv

string Zone.TextDeepestLv
get

Definition at line 428 of file Zone.cs.

429 {
430 get
431 {
432 if (GetDeepestLv() != 0)
433 {
434 return "zoneLevelMax".lang(TextLevel(GetDeepestLv()));
435 }
436 return "";
437 }
438 }
string TextLevel(int _lv)
Definition: Zone.cs:552

Referenced by AM_Adv._OnUpdateInput().

◆ TextWidgetDate

virtual string Zone.TextWidgetDate
get

Definition at line 132 of file Zone.cs.

Referenced by WidgetDate._Refresh().

◆ UseFog

virtual bool Zone.UseFog
get

Definition at line 386 of file Zone.cs.

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

◆ UseLight

virtual bool Zone.UseLight
get

Definition at line 392 of file Zone.cs.

393 {
394 get
395 {
396 if (base.mainFaction != EClass.pc.faction)
397 {
398 return base.source.tag.Contains("light");
399 }
400 return true;
401 }
402 }

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

◆ WillAutoSave

virtual bool Zone.WillAutoSave
get

Definition at line 258 of file Zone.cs.

Referenced by Chara.MoveZone().


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