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

Classes

class  PortalReturnData
 

Public Member Functions

int Evalue (int ele)
 
int Evalue (string alias)
 
virtual string GetDungenID ()
 
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)
 
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)
 
Card 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 (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 bool ScaleMonsterLevel [get]
 
virtual bool HiddenInRegionMap [get]
 
virtual FlockController.SpawnType FlockType [get]
 
override string NameSuffix [get]
 
string NameWithLevel [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 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 1785 of file Zone.cs.

1786 {
1787 if (CanDestroy())
1788 {
1789 Debug.Log("Deleting Zone:" + this);
1790 if (!destryoed)
1791 {
1792 Destroy();
1793 }
1794 }
1795 else if (map != null)
1796 {
1797 Debug.Log("Saving Zone:" + this);
1798 map.Save(base.pathSave);
1799 if (!base.isMapSaved)
1800 {
1801 base.isMapSaved = true;
1802 IO.DeleteDirectory(base.pathSave + "Texture Replace");
1803 IO.CopyDir(pathTemp + "Texture Replace", base.pathSave + "/Texture Replace");
1804 }
1805 if (!IsActiveZone)
1806 {
1807 UnloadMap();
1808 }
1809 }
1810 }
Definition: IO.cs:11
static void DeleteDirectory(string path)
Definition: IO.cs:341
static void CopyDir(string sourceDirectory, string targetDirectory, Func< string, bool > funcExclude=null)
Definition: IO.cs:233
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:1743
override void Destroy()
Definition: Zone.cs:1821
bool IsActiveZone
Definition: Zone.cs:488
void UnloadMap()
Definition: Zone.cs:1662
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 1727 of file Zone.cs.

1728 {
1729 FactionBranch destBranch = ((EClass.pc.homeBranch == branch) ? EClass.game.StartZone.branch : EClass.pc.homeBranch);
1730 branch.members.ForeachReverse(delegate(Chara m)
1731 {
1732 destBranch.AddMemeber(m);
1733 if (!m.IsPCParty)
1734 {
1735 m.MoveZone(destBranch.owner);
1736 }
1737 });
1739 SetMainFaction(null);
1740 base.dateExpire = EClass.world.date.GetRaw() + 10080;
1741 }
Definition: Chara.cs:10
override bool IsPCParty
Definition: Chara.cs:611
FactionBranch homeBranch
Definition: Chara.cs:932
void MoveZone(string alias)
Definition: Chara.cs:3094
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:269
virtual void SetMainFaction(Faction f)
Definition: Spatial.cs:632
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 579 of file Zone.cs.

580 {
581 if (IsRegion)
582 {
584 }
585 isStarted = (isSimulating = false);
586 base.isKnown = true;
587 EClass.game.config.reverseSnow = false;
589 {
590 Msg.Say("regenerateZone", Name);
591 ClearZones();
592 if (EClass.pc.global.transition != null)
593 {
594 EClass.pc.global.transition.uidLastZone = 0;
595 }
596 }
598 if (EClass.game.activeZone != null)
599 {
601 }
602 EClass.game.activeZone = this;
603 ZoneExportData zoneExportData = null;
604 Debug.Log(NameWithLevel + "/" + id + "/" + base.uid + "/" + base.isGenerated + "/" + IsLoaded + "/" + File.Exists(base.pathSave + "map"));
605 if (base.isGenerated && !IsLoaded && !File.Exists(base.pathSave + "map"))
606 {
607 Debug.Log("(Bug) File does not exist:" + destryoed + "/" + base.pathSave);
608 base.isGenerated = false;
609 }
610 bool flag = false;
611 Debug.Log(idCurrentSubset + "/" + IDSubset);
612 bool flag2 = idCurrentSubset != IDSubset || forceSubset != null;
613 if (flag2 && map != null)
614 {
615 UnloadMap();
616 }
617 Debug.Log(idExport + "/" + File.Exists(pathExport) + "/" + pathExport);
618 if (!base.isGenerated && (idExport.IsEmpty() || !File.Exists(pathExport)))
619 {
620 Debug.Log("generating random map");
621 flag = true;
622 base.dateExpire = EClass.world.date.GetRaw() + 1440 * ExpireDays;
623 Generate();
625 if (instance != null)
626 {
628 }
629 if (!UseFog)
630 {
631 map.ForeachCell(delegate(Cell c)
632 {
633 c.isSeen = true;
634 });
635 }
636 if (!(bp is GameBlueprint))
637 {
639 }
640 }
641 else if (IsLoaded)
642 {
643 Debug.Log("zone is already loaded");
644 map.SetZone(this);
645 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
647 }
648 else
649 {
650 subset = null;
651 bool flag3 = (base.isGenerated && flag2) || (base.isGenerated && !IsInstance && !IsPCFaction && ShouldRegenerate && EClass.world.date.IsExpired(base.dateRegenerate)) || forceRegenerate;
652 if (pathExport.IsEmpty() || !File.Exists(pathExport) || EClass.game.isLoading || EClass.player.simulatingZone)
653 {
654 flag3 = false;
655 flag2 = false;
656 }
657 Debug.Log(base.isGenerated + "/" + flag3 + "/" + flag2 + "/" + IDSubset);
658 if (!base.isGenerated || flag3 || flag2)
659 {
660 Debug.Log("importing map:" + pathExport);
661 flag = true;
662 base.dateRegenerate = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRegenerateZone;
663 if (!flag3)
664 {
665 IO.DeleteDirectory(pathTemp + "Texture Replace");
666 Debug.Log(pathTemp);
667 }
668 zoneExportData = Import(pathExport);
669 base.isGenerated = true;
670 isImported = true;
671 if (flag3)
672 {
673 zoneExportData.orgMap = GameIO.LoadFile<Map>(base.pathSave + "map");
674 }
675 }
677 Debug.Log("loading map: imported? " + isImported + " regenerate? " + flag3);
678 map = GameIO.LoadFile<Map>((isImported ? pathTemp : base.pathSave) + "map");
679 if (map == null)
680 {
681 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");
682 return;
683 }
684 map.SetZone(this);
685 map.Load(isImported ? pathTemp : base.pathSave, isImported);
687 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : pathTemp);
688 if (isImported)
689 {
690 map.deadCharas.Clear();
691 map.OnImport(zoneExportData);
692 if (UseFog && !flag3)
693 {
694 map.ForeachCell(delegate(Cell c)
695 {
696 c.isSeen = false;
697 });
698 }
699 if (zoneExportData.orgMap != null)
700 {
701 Map orgMap = zoneExportData.orgMap;
702 List<Chara> serializedCharas = map.serializedCharas;
703 map.charas = orgMap.charas;
704 map.serializedCharas = orgMap.serializedCharas;
705 map.deadCharas = orgMap.deadCharas;
706 byte[] array = orgMap.TryLoadFile(base.pathSave, "flags", EClass._map.Size * EClass._map.Size);
707 if (array != null && array.Length == EClass._map.Size * EClass._map.Size)
708 {
709 for (int i = 0; i < EClass._map.Size; i++)
710 {
711 for (int j = 0; j < EClass._map.Size; j++)
712 {
713 map.cells[i, j].isSeen = array[i * EClass._map.Size + j].GetBit(1);
714 }
715 }
716 }
717 foreach (Chara item in serializedCharas)
718 {
719 Debug.Log("Importing New Chara:" + item.id + "/" + item.Name + "/" + item.orgPos);
721 }
722 map.things.ForeachReverse(delegate(Thing t)
723 {
724 if (t.trait is TraitNewZone || t.trait is TraitPowerStatue)
725 {
726 foreach (Thing thing in orgMap.things)
727 {
728 if (t.id == thing.id && t.pos.Equals(thing.pos))
729 {
730 if (t.trait is TraitNewZone)
731 {
732 RemoveCard(t);
733 map.things.Insert(0, thing);
734 thing.stackOrder = 0;
735 }
736 else
737 {
738 t.ChangeMaterial(thing.material);
739 t.isOn = thing.isOn;
740 }
741 break;
742 }
743 }
744 return;
745 }
746 if (t.trait is TraitStairsLocked)
747 {
748 foreach (Thing thing2 in orgMap.things)
749 {
750 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
751 {
752 RemoveCard(t);
753 map.things.Add(thing2);
754 break;
755 }
756 }
757 return;
758 }
759 if (t.id == "medal" || t.id == "856")
760 {
761 foreach (Thing thing3 in orgMap.things)
762 {
763 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
764 {
765 return;
766 }
767 }
768 RemoveCard(t);
769 }
770 });
771 foreach (KeyValuePair<int, int> item2 in EClass._map.backerObjs.ToList())
772 {
773 EClass._map.GetCell(item2.Key);
774 SourceBacker.Row row = EClass.sources.backers.map[item2.Value];
776 {
777 map.backerObjs.Remove(item2.Key);
778 }
779 }
780 foreach (Chara serializedChara in map.serializedCharas)
781 {
782 if (serializedChara.orgPos != null && serializedChara.orgPos.IsValid)
783 {
784 serializedChara.pos.Set(serializedChara.orgPos);
785 }
786 }
787 foreach (Thing thing4 in orgMap.things)
788 {
789 if (thing4.trait is TraitTent && !thing4.isNPCProperty)
790 {
791 thing4.AddEditorTag(EditorTag.NoNpcProperty);
792 thing4.isSubsetCard = false;
793 map.things.Add(thing4);
794 Debug.Log(thing4);
795 }
796 }
797 }
798 }
799 foreach (Thing thing5 in map.things)
800 {
801 map.AddCardOnActivate(thing5);
802 }
803 foreach (Chara c3 in map.serializedCharas)
804 {
805 if (c3.c_uidMaster == 0 || EClass.player.listSummon.Find((Chara c2) => c2.uid == c3.uid) == null)
806 {
807 map.charas.Add(c3);
809 }
810 }
811 map.serializedCharas.Clear();
812 if (isImported && IsTown)
813 {
815 }
818 map.OnLoad();
819 if (flag3)
820 {
821 foreach (Card item3 in map.Cards.ToList())
822 {
823 if (item3.isSubsetCard)
824 {
825 item3.Destroy();
826 }
827 }
828 }
829 if (isImported)
830 {
832 if (idCurrentSubset != null)
833 {
835 subset.Apply();
836 }
837 }
838 if (isImported)
839 {
841 {
842 foreach (Thing thing6 in map.things)
843 {
844 thing6.isNPCProperty = !thing6.isHidden && !thing6.HasEditorTag(EditorTag.NoNpcProperty);
845 }
846 }
847 else
848 {
849 foreach (Thing thing7 in map.things)
850 {
851 thing7.isNPCProperty = false;
852 }
853 }
855 if (instance != null)
856 {
858 }
859 }
860 if (isImported && !flag3 && !RevealRoom)
861 {
862 foreach (Room item4 in map.rooms.listRoom)
863 {
864 if (!item4.HasRoof || item4.data.atrium)
865 {
866 continue;
867 }
868 foreach (Point point2 in item4.points)
869 {
870 point2.cell.isSeen = false;
871 }
872 }
873 }
874 if (flag3)
875 {
876 OnRegenerate();
877 }
878 }
879 PathManager.Instance._pathfinder.PunishChangeDirection = false;
880 isImported = false;
881 if (flag && IsTown && base.lv == 0)
882 {
884 }
885 if (base.visitCount == 0)
886 {
887 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
888 }
889 map.ForeachCell(delegate(Cell c)
890 {
891 if (c.HasFire)
892 {
893 map.effectManager.GetOrCreate(c.GetSharedPoint());
894 }
895 if (IsRegion)
896 {
897 c.decal = 0;
898 }
899 });
901 {
902 RainWater();
903 }
905 {
906 map.ForeachCell(delegate(Cell c)
907 {
908 c.isSeen = true;
909 });
910 }
911 isStarted = true;
912 Map.isDirtySunMap = true;
914 if (events.listPreEnter.Count > 0)
915 {
916 foreach (ZonePreEnterEvent item5 in events.listPreEnter)
917 {
918 item5.Execute();
919 }
920 events.listPreEnter.Clear();
921 }
922 foreach (Card card in map.Cards)
923 {
924 card.CalculateFOV();
925 if (card.isChara)
926 {
927 Chara chara = card.Chara;
928 chara.dirtySpeed = true;
929 if (!card.isDyed && card.HasTag(CTAG.random_color))
930 {
931 card.DyeRandom();
932 }
933 if (card.IsUnique && !card.IsPCFaction && !card.IsPCParty)
934 {
935 Point point = chara.orgPos ?? card.pos;
936 card.c_uniqueData = new UniqueData
937 {
938 x = point.x,
939 y = point.z,
940 uidZone = base.uid
941 };
942 }
943 int @int = card.GetInt(55);
944 if (@int != 0)
945 {
946 foreach (Chara chara2 in map.charas)
947 {
948 if (chara2.uid == @int)
949 {
950 if (chara.IsHostile(chara2))
951 {
952 chara.enemy = chara2;
953 chara.SetAI(new GoalCombat());
954 chara.calmCheckTurn = 20 + EClass.rnd(30);
955 }
956 break;
957 }
958 }
959 card.SetInt(55);
960 }
961 chara.SyncRide();
962 if (card.c_uidMaster != 0 && chara.master == null)
963 {
964 chara.FindMaster();
965 }
966 if (!EClass.game.isLoading)
967 {
968 chara.enemy = null;
969 if (chara.IsInCombat)
970 {
971 chara.SetNoGoal();
972 }
973 }
974 }
975 else if (card.IsInstalled && card.trait is TraitDoor traitDoor && card.pos.HasChara && !traitDoor.IsOpen())
976 {
977 traitDoor.ToggleDoor(sound: false, refresh: false);
978 }
979 }
980 RefreshHat();
981 forceRegenerate = false;
982 forceSubset = null;
983 EClass.ui.OnActivateZone();
985 EClass.Sound.LoadAmbience(IDAmbience);
986 if (EClass.Branch != null)
987 {
989 }
990 OnVisit();
991 if (flag)
992 {
994 }
996 if (IsPCFaction)
997 {
998 EClass.player.uidLastTown = 0;
999 }
1000 else if (IsTown && base.lv == 0)
1001 {
1002 EClass.player.uidLastTown = base.uid;
1003 }
1004 RefreshBGM();
1005 Rand.InitBytes(map.seed + 1);
1007 okaerinko = 0;
1008 if (EClass.debug.enable)
1009 {
1010 ModInfluence(2000);
1011 }
1012 if (this is Zone_TinkerCamp)
1013 {
1014 Tutorial.Reserve("tinker");
1015 }
1016 else if (this is Zone_Town && !(this is Zone_SubTown))
1017 {
1018 Tutorial.Reserve("town");
1019 }
1020 }
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:31
bool isNPCProperty
Definition: Card.cs:538
bool isSubsetCard
Definition: Card.cs:730
int c_uidMaster
Definition: Card.cs:1409
void AddEditorTag(EditorTag tag)
Definition: Card.cs:2541
Point pos
Definition: Card.cs:55
int uid
Definition: Card.cs:118
Trait trait
Definition: Card.cs:49
void Destroy()
Definition: Card.cs:4783
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2536
Definition: Cell.cs:7
bool isSeen
Definition: Cell.cs:282
bool HasFire
Definition: Cell.cs:676
AIAct SetNoGoal()
Definition: Chara.cs:8184
bool IsInCombat
Definition: Chara.cs:860
AIAct SetAI(AIAct g)
Definition: Chara.cs:8189
Point orgPos
Definition: Chara.cs:21
GlobalData global
Definition: Chara.cs:76
Chara master
Definition: Chara.cs:88
Chara FindMaster()
Definition: Chara.cs:2161
void SyncRide()
Definition: Chara.cs:3655
bool IsHostile()
Definition: Chara.cs:6034
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:553
bool revealMap
Definition: CoreDebug.cs:153
bool enable
Definition: CoreDebug.cs:285
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 int rnd(int a)
Definition: EClass.cs:58
static Core core
Definition: EClass.cs:6
static Map _map
Definition: EClass.cs:18
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:235
int countLoadedMaps
Definition: Game.cs:229
Zone activeZone
Definition: Game.cs:245
ZoneTransition transition
Definition: GlobalData.cs:6
Definition: Guild.cs:2
void RefreshDevelopment()
Definition: Guild.cs:62
static Guild GetCurrentGuild()
Definition: Guild.cs:41
int Size
Definition: MapBounds.cs:20
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:2324
Cell GetCell(int index)
Definition: Map.cs:881
IEnumerable< Card > Cards
Definition: Map.cs:135
void AddCardOnActivate(Card c)
Definition: Map.cs:777
void SetZone(Zone _zone)
Definition: Map.cs:181
List< Thing > things
Definition: Map.cs:49
byte[] TryLoadFile(string path, string s, int size)
Definition: Map.cs:531
Dictionary< int, int > backerObjs
Definition: Map.cs:67
List< 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:704
void OnImport(ZoneExportData data)
Definition: Map.cs:710
List< Chara > serializedCharas
Definition: Map.cs:43
Cell[,] cells
Definition: Map.cs:85
void Load(string path, bool import=false, PartialMap partial=null)
Definition: Map.cs:542
List< Chara > charas
Definition: Map.cs:81
void RefreshAllTiles()
Definition: Map.cs:2086
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:889
List< Chara > listSummon
Definition: Player.cs:1037
bool simulatingZone
Definition: Player.cs:995
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
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:501
virtual string Name
Definition: Spatial.cs:495
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:2740
ZoneExportData Import(string path)
Definition: Zone.cs:2993
void Generate()
Definition: Zone.cs:2291
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:1107
bool isStarted
Definition: Zone.cs:70
virtual string pathExport
Definition: Zone.cs:124
MapSubset subset
Definition: Zone.cs:62
Zone GetTopZone()
Definition: Zone.cs:1871
virtual string IDSubset
Definition: Zone.cs:209
ZoneBlueprint bp
Definition: Zone.cs:64
void RefreshBGM()
Definition: Zone.cs:2846
void Deactivate()
Definition: Zone.cs:1583
void SpawnLostItems()
Definition: Zone.cs:3547
void AddGlobalCharasOnActivate()
Definition: Zone.cs:1502
bool IsInstance
Definition: Zone.cs:482
void ClearZones(Zone current=null)
Definition: Zone.cs:1840
void OnVisit()
Definition: Zone.cs:1032
virtual bool IsTown
Definition: Zone.cs:220
void RainWater()
Definition: Zone.cs:3219
virtual bool UseFog
Definition: Zone.cs:386
virtual string IDAmbience
Definition: Zone.cs:175
void RemoveCard(Card t)
Definition: Zone.cs:1950
void RefreshHat()
Definition: Zone.cs:1022
void ModInfluence(int a)
Definition: Zone.cs:3405
virtual void OnGenerateMap()
Definition: Zone.cs:2485
static bool forceRegenerate
Definition: Zone.cs:25
bool IsPCFaction
Definition: Zone.cs:466
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:484
void RefreshListCitizen()
Definition: Zone.cs:3389
virtual int ExpireDays
Definition: Zone.cs:168
virtual void OnVisitNewMapOrRegenerate()
Definition: Zone.cs:1127

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, and EClass.world.

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

◆ AddCard() [1/3]

Card Zone.AddCard ( Card  t)
inline

Definition at line 1915 of file Zone.cs.

1916 {
1917 return AddCard(t, 0, 0);
1918 }
Card AddCard(Card t, Point point)
Definition: Zone.cs:1910

◆ AddCard() [2/3]

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

Definition at line 1920 of file Zone.cs.

1921 {
1922 if (t.parent != null)
1923 {
1924 t.parent.RemoveCard(t);
1925 }
1926 t.parent = this;
1927 Chara chara = t.Chara;
1928 if (chara != null)
1929 {
1930 chara.currentZone = this;
1931 chara.SetAI(new NoGoal());
1932 }
1933 if (IsActiveZone)
1934 {
1935 map.OnCardAddedToZone(t, x, z);
1936 if (isStarted && t.isThing && t.placeState == PlaceState.roaming && !ignoreSpawnAnime)
1937 {
1938 t.PlayAnimeLoot();
1939 }
1940 ignoreSpawnAnime = false;
1941 }
1942 if (chara != null && EClass.player != null && !chara.hasSpawned)
1943 {
1944 EClass.player.codex.AddSpawn(chara.id);
1945 chara.hasSpawned = true;
1946 }
1947 return t;
1948 }
PlaceState
Definition: PlaceState.cs:2
virtual bool isThing
Definition: Card.cs:2017
virtual Chara Chara
Definition: Card.cs:2006
ICardParent parent
Definition: Card.cs:51
bool hasSpawned
Definition: Card.cs:886
PlaceState placeState
Definition: Card.cs:79
void PlayAnimeLoot()
Definition: Card.cs:5805
void AddSpawn(string id)
Definition: CodexManager.cs:65
void OnCardAddedToZone(Card t, int x, int z)
Definition: Map.cs:800
Definition: NoGoal.cs:4
CodexManager codex
Definition: Player.cs:931
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 1910 of file Zone.cs.

1911 {
1912 return AddCard(t, point.x, point.z);
1913 }

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(), Map.MineBlock(), Chara.MoveHome(), Chara.MoveZone(), Region.OnAdvanceHour(), Zone_WindRest.OnAfterSimulate(), Zone_Nymelle.OnBeforeSimulate(), QuestIntroInspector.OnComplete(), QuestVernis.OnComplete(), TaskHarvest.OnCreateProgress(), TaskBuild.OnDestroy(), QuestDialog.OnDropReward(), ZoneEventSiege.OnFirstTick(), Zone_DungeonPuppy.OnGenerateMap(), Zone_TestRoom.OnGenerateMap(), MapGenDungen.OnGenerateTerrain(), GrowSystemTree.OnHitFail(), 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(), 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(), CoreDebug.UpdateInput(), Chara.Vomit(), and ActEffect.Wish().

◆ AddCardSplinkle()

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

Definition at line 1880 of file Zone.cs.

1881 {
1882 Point point = new Point(center);
1883 for (int i = 0; i < 1000; i++)
1884 {
1885 point.x = center.x + EClass.rnd(radius) - EClass.rnd(radius);
1886 point.z = center.z + EClass.rnd(radius) - EClass.rnd(radius);
1887 if (point.IsValid && !point.IsBlocked && !point.HasChara)
1888 {
1889 return AddCard(t, point);
1890 }
1891 }
1892 return AddCard(t, center);
1893 }
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()

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

Definition at line 1895 of file Zone.cs.

1896 {
1897 return AddCard(CharaGen.Create(id), x, z);
1898 }
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17

References CharaGen.Create().

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

◆ AddGlobalCharasOnActivate()

void Zone.AddGlobalCharasOnActivate ( )
inline

Definition at line 1502 of file Zone.cs.

1503 {
1504 Point spawnPosPC = null;
1505 if (EClass.pc.currentZone == this)
1506 {
1507 spawnPosPC = GetSpawnPos(EClass.pc);
1508 }
1509 if (spawnPosPC == null)
1510 {
1511 spawnPosPC = map.GetCenterPos();
1512 }
1513 if (spawnPosPC.IsValid && EClass.pc.global.transition != null && spawnPosPC.HasBlock)
1514 {
1515 spawnPosPC = spawnPosPC.GetNearestPoint();
1516 }
1517 spawnPosPC = spawnPosPC.Clamp(useBounds: true).GetNearestPoint();
1518 foreach (Chara c in EClass.game.cards.globalCharas.Values)
1519 {
1520 if (c.currentZone != this)
1521 {
1522 continue;
1523 }
1524 if (c.parent is Chara)
1525 {
1526 Chara chara = c.parent as Chara;
1527 c.currentZone = chara.currentZone;
1528 }
1529 else
1530 {
1531 if (c.isDead)
1532 {
1533 continue;
1534 }
1535 if (c.isRestrained && c.currentZone == EClass.pc.currentZone && (!c.pos.IsValid || c.pos.FindThing<TraitShackle>() == null))
1536 {
1537 c.isRestrained = false;
1538 }
1539 if (c.global.transition != null)
1540 {
1541 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true) : GetSpawnPos(c)));
1542 if (c.IsPCParty && !c.IsPC)
1543 {
1544 if (c.host == EClass.pc)
1545 {
1546 pos.Set(spawnPosPC);
1547 }
1548 else if (pos.Equals(spawnPosPC) || !PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
1549 {
1550 c.pos.Set(spawnPosPC);
1551 if (!spawnPosPC.ForeachNearestPoint(delegate(Point p)
1552 {
1553 if (PathManager.Instance.IsPathClear(spawnPosPC, p, c, 10) && !p.Equals(spawnPosPC))
1554 {
1555 pos.Set(p);
1556 return true;
1557 }
1558 return false;
1559 }, allowBlock: false, EClass.pc.party.members.Count >= 12, allowInstalled: true, ignoreCenter: true, EClass._zone.IsRegion ? 2 : 6))
1560 {
1561 pos.Set(spawnPosPC);
1562 }
1563 }
1564 }
1565 c.pos.Set(pos);
1566 c.global.transition = null;
1567 }
1568 map.charas.Add(c);
1570 }
1571 }
1572 foreach (Chara item in EClass.player.listSummon)
1573 {
1574 Point nearestPoint = spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true);
1575 item.enemy = null;
1576 item.pos.Set(nearestPoint);
1577 map.charas.Add(item);
1579 }
1580 EClass.player.listSummon.Clear();
1581 }
GlobalCharaList globalCharas
Definition: CardManager.cs:46
bool isRestrained
Definition: Card.cs:550
override bool IsPC
Definition: Chara.cs:608
Chara host
Definition: Chara.cs:33
Zone currentZone
Definition: Chara.cs:251
bool isDead
Definition: Chara.cs:385
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
bool Equals(int _x, int _z)
Definition: Point.cs:940
bool ForeachNearestPoint(Func< Point, bool > endFunc, bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int maxRange=30)
Definition: Point.cs:675
Point Clamp(bool useBounds=false)
Definition: Point.cs:988
bool HasBlock
Definition: Point.cs:141
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1120
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
Definition: Point.cs:607
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
Definition: Zone.cs:1299

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

3116 {
3117 Trait random = map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
3118 if (random == null)
3119 {
3120 return null;
3121 }
3122 Point point = random.GetPoint();
3123 Chara chara = null;
3124 if (guest)
3125 {
3126 Zone z = EClass.world.FindZone("wilds");
3127 chara = EClass.game.cards.ListGlobalChara(z).RandomItem();
3128 if (chara != null)
3129 {
3130 AddCard(chara, point);
3131 Msg.Say("guestArrive", chara);
3132 chara.visitorState = VisitorState.Arrived;
3133 }
3134 }
3135 else
3136 {
3137 chara = CharaGen.CreateFromFilter("c_wilds");
3138 AddCard(chara, point);
3139 chara.goalListType = GoalListType.Enemy;
3140 }
3141 return chara;
3142 }
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:714
TraitSet GetTraitSet(Type t)
Definition: TraitManager.cs:94
Definition: Trait.cs:7
Point GetPoint()
Definition: Trait.cs:722
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 1905 of file Zone.cs.

1906 {
1907 return AddThing(id, p.x, p.z);
1908 }
Card AddThing(string id, int x, int z)
Definition: Zone.cs:1900

References Point.x, and Point.z.

◆ ApplyBackerPet()

void Zone.ApplyBackerPet ( bool  draw)
inline

Definition at line 3592 of file Zone.cs.

3593 {
3594 bool flag = this is Zone_Yowyn && base.lv == -1;
3595 IList<SourceBacker.Row> list = EClass.sources.backers.listPet.Copy();
3596 list.Shuffle();
3598 {
3599 list.ForeachReverse(delegate(SourceBacker.Row a)
3600 {
3601 if (EClass.player.doneBackers.Contains(a.id))
3602 {
3603 list.Remove(a);
3604 }
3605 });
3606 }
3607 foreach (Chara chara in EClass._map.charas)
3608 {
3609 if (chara.IsGlobal || chara.IsMinion)
3610 {
3611 continue;
3612 }
3613 if (chara.isBackerContent)
3614 {
3615 if (chara.sourceBacker.isStatic != 0)
3616 {
3617 continue;
3618 }
3619 if (chara.id != "follower")
3620 {
3621 chara.RemoveBacker();
3622 }
3623 }
3624 if ((flag && chara.race.id != "cat") || EClass.rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0)
3625 {
3626 continue;
3627 }
3628 foreach (SourceBacker.Row item in list)
3629 {
3630 if (item.chara == chara.id)
3631 {
3632 chara.ApplyBacker(item.id);
3633 list.Remove(item);
3634 break;
3635 }
3636 }
3637 }
3638 }
SourceBacker.Row sourceBacker
Definition: Card.cs:900
void RemoveBacker()
Definition: Card.cs:6635
void ApplyBacker(int bid)
Definition: Card.cs:6599
bool isBackerContent
Definition: Card.cs:897
override bool IsGlobal
Definition: Chara.cs:606
override bool IsMinion
Definition: Chara.cs:623
SourceRace.Row race
Definition: Chara.cs:460
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 1743 of file Zone.cs.

1744 {
1746 {
1747 return false;
1748 }
1749 if (IsInstance)
1750 {
1751 return true;
1752 }
1753 bool flag = false;
1754 if (id == "cave_yeek" && !(this is Zone_DungeonYeek))
1755 {
1756 flag = true;
1757 }
1758 Zone topZone = GetTopZone();
1759 if (!flag)
1760 {
1761 if (base.dateExpire == 0 || !EClass.world.date.IsExpired(base.dateExpire))
1762 {
1763 return false;
1764 }
1765 if (!base.isRandomSite && !(this is Zone_Field) && (topZone == null || topZone == this || topZone.FindDeepestZone() == this))
1766 {
1767 return false;
1768 }
1769 }
1770 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()))
1771 {
1772 return false;
1773 }
1775 {
1777 if (zone != null && zone.GetTopZone() == this)
1778 {
1779 return false;
1780 }
1781 }
1782 return true;
1783 }
SpatialManager spatials
Definition: Game.cs:152
Zone nextZone
Definition: Player.cs:1041
Zone Find(string id)
Zone FindDeepestZone()
Definition: Spatial.cs:701

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)
inline

Definition at line 1676 of file Zone.cs.

1677 {
1680 branch = new FactionBranch();
1681 branch.OnCreate(this);
1682 if (base.icon == 0)
1683 {
1684 base.icon = 332;
1685 }
1686 instance = null;
1687 base.dateExpire = 0;
1689 Register();
1690 foreach (Thing thing in map.things)
1691 {
1692 thing.isNPCProperty = false;
1693 }
1696 if (debug)
1697 {
1698 for (int i = 0; i < 7; i++)
1699 {
1700 Chara chara = CharaGen.CreateFromFilter("c_neutral");
1701 EClass._zone.AddCard(chara, EClass._map.bounds.GetRandomPoint().GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false));
1702 branch.AddMemeber(chara);
1703 }
1704 }
1705 else
1706 {
1707 Msg.Say("claimedZone");
1708 EClass.Branch.Log("claimedZone");
1709 EClass.Sound.Play("jingle_embark");
1710 EClass.pc.PlaySound("build");
1711 Effect.Get("aura_heaven").Play(EClass.pc.pos);
1712 Point nearestPoint = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: true, allowInstalled: false);
1713 EClass._zone.AddCard(ThingGen.Create("core_zone"), nearestPoint).SetPlaceState(PlaceState.installed);
1714 }
1715 base.idPrefix = 0;
1717 {
1718 EClass.player.spawnZone = EClass._zone;
1719 }
1721 {
1722 EClass._zone.SetBGM(new List<int> { 41, 90, 44, 43 });
1724 }
1725 }
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3596
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5776
Faction faction
Definition: Chara.cs:423
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:235
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:899
MapBounds bounds
Definition: Map.cs:52
EloMap elomap
Definition: Scene.cs:149
void SetInt(int id, int value=0)
Definition: Spatial.cs:566
void Register()
Definition: Spatial.cs:616
void SetBGM(List< int > ids, bool refresh=true)
Definition: Zone.cs:2810
void RefreshPlaylist()
Definition: Zone.cs:2838

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 TraitDeed.OnRead(), DramaOutcome.QuestExploration_MeetFarris2(), and CoreDebug.QuickStart().

◆ ClearZones()

void Zone.ClearZones ( Zone  current = null)
inline

Definition at line 1840 of file Zone.cs.

1841 {
1842 if (map != null)
1843 {
1844 UnloadMap();
1845 }
1846 base.isGenerated = false;
1847 Zone topZone = GetTopZone();
1848 if (topZone != this)
1849 {
1850 topZone.ClearZones(this);
1851 return;
1852 }
1853 children.ForeachReverse(delegate(Spatial c)
1854 {
1855 if (c != current)
1856 {
1857 c.Destroy();
1858 }
1859 });
1860 }
virtual void Destroy()
Definition: Spatial.cs:676
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 3524 of file Zone.cs.

3525 {
3526 int num = 0;
3527 foreach (Chara chara in EClass._map.charas)
3528 {
3529 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3530 {
3531 num++;
3532 }
3533 }
3534 return num;
3535 }
MinionType
Definition: MinionType.cs:2
MinionType c_minionType
Definition: Card.cs:960

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

2280 {
2281 bp = new ZoneBlueprint();
2282 bp.Create();
2283 bp.genSetting.seed = base.Seed;
2284 OnCreateBP();
2285 }
virtual void OnCreateBP()
Definition: Zone.cs:2287

References ZoneBlueprint.Create().

◆ CreatePlaylist()

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

Definition at line 2886 of file Zone.cs.

2887 {
2888 Playlist playlist = EClass.Sound.plBlank.Instantiate();
2889 if (list.Count == 0 && (bool)mold)
2890 {
2891 list = mold.ToInts();
2892 playlist.shuffle = mold.shuffle;
2893 playlist.minSwitchTime = mold.minSwitchTime;
2894 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
2895 playlist.ignoreLoop = mold.ignoreLoop;
2896 playlist.keepBGMifSamePlaylist = mold.keepBGMifSamePlaylist;
2897 playlist.name = mold.name;
2898 }
2899 foreach (int item in list)
2900 {
2901 playlist.list.Add(new Playlist.Item
2902 {
2903 data = EClass.core.refs.dictBGM[item]
2904 });
2905 }
2906 return playlist;
2907 }

References item, and EClass.Sound.

◆ Deactivate()

void Zone.Deactivate ( )
inline

Definition at line 1583 of file Zone.cs.

1584 {
1585 if (!IsUserZone && !IsPCFaction && map != null)
1586 {
1587 List<Thing> list = new List<Thing>();
1588 foreach (Thing thing in map.things)
1589 {
1590 if (thing.rarity >= Rarity.Artifact && thing.HasTag(CTAG.godArtifact))
1591 {
1592 list.Add(thing);
1593 }
1594 }
1595 if (this is Zone_Tent)
1596 {
1597 foreach (Thing item in map.props.stocked.Things.Concat(map.props.roaming.Things))
1598 {
1599 if (item.IsContainer)
1600 {
1601 foreach (Thing thing2 in item.things)
1602 {
1603 if (thing2.trait is TraitTent)
1604 {
1605 list.Add(thing2);
1606 }
1607 }
1608 }
1609 if (item.trait is TraitTent)
1610 {
1611 list.Add(item);
1612 }
1613 }
1614 }
1615 if (list.Count > 0)
1616 {
1617 Msg.Say("pick_valuable");
1618 foreach (Thing item2 in list)
1619 {
1620 Msg.Say("pick_valuable2", item2);
1621 EClass.pc.AddCard(item2);
1622 }
1623 }
1624 }
1625 base.isPeace = false;
1627 if (IsPCFaction)
1628 {
1629 foreach (Chara member in branch.members)
1630 {
1631 member.ValidateWorks();
1632 }
1633 }
1634 EClass.game.lastActiveZone = EClass.game.activeZone;
1635 base.lastActive = EClass.world.date.GetRaw();
1636 map.OnDeactivate();
1637 EClass.scene.Clear();
1638 EClass.game.activeZone = null;
1639 if (IsInstance)
1640 {
1641 UnloadMap();
1642 base.isGenerated = false;
1643 }
1644 if (forceRegenerate)
1645 {
1646 UnloadMap();
1647 }
1648 OnDeactivate();
1649 }
Rarity
Definition: Rarity.cs:2
Card AddCard(Card c)
Definition: Card.cs:3006
Rarity rarity
Definition: Card.cs:298
bool HasTag(CTAG tag)
Definition: Card.cs:2531
void ValidateWorks()
Definition: Chara.cs:8530
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:1115
virtual bool IsUserZone
Definition: Zone.cs:266
virtual void OnDeactivate()
Definition: Zone.cs:1119

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

1822 {
1823 children.ForeachReverse(delegate(Spatial z)
1824 {
1825 z.Destroy();
1826 });
1827 if (map != null)
1828 {
1829 UnloadMap();
1830 }
1831 if (parent != null && parent.IsRegion && instance == null)
1832 {
1833 EClass.scene.elomap.SetZone(base.x, base.y, null, updateMesh: true);
1834 }
1835 EClass.game.spatials.Remove(this);
1836 destryoed = true;
1837 base.isGenerated = false;
1838 }
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 520 of file Zone.cs.

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

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

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

◆ Export() [1/2]

void Zone.Export ( )
inline

Definition at line 3085 of file Zone.cs.

3086 {
3088 string text = pathExport;
3089 IO.Copy(text, CorePath.ZoneSave + "Backup/");
3090 Export(text);
3091 Msg.Say("Exported Map:" + text);
3092 }
static string ZoneSave
Definition: CorePath.cs:196
static void Copy(string fromPath, string toPath)
Definition: IO.cs:266
void ResetEditorPos()
Definition: Map.cs:357
void Export()
Definition: Zone.cs:3085

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

3003 {
3004 if (subset != null)
3005 {
3006 SE.Beep();
3007 return;
3008 }
3009 try
3010 {
3011 ZoneExportData zoneExportData = new ZoneExportData
3012 {
3013 name = name,
3014 usermap = usermap
3015 };
3017 if (!map.config.retainDecal)
3018 {
3020 }
3021 map.Save(IO.TempPath + "/", zoneExportData, partial);
3022 map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(path), partial);
3023 if (partial == null)
3024 {
3025 IO.CopyDir(base.pathSave + "Texture Replace", IO.TempPath + "/Texture Replace");
3026 }
3027 IO.SaveFile(IO.TempPath + "/export", zoneExportData, compress: true);
3028 using (ZipFile zipFile = new ZipFile())
3029 {
3030 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3031 zipFile.AddDirectory(IO.TempPath);
3032 zipFile.Save(path);
3033 zipFile.Dispose();
3034 }
3036 }
3037 catch (Exception ex)
3038 {
3039 EClass.ui.Say(ex.Message + ":" + path);
3040 }
3041 }
static void CreateTempDirectory(string path=null)
Definition: IO.cs:367
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:372
bool retainDecal
Definition: MapConfig.cs:44
void ExportMetaData(string _path, string id, PartialMap partial=null)
Definition: Map.cs:716
void ClearRainAndDecal()
Definition: Map.cs:1513
MapConfig config
Definition: Map.cs:37
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 3043 of file Zone.cs.

3044 {
3046 {
3047 string text = StandaloneFileBrowser.SaveFilePanel("Export Zone", dir ?? CorePath.ZoneSave, "new zone", "z");
3048 if (!string.IsNullOrEmpty(text))
3049 {
3050 Export(text);
3051 Msg.SayRaw("Exported Zone");
3052 }
3053 });
3054 }
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 2914 of file Zone.cs.

2915 {
2916 return map.charas.Find((Chara c) => c.uid == uid);
2917 }
int uid
Definition: Spatial.cs:70

References Map.charas, and Card.uid.

◆ FindChara() [2/2]

Chara Zone.FindChara ( string  id)
inline

Definition at line 2909 of file Zone.cs.

2910 {
2911 return map.charas.Find((Chara c) => c.id == id);
2912 }

References Map.charas, and Card.id.

Referenced by DramaCustomSequence.Build().

◆ Generate()

void Zone.Generate ( )
inline

Definition at line 2291 of file Zone.cs.

2292 {
2293 base.isGenerated = true;
2294 if (bp == null)
2295 {
2296 CreateBP();
2297 }
2298 if (bp.map == null)
2299 {
2300 bp.GenerateMap(this);
2301 }
2302 map.SetZone(this);
2303 Zone_Field zone_Field = this as Zone_Field;
2304 if (IdBiome == "Sand" || IdBiome == "Water" || IsUnderwater)
2305 {
2306 int num = 1 + EClass.rnd((IdBiome == "Water") ? 3 : 2);
2307 for (int i = 0; i < num; i++)
2308 {
2309 Point randomSurface = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2310 if (!randomSurface.HasObj && !randomSurface.HasThing)
2311 {
2312 Thing t = ThingGen.Create("pearl_oyster", new string[3] { "wood_birch", "poplar", "coralwood" }.RandomItem(), ContentLv);
2313 EClass._zone.AddCard(t, randomSurface).Install();
2314 }
2315 }
2316 num = 4 + EClass.rnd(5);
2317 for (int j = 0; j < num; j++)
2318 {
2319 Point randomSurface2 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2320 if (!randomSurface2.HasObj && !randomSurface2.HasThing && (IsUnderwater || randomSurface2.cell.IsTopWaterAndNoSnow || EClass.rnd(6) == 0))
2321 {
2322 EClass._zone.AddCard(ThingGen.Create("70", -1, ContentLv), randomSurface2);
2323 }
2324 }
2325 }
2326 if (IsUnderwater)
2327 {
2328 for (int k = 0; k < 30 + EClass.rnd(30); k++)
2329 {
2330 SpawnMob(null, SpawnSetting.Fish());
2331 }
2332 Crawler crawler = Crawler.Create("pasture");
2333 int num2 = (EClass.debug.enable ? 3 : EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(5) + 1) + 1) + 1));
2334 bool flag = this is Zone_Field;
2335 Thing seed = null;
2336 if (IsNefia)
2337 {
2338 int num3 = Mathf.Min(EClass._zone.DangerLv, EClass.pc.Evalue(286) * 2 / 3);
2339 if (num3 > 0)
2340 {
2342 Rand.SetSeed(EClass._zone.uid * 10 + num3);
2343 TraitSeed.LevelSeed(seed, (seed.trait as TraitSeed).row, num3);
2344 Rand.SetSeed();
2345 seed.elements.SetBase(2, EClass.curve(seed.encLV, 50, 10, 80));
2346 }
2347 }
2348 crawler.CrawlUntil(EClass._map, () => EClass._map.GetRandomPoint(), num2 + (flag ? 4 : 0), delegate(Crawler.Result r)
2349 {
2350 int num6 = 137;
2351 foreach (Point point in r.points)
2352 {
2353 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
2354 {
2355 map.SetObj(point.x, point.z, num6);
2356 int idx = 3 + ((EClass.rnd(3) == 0) ? 1 : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0);
2357 point.growth.SetStage(idx);
2358 if (seed != null)
2359 {
2360 EClass._map.AddPlant(point, seed);
2361 }
2362 }
2363 }
2364 return false;
2365 });
2366 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)
2367 {
2368 int num5 = 136;
2369 foreach (Point point2 in r.points)
2370 {
2371 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
2372 {
2373 map.SetObj(point2.x, point2.z, num5, 1, EClass.rnd(4));
2374 }
2375 }
2376 return false;
2377 });
2378 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)
2379 {
2380 int idFloor = 121;
2381 foreach (Point point3 in r.points)
2382 {
2383 map.SetFloor(point3.x, point3.z, 97, idFloor, Mathf.Clamp(4 - r.startPos.Distance(point3) + EClass.rnd(3) - EClass.rnd(3), 0, 3));
2384 }
2385 return false;
2386 });
2387 }
2388 if (zone_Field != null)
2389 {
2390 if (EClass.rnd(3) == 0)
2391 {
2392 int num4 = EClass.rnd(2);
2393 for (int l = 0; l < num4; l++)
2394 {
2395 Point randomSurface3 = EClass._map.bounds.GetRandomSurface();
2396 if (!randomSurface3.HasObj && !randomSurface3.HasThing)
2397 {
2399 EClass._zone.AddCard(t2, randomSurface3).Install();
2400 }
2401 }
2402 }
2403 if (EClass.rnd(8) == 0)
2404 {
2405 SpawnAltar();
2406 }
2408 }
2409 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList) ?? EClass.Sound.GetPlaylist("Day"));
2410 }
@ seed
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2957
int Evalue(int ele)
Definition: Card.cs:2507
Card Install()
Definition: Card.cs:3590
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:63
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:2193
List< int > _plDay
Definition: Map.cs:55
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:951
PlantData AddPlant(Point pos, Thing seed)
Definition: Map.cs:1930
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1522
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:2446
Playlist CreatePlaylist(ref List< int > list, Playlist mold=null)
Definition: Zone.cs:2886
virtual bool IsNefia
Definition: Zone.cs:280
BiomeProfile biome
Definition: Zone.cs:126
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
Definition: Zone.cs:2645
virtual string IdBiome
Definition: Zone.cs:128
override int DangerLv
Definition: Zone.cs:107
virtual bool IsUnderwater
Definition: Zone.cs:264
void TrySpawnFollower()
Definition: Zone.cs:2412
void CreateBP()
Definition: Zone.cs:2279

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

2920 {
2921 int max = base.lv;
2922 return GetDeepestLv(ref max);
2923 }
int GetDeepestLv()
Definition: Zone.cs:2919

Referenced by WindowChara.RefreshProfile().

◆ GetDeepestLv() [2/2]

int Zone.GetDeepestLv ( ref int  max)
inline

Definition at line 2925 of file Zone.cs.

2926 {
2927 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
2928 {
2929 max = base.lv;
2930 }
2931 foreach (Spatial child in children)
2932 {
2933 (child as Zone).GetDeepestLv(ref max);
2934 }
2935 return max;
2936 }

◆ GetDungenID()

virtual string Zone.GetDungenID ( )
inlinevirtual

Reimplemented in Zone_CursedManorDungeon, Zone_Dungeon, Zone_Gathering, Zone_RandomDungeonNature, Zone_UnderseaTemple, and Zone_VernisMine.

Definition at line 530 of file Zone.cs.

531 {
532 return null;
533 }

◆ GetElectricity()

int Zone.GetElectricity ( bool  cost = false)
inline

Definition at line 2771 of file Zone.cs.

2772 {
2773 bool flag = GetSoilCost() > MaxSoil;
2774 int sum = 0;
2775 foreach (Thing thing in EClass._map.things)
2776 {
2777 if (!thing.IsInstalled || thing.trait.Electricity == 0)
2778 {
2779 continue;
2780 }
2781 if (cost)
2782 {
2783 if (thing.trait.Electricity < 0)
2784 {
2785 sum += -thing.trait.Electricity;
2786 }
2787 }
2788 else if (thing.trait.Electricity > 0)
2789 {
2790 sum += thing.trait.Electricity;
2791 }
2792 }
2793 if (!cost)
2794 {
2795 sum += elements.Value(2201) * 10 + BaseElectricity;
2796 if (!flag)
2797 {
2798 EClass._map.bounds.ForeachCell(delegate(Cell c)
2799 {
2800 if (c.sourceObj.id == 118 && c.growth.IsMature)
2801 {
2802 sum += 20;
2803 }
2804 });
2805 }
2806 }
2807 return sum;
2808 }
bool IsInstalled
Definition: Card.cs:2317
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:101
virtual int BaseElectricity
Definition: Zone.cs:486
virtual int MaxSoil
Definition: Zone.cs:509
int GetSoilCost()
Definition: Zone.cs:3537

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

Definition at line 535 of file Zone.cs.

536 {
537 return base.source.id;
538 }

Referenced by TraitNewZone.CreateZone().

◆ GetOrCreateFortuneRollData()

FortuneRollData Zone.GetOrCreateFortuneRollData ( bool  refresh = true)
inline

Definition at line 3640 of file Zone.cs.

3641 {
3642 if (fortuneRoll == null)
3643 {
3645 fortuneRoll.seed = EClass._zone.uid * 100 + EClass.game.seed;
3646 }
3647 if (refresh || fortuneRoll.count == 0)
3648 {
3650 }
3651 return fortuneRoll;
3652 }
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 2239 of file Zone.cs.

2240 {
2241 string text = IdProfile;
2242 if (text.IsEmpty())
2243 {
2244 Region region = parent as Region;
2245 if (base.lv != 0)
2246 {
2247 text = ((base.lv < 0) ? "Underground" : "Sky");
2248 }
2249 else if (region != null)
2250 {
2252 text = EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2253 if (bp != null)
2254 {
2255 name = Lang.GetList("zone_" + text.Split('/')[1]).RandomItem();
2256 bp.surrounding = new EloMap.TileInfo[3, 3];
2257 for (int i = 0; i < 3; i++)
2258 {
2259 for (int j = 0; j < 3; j++)
2260 {
2261 bp.surrounding[j, i] = EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2262 }
2263 }
2264 if (text == "Random/R_Shore")
2265 {
2266 base.isBeach = true;
2267 }
2268 }
2269 }
2270 else
2271 {
2272 text = "Random";
2273 }
2274 idProfile = text;
2275 }
2276 return ZoneProfile.Load(text);
2277 }
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:287
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 1971 of file Zone.cs.

1971 : Trait
1972 {
1973 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
1974 }
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 1480 of file Zone.cs.

1481 {
1482 Point point = null;
1483 if (EClass.rnd(3) == 0 && map.rooms.listRoom.Count > 0)
1484 {
1485 point = map.rooms.listRoom.RandomItem().points.RandomItem();
1486 }
1487 if (point == null && EClass.rnd(4) != 0)
1488 {
1489 IEnumerable<Chara> ie = map.charas.Where((Chara t) => t.trait.ShopType != 0 && t.pos != null && t.pos.IsValid);
1490 if (ie.Count() > 0)
1491 {
1492 point = ie.RandomItem().pos.GetRandomPoint(3);
1493 }
1494 }
1495 if (point == null)
1496 {
1497 point = map.bounds.GetRandomSurface(centered: false, walkable: true, !IsPCFaction && !(this is Zone_Civilized)) ?? map.bounds.GetRandomPoint();
1498 }
1499 return point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false) ?? EClass._map.GetCenterPos();
1500 }
new TraitChara trait
Definition: Chara.cs:499
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:753
virtual ShopType ShopType
Definition: Trait.cs:511

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

1867 {
1868 return this;
1869 }

◆ GetSoilCost()

int Zone.GetSoilCost ( )
inline

Definition at line 3537 of file Zone.cs.

3538 {
3539 int i = 0;
3540 EClass._map.bounds.ForeachCell(delegate(Cell c)
3541 {
3542 i += c.sourceObj.costSoil;
3543 });
3544 return i / 10;
3545 }

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

3103 {
3104 if (IsPCFaction)
3105 {
3106 return -100000 + base.uid;
3107 }
3108 if (this is Zone_Civilized)
3109 {
3110 return -90000 + base.uid;
3111 }
3112 return base.uid;
3113 }

Referenced by SpatialManager.ListReturnLocations().

◆ GetSpawnPos() [1/2]

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

Definition at line 1299 of file Zone.cs.

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

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

2632 {
2633 Point point = new Point();
2634 for (int i = 0; i < tries; i++)
2635 {
2636 point = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2637 if (point.IsValid && !point.cell.hasDoor && !point.IsSync && (type != SpawnPosition.Outside || (!point.cell.HasRoof && point.cell.light <= 0)))
2638 {
2639 return point;
2640 }
2641 }
2642 return null;
2643 }
SpawnPosition
Definition: SpawnPosition.cs:2
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, Map.bounds, Point.cell, MapBounds.GetRandomSurface(), Cell.hasDoor, Cell.HasRoof, Point.IsSync, Point.IsValid, and Cell.light.

◆ GetTopZone()

◆ GetZoneAt()

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

Definition at line 3341 of file Zone.cs.

3342 {
3343 if (IsRegion)
3344 {
3345 foreach (Spatial child in children)
3346 {
3347 if (!(child is Zone_Field) && _x == child.x && _y == child.y)
3348 {
3349 return child as Zone;
3350 }
3351 }
3352 }
3353 foreach (Spatial child2 in children)
3354 {
3355 if (_x == child2.x && _y == child2.y)
3356 {
3357 return child2 as Zone;
3358 }
3359 }
3360 return null;
3361 }

References Spatial.x, and Spatial.y.

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

◆ GrowPlants()

void Zone.GrowPlants ( VirtualDate  date)
inline

Definition at line 3234 of file Zone.cs.

3235 {
3236 bool num = (EClass.player.isAutoFarming = IsPCFaction && EClass.Branch.policies.IsActive(2707));
3237 int weedChance = 1;
3239 {
3240 weedChance += (EClass.debug.enable ? 100000 : 20) + EClass.Branch.Evalue(2703) * 10;
3241 }
3242 if (date.sunMap == null)
3243 {
3244 date.BuildSunMap();
3245 }
3246 if (num)
3247 {
3248 HashSet<int> hashSet = new HashSet<int>();
3249 foreach (Thing thing in EClass._map.things)
3250 {
3251 if (!thing.IsInstalled || !(thing.trait is TraitSpotFarm traitSpotFarm))
3252 {
3253 continue;
3254 }
3255 foreach (Point item in traitSpotFarm.ListPoints(null, onlyPassable: false))
3256 {
3257 hashSet.Add(item.index);
3258 }
3259 }
3260 Perform(hashSet);
3261 EClass.player.isAutoFarming = false;
3262 Perform(hashSet);
3263 }
3264 else
3265 {
3266 Perform(null);
3267 }
3268 void Perform(HashSet<int> farmMap)
3269 {
3270 bool isWinter = date.IsWinter;
3271 EClass._map.bounds.ForeachCell(delegate(Cell c)
3272 {
3273 if (farmMap != null)
3274 {
3276 {
3277 if (!farmMap.Contains(c.index))
3278 {
3279 return;
3280 }
3281 }
3282 else if (farmMap.Contains(c.index))
3283 {
3284 return;
3285 }
3286 }
3287 if (c.decal != 0 && EClass.rnd(3) == 0)
3288 {
3289 c.decal = 0;
3290 }
3291 if (GrowPlant)
3292 {
3293 if (c.growth != null)
3294 {
3295 bool flag = false;
3296 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3297 {
3298 flag = true;
3299 }
3300 PlantData plantData = map.TryGetPlant(c);
3301 if (!flag && (plantData == null || plantData.fert >= 0))
3302 {
3303 c.TryGrow(date);
3304 }
3305 if (isWinter && plantData != null && c.growth != null && c.growth.NeedSunlight && plantData.fert >= 0 && (EClass.rnd(4) == 0 || c.growth.stage.idx == 0))
3306 {
3307 if (date.sunMap == null)
3308 {
3309 date.BuildSunMap();
3310 }
3311 if (!date.sunMap.Contains(c.index) && !c.growth.CanGrow(date))
3312 {
3313 c.growth.Perish();
3314 }
3315 }
3316 }
3317 else if (c.detail != null)
3318 {
3319 c.Things.ForeachReverse(delegate(Thing t)
3320 {
3321 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3322 {
3323 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3324 }
3325 });
3326 }
3327 else if (EClass.rnd(20) == 0 && GrowWeed && c.CanGrowWeed && EClass.rnd(weedChance) == 0)
3328 {
3329 biome.Populate(c.GetPoint());
3330 if (c.growth != null)
3331 {
3332 c.growth.SetStage(0);
3333 }
3334 }
3335 }
3336 c.isWatered = false;
3337 });
3338 }
3339 }
void Populate(Point point, bool interior=false)
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:1920
bool isAutoFarming
Definition: Player.cs:997
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 2993 of file Zone.cs.

2994 {
2995 ZipFile zipFile = ZipFile.Read(path);
2996 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
2997 zipFile.ExtractAll(pathTemp);
2998 zipFile.Dispose();
2999 return IO.LoadFile<ZoneExportData>(pathTemp + "export") ?? new ZoneExportData();
3000 }

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

◆ ImportDialog()

void Zone.ImportDialog ( string  dir = null)
inline

Definition at line 3056 of file Zone.cs.

3057 {
3059 {
3060 string[] array = StandaloneFileBrowser.OpenFilePanel("Import Zone", dir ?? CorePath.ZoneSave, "z", multiselect: false);
3061 if (array.Length != 0)
3062 {
3063 Zone_User zone_User = SpatialGen.Create("user", EClass.world.region, register: true) as Zone_User;
3064 zone_User.path = array[0];
3065 Thing thing = ThingGen.Create("teleporter");
3066 thing.c_uidZone = zone_User.uid;
3067 EClass._zone.AddCard(thing, EClass.pc.pos);
3068 }
3069 });
3070 }
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 3363 of file Zone.cs.

3364 {
3365 if (act.IsHostileAct && HasLaw && !IsPCFaction && c.IsPC)
3366 {
3367 return true;
3368 }
3369 return false;
3370 }
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 3072 of file Zone.cs.

3073 {
3074 try
3075 {
3076 return Map.GetMetaData(path)?.IsValidVersion() ?? false;
3077 }
3078 catch (Exception ex)
3079 {
3080 EClass.ui.Say(ex.Message);
3081 return false;
3082 }
3083 }
bool IsValidVersion()
Definition: MapMetaData.cs:25
static MapMetaData GetMetaData(string pathZip)
Definition: Map.cs:732

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

Referenced by TraitMoongate.UseMoongate().

◆ ListLandFeats()

List< Element > Zone.ListLandFeats ( )
inline

Definition at line 2938 of file Zone.cs.

2939 {
2940 if (landFeats == null)
2941 {
2942 landFeats = new List<int>();
2944 string[] listBase = IDBaseLandFeat.Split(',');
2945 string[] array = listBase;
2946 foreach (string text in array)
2947 {
2948 if (!text.IsEmpty())
2949 {
2950 landFeats.Add(EClass.sources.elements.alias[text].id);
2951 }
2952 }
2953 if (listBase.Length == 1)
2954 {
2955 List<SourceElement.Row> list = EClass.sources.elements.rows.Where(delegate(SourceElement.Row e)
2956 {
2957 if (e.category != "landfeat" || e.chance == 0)
2958 {
2959 return false;
2960 }
2961 bool flag = true;
2962 string[] tag = e.tag;
2963 foreach (string text2 in tag)
2964 {
2965 if (text2.StartsWith("bf"))
2966 {
2967 flag = false;
2968 if (listBase[0] == text2)
2969 {
2970 flag = true;
2971 break;
2972 }
2973 }
2974 }
2975 return flag ? true : false;
2976 }).ToList();
2977 SourceElement.Row row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
2978 landFeats.Add(row.id);
2979 list.Remove(row);
2980 row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
2981 landFeats.Add(row.id);
2982 }
2983 Rand.SetSeed();
2984 }
2985 List<Element> list2 = new List<Element>();
2986 foreach (int landFeat in landFeats)
2987 {
2988 list2.Add(Element.Create(landFeat, 1));
2989 }
2990 return list2;
2991 }
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1097
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 3511 of file Zone.cs.

3512 {
3513 List<Chara> list = new List<Chara>();
3514 foreach (Chara chara in EClass._map.charas)
3515 {
3516 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3517 {
3518 list.Add(chara);
3519 }
3520 }
3521 return list;
3522 }

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

◆ ModDevelopment()

void Zone.ModDevelopment ( int  a)
inline

Definition at line 3415 of file Zone.cs.

3416 {
3417 base.development += a;
3418 if (a > 0)
3419 {
3420 Msg.Say("gainDevelopment", Name, a.ToString() ?? "");
3421 }
3422 }

References Msg.Say().

◆ ModInfluence()

void Zone.ModInfluence ( int  a)
inline

Definition at line 3405 of file Zone.cs.

3406 {
3407 base.influence += a;
3408 if (a > 0)
3409 {
3410 Msg.Say("gainInfluence", Name, a.ToString() ?? "");
3411 }
3412 Tutorial.Reserve("influence");
3413 }

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

Definition at line 1111 of file Zone.cs.

1112 {
1113 }

◆ OnAdvanceHour()

virtual void Zone.OnAdvanceHour ( )
inlinevirtual

Reimplemented in Region.

Definition at line 1135 of file Zone.cs.

1136 {
1137 }

Referenced by GameDate.AdvanceHour().

◆ OnAfterCreate()

override void Zone.OnAfterCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 564 of file Zone.cs.

565 {
566 if (AddPrefix)
567 {
568 if (GetTopZone() == this)
569 {
570 base.idPrefix = EClass.sources.zoneAffixes.rows.RandomItem().id;
571 }
572 else
573 {
574 base.idPrefix = GetTopZone().idPrefix;
575 }
576 }
577 }
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 1131 of file Zone.cs.

1132 {
1133 }

◆ OnBeforeDeactivate()

virtual void Zone.OnBeforeDeactivate ( )
inlinevirtual

Reimplemented in Zone_Tent.

Definition at line 1115 of file Zone.cs.

1116 {
1117 }

◆ OnBeforeSimulate()

virtual void Zone.OnBeforeSimulate ( )
inlinevirtual

Reimplemented in Zone_DungeonPuppy, and Zone_Nymelle.

Definition at line 1123 of file Zone.cs.

1124 {
1125 }

◆ OnChildNumChange()

void Zone.OnChildNumChange ( Card  c)
inline

Implements ICardParent.

Definition at line 1862 of file Zone.cs.

1863 {
1864 }

◆ OnCreate()

override void Zone.OnCreate ( )
inlinevirtual

Reimplemented from Spatial.

Definition at line 558 of file Zone.cs.

559 {
560 events.zone = this;
561 base.lv = StartLV;
562 }
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 2287 of file Zone.cs.

2288 {
2289 }

◆ OnDeactivate()

virtual void Zone.OnDeactivate ( )
inlinevirtual

Definition at line 1119 of file Zone.cs.

1120 {
1121 }

◆ OnGenerateMap()

virtual void Zone.OnGenerateMap ( )
inlinevirtual

Reimplemented in Zone_Arena2, Zone_CursedManor, Zone_CursedManorDungeon, Zone_Dungeon, Zone_DungeonPuppy, Zone_Field, Zone_Harvest, Zone_RandomDungeon, Zone_RandomDungeonFactory, Zone_SnowGrave, Zone_TestRoom, Zone_VernisMine, Zone_Void, and Zone_WindRest.

Definition at line 2485 of file Zone.cs.

2486 {
2488 {
2489 foreach (Chara chara in EClass._map.charas)
2490 {
2491 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral && chara.OriginalHostility < Hostility.Friend)
2492 {
2493 Hostility hostility2 = (chara.c_originalHostility = Hostility.Neutral);
2494 chara.hostility = hostility2;
2495 }
2496 }
2497 }
2498 if (PrespawnRate != 0f && !IsSkyLevel)
2499 {
2500 for (int i = 0; i < (int)((float)MaxSpawn * PrespawnRate); i++)
2501 {
2502 SpawnMob();
2503 }
2504 }
2509 }
Hostility
Definition: Hostility.cs:2
Hostility OriginalHostility
Definition: Chara.cs:467
Hostility hostility
Definition: Chara.cs:287
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:2538
void TryGenerateShrine()
Definition: Zone.cs:2575
void TryGenerateOre()
Definition: Zone.cs:2511
virtual bool MakeEnemiesNeutral
Definition: Zone.cs:229
void TryGenerateBigDaddy()
Definition: Zone.cs:2557

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

2628 {
2629 }

Referenced by MapGenDungen.OnGenerateTerrain().

◆ OnInspect()

void Zone.OnInspect ( )
inline

Implements IInspect.

Definition at line 3098 of file Zone.cs.

3099 {
3100 }

◆ OnKillGame()

void Zone.OnKillGame ( )
inline

Definition at line 1651 of file Zone.cs.

1652 {
1653 foreach (Thing thing in map.things)
1654 {
1655 if (thing.renderer.hasActor)
1656 {
1657 thing.renderer.KillActor();
1658 }
1659 }
1660 }
void KillActor()
CardRenderer renderer
Definition: Card.cs:57

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

1813 {
1814 if (branch != null)
1815 {
1816 branch.SetOwner(this);
1817 }
1818 events.OnLoad(this);
1819 }
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 1107 of file Zone.cs.

1108 {
1109 }

◆ OnSimulateDay()

void Zone.OnSimulateDay ( VirtualDate  date)
inline

Definition at line 3199 of file Zone.cs.

3200 {
3201 if (base.IsPlayerFaction)
3202 {
3203 branch.OnSimulateDay(date);
3204 }
3205 }
void OnSimulateDay(VirtualDate date)

References FactionBranch.OnSimulateDay().

Referenced by VirtualDate.SimulateDay().

◆ OnSimulateHour()

void Zone.OnSimulateHour ( VirtualDate  date)
inline

Definition at line 3144 of file Zone.cs.

3145 {
3146 if (base.IsPlayerFaction)
3147 {
3148 branch.OnSimulateHour(date);
3149 }
3151 if (date.IsRealTime)
3152 {
3153 foreach (Thing thing in EClass._map.things)
3154 {
3155 if (thing.IsInstalled)
3156 {
3157 thing.trait.TryToggle();
3158 }
3159 }
3161 }
3162 EClass._map.things.ForeachReverse(delegate(Thing t)
3163 {
3164 t.OnSimulateHour(date);
3165 });
3166 foreach (Thing sucker in Suckers)
3167 {
3168 sucker.Destroy();
3169 }
3170 Suckers.Clear();
3171 if (RespawnRate != 0f)
3172 {
3173 int num = 0;
3174 foreach (Chara chara in map.charas)
3175 {
3176 if (!chara.IsGlobal)
3177 {
3178 num++;
3179 }
3180 }
3181 if (num < MaxRespawn)
3182 {
3183 for (int i = 0; i < RespawnPerHour; i++)
3184 {
3185 SpawnMob();
3186 }
3187 }
3188 }
3189 if (!date.IsRealTime && EClass.rnd(24) == 0)
3190 {
3191 RainWater();
3192 }
3193 if (date.hour == 6)
3194 {
3195 GrowPlants(date);
3196 }
3197 }
virtual void OnSimulateHour(VirtualDate date)
Definition: Card.cs:6197
void DecayNatural(int hour=1)
Definition: Card.cs:6206
int hour
Definition: Date.cs:74
void OnSimulateHour(VirtualDate date)
virtual void TryToggle()
Definition: Trait.cs:1122
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:3234
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 3207 of file Zone.cs.

3208 {
3209 if (base.IsPlayerFaction)
3210 {
3211 branch.OnSimulateMonth(date);
3212 }
3213 if (date.IsRealTime)
3214 {
3216 }
3217 }
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 1032 of file Zone.cs.

1033 {
1035 {
1036 EClass.player.stats.deepest = DangerLv;
1037 }
1038 if (EClass.world.date.IsExpired(base.dateRevive))
1039 {
1041 Revive();
1042 foreach (Chara chara in EClass._map.charas)
1043 {
1044 chara.TryRestock(onCreate: false);
1045 if (!chara.IsPCFaction)
1046 {
1047 chara.c_fur = 0;
1048 }
1049 }
1050 }
1053 events.OnVisit();
1054 OnActivate();
1055 UpdateQuests();
1057 isSimulating = true;
1058 Simulate();
1059 isSimulating = false;
1061 if (EClass.Branch != null)
1062 {
1064 }
1065 base.lastActive = EClass.world.date.GetRaw();
1066 if (!EClass.game.isLoading)
1067 {
1068 base.visitCount++;
1069 }
1070 base.version = EClass.core.version.GetInt();
1071 }
Version version
Definition: BaseCore.cs:17
override bool IsPCFaction
Definition: Chara.cs:667
void TryRestock(bool onCreate)
Definition: Chara.cs:4392
void OnAfterSimulate()
int deepest
Definition: Player.cs:92
Stats stats
Definition: Player.cs:832
void AssignCharas()
Definition: RoomManager.cs:39
void Revive()
Definition: Zone.cs:1073
void Simulate()
Definition: Zone.cs:1139
virtual void OnAfterSimulate()
Definition: Zone.cs:1131
virtual bool CountDeepestLevel
Definition: Zone.cs:224
void RefreshCriminal()
Definition: Zone.cs:3372
virtual void OnBeforeSimulate()
Definition: Zone.cs:1123
virtual void OnActivate()
Definition: Zone.cs:1111
void ResetHostility()
Definition: Zone.cs:2611
void UpdateQuests(bool force=false)
Definition: Zone.cs:3424
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 1127 of file Zone.cs.

1128 {
1129 }

◆ RainWater()

void Zone.RainWater ( )
inline

Definition at line 3219 of file Zone.cs.

3220 {
3222 {
3223 return;
3224 }
3225 EClass._map.bounds.ForeachCell(delegate(Cell c)
3226 {
3227 if (c.IsFarmField && !c.HasRoof)
3228 {
3229 c.isWatered = true;
3230 }
3231 });
3232 }
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 2846 of file Zone.cs.

2847 {
2849 {
2850 return;
2851 }
2853 Playlist playlist = map.plDay;
2854 foreach (ZoneEvent item in events.list)
2855 {
2856 if (item.playlist != null)
2857 {
2858 playlist = item.playlist;
2859 }
2860 }
2861 if (IDPlaylistOverwrite != null)
2862 {
2863 playlist = EClass.Sound.GetPlaylist(IDPlaylistOverwrite);
2864 }
2866 {
2867 Room room = EClass.pc.pos.cell.room;
2868 if (room != null && room.lot != null && room.lot.idBGM != 0)
2869 {
2870 playlist = EClass.Sound.plLot;
2871 if (playlist.list[0].data?.id != room.lot.idBGM)
2872 {
2873 playlist.list[0].data = EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM);
2874 playlist.Reset();
2875 if (!LayerDrama.keepBGM)
2876 {
2877 EClass.Sound.StopBGM(1f);
2878 }
2879 }
2880 }
2881 }
2883 EClass.Sound.SwitchPlaylist(playlist, !LayerDrama.keepBGM);
2884 }
Room room
Definition: Cell.cs:102
bool IsInActiveZone
Definition: Chara.cs:834
void SetBGMInterval()
Definition: CoreConfig.cs:997
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:375
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.OnFirstTick(), LayerEditPlaylist.OnKill(), and ZoneEventSiege.OnKill().

◆ RefreshCriminal()

void Zone.RefreshCriminal ( )
inline

Definition at line 3372 of file Zone.cs.

3373 {
3374 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3375 Hostility hostility = (flag ? Hostility.Neutral : Hostility.Friend);
3376 foreach (Chara chara in EClass._map.charas)
3377 {
3378 if (chara.trait is TraitGuard)
3379 {
3380 chara.hostility = hostility;
3381 if (!flag && chara.enemy != null && chara.enemy.IsPCParty)
3382 {
3383 chara.SetEnemy();
3384 }
3385 }
3386 }
3387 }
Chara enemy
Definition: Chara.cs:86
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:5808
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 2740 of file Zone.cs.

2741 {
2742 dirtyElectricity = false;
2743 bool flag = GetSoilCost() > MaxSoil;
2744 base.electricity = elements.Value(2201) * 10 + BaseElectricity;
2745 foreach (Thing thing in EClass._map.things)
2746 {
2747 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
2748 {
2749 base.electricity += thing.trait.Electricity;
2750 }
2751 }
2752 if (!flag)
2753 {
2754 EClass._map.bounds.ForeachCell(delegate(Cell c)
2755 {
2756 if (c.sourceObj.id == 118 && c.growth.IsMature)
2757 {
2758 base.electricity += 20;
2759 }
2760 });
2761 }
2762 foreach (Thing thing2 in EClass._map.things)
2763 {
2764 if (thing2.IsInstalled)
2765 {
2766 thing2.trait.TryToggle();
2767 }
2768 }
2769 }
bool isOn
Definition: Card.cs:526
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 1022 of file Zone.cs.

1023 {
1024 if (idHat != null && EClass.world.date.IsExpired(base.dateHat))
1025 {
1026 idHat = null;
1027 base.dateHat = 0;
1028 }
1029 sourceHat = ((idHat != null) ? EClass.sources.cards.map[idHat] : ((IDHat != null) ? EClass.sources.cards.map[IDHat] : null));
1030 }
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 3389 of file Zone.cs.

3390 {
3391 if (base.lv != 0)
3392 {
3393 return;
3394 }
3395 dictCitizen.Clear();
3396 foreach (Chara item in map.charas.Concat(map.deadCharas))
3397 {
3398 if (item.trait.IsCitizen && !item.IsGlobal && !item.isSubsetCard)
3399 {
3400 dictCitizen[item.uid] = item.Name;
3401 }
3402 }
3403 }
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 2838 of file Zone.cs.

2839 {
2840 if (map.plDay == null)
2841 {
2842 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList));
2843 }
2844 }

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

1951 {
1952 if (IsActiveZone)
1953 {
1955 }
1956 t.parent = null;
1957 if (t.isChara)
1958 {
1959 t.Chara.currentZone = null;
1960 }
1961 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
1962 {
1964 }
1965 if (t.renderer.hasActor)
1966 {
1968 }
1969 }
override void OnLeaveScreen()
virtual bool isChara
Definition: Card.cs:2019
void OnCardRemovedFromZone(Card t)
Definition: Map.cs:819
void RemoveActorEx(Card c)
Definition: Scene.cs:1027
virtual string IDActorEx
Definition: Trait.cs:171

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

2612 {
2613 foreach (Chara chara in EClass._map.charas)
2614 {
2615 if (!chara.source.hostility.IsEmpty() && chara.source.hostility.ToEnum<Hostility>() >= Hostility.Friend && !chara.IsPCFactionOrMinion)
2616 {
2617 chara.c_originalHostility = (Hostility)0;
2618 }
2619 chara.hostility = chara.OriginalHostility;
2620 if (chara.enemy != null && (chara.enemy.IsPCFaction || chara.IsPCFaction))
2621 {
2622 chara.SetEnemy();
2623 }
2624 }
2625 }
bool IsPCFactionOrMinion
Definition: Card.cs:2208
SourceChara.Row source
Definition: Chara.cs:154

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

1074 {
1075 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
1076 if (ShouldAutoRevive)
1077 {
1078 foreach (Chara deadChara in map.deadCharas)
1079 {
1080 if (deadChara.trait.CanAutoRevive && deadChara.CanRevive())
1081 {
1082 deadChara.Revive();
1084 {
1085 deadChara.RemoveBacker();
1086 }
1087 EClass._zone.AddCard(deadChara, (deadChara.orgPos != null && deadChara.orgPos.IsInBounds) ? deadChara.orgPos : deadChara.pos);
1088 }
1089 }
1090 }
1091 foreach (Chara value in EClass.game.cards.globalCharas.Values)
1092 {
1093 if (value.isDead && value.CanRevive() && value.homeZone == this)
1094 {
1095 value.Revive();
1096 Point point = GetSpawnPos(value);
1097 if (value.orgPos != null && value.orgPos.IsInBounds)
1098 {
1099 point = value.orgPos.GetNearestPoint() ?? point;
1100 }
1101 EClass._zone.AddCard(value, point);
1102 }
1103 }
1104 map.deadCharas.Clear();
1105 }
int c_idBacker
Definition: Card.cs:1397
bool CanRevive()
Definition: Chara.cs:4720
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:4746
Zone homeZone
Definition: Chara.cs:263
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 2833 of file Zone.cs.

2834 {
2835 SetBGM(new List<int> { id }, refresh);
2836 }

◆ SetBGM() [2/2]

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

Definition at line 2810 of file Zone.cs.

2811 {
2812 map._plDay.Clear();
2813 if (ids.Count > 0)
2814 {
2815 foreach (int id in ids)
2816 {
2817 if (id != -1)
2818 {
2819 map._plDay.Add(id);
2820 }
2821 }
2822 }
2823 UnityEngine.Object.DestroyImmediate(map.plDay);
2824 map.plDay = null;
2826 if (refresh)
2827 {
2828 EClass.Sound.StopBGM();
2829 RefreshBGM();
2830 }
2831 }

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

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

◆ Simulate()

void Zone.Simulate ( )
inline

Definition at line 1139 of file Zone.cs.

1140 {
1141 if (!EClass.game.isLoading && base.visitCount > 0)
1142 {
1143 if (Boss != null && IsNefia)
1144 {
1145 Msg.Say("bossLeave", Boss.Name.ToTitleCase(), EClass._zone.Name);
1148 }
1149 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1150 foreach (Chara chara2 in EClass._map.charas)
1151 {
1152 if (chara2.hp < 0)
1153 {
1154 chara2.hp = 0;
1155 }
1156 if (!chara2.IsPCParty)
1157 {
1158 if (chara2.mana.value < 0)
1159 {
1160 chara2.mana.value = 0;
1161 }
1162 if (chara2.stamina.value < 0)
1163 {
1164 chara2.stamina.value = 0;
1165 }
1166 }
1167 if (num > 60)
1168 {
1169 chara2.resistCon = null;
1170 }
1171 if (chara2.rarity >= Rarity.Legendary && !chara2.IsPCFaction && num > 0)
1172 {
1173 Msg.ignoreAll = true;
1174 chara2.Cure(CureType.Boss, 20 + num * 10);
1175 chara2.HealHP(Mathf.Max(1, chara2.MaxHP) * Mathf.Min(num, 20) / 20);
1176 chara2.mana.Mod(Mathf.Max(1, chara2.mana.max) * Mathf.Min(num, 20) / 20);
1177 chara2.stamina.Mod(Mathf.Max(1, chara2.stamina.max) * Mathf.Min(num, 20) / 20);
1178 Msg.ignoreAll = false;
1179 }
1180 }
1181 }
1182 Debug.Log("Last Active:" + base.lastActive);
1183 if (base.lastActive == 0 || HourSinceLastActive <= 1 || IsRegion)
1184 {
1185 return;
1186 }
1187 Debug.Log(Name + " Simulate:" + HourSinceLastActive + " hours");
1188 VirtualDate virtualDate = new VirtualDate(HourSinceLastActive);
1189 List<Chara> list = EClass._map.charas.ToList();
1190 int num2 = HourSinceLastActive / 24;
1191 int num3 = 0;
1192 if (num2 > 0)
1193 {
1194 foreach (Chara item in list)
1195 {
1196 if (!item.IsPCParty)
1197 {
1198 item.OnSleep(200, num2);
1199 if (item.conSleep != null)
1200 {
1201 item.conSleep.Kill();
1202 }
1203 if (EClass.rnd(EClass.world.date.IsNight ? 20 : 200) == 0 && !item.IsPCFaction)
1204 {
1205 item.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
1206 }
1207 if (item.things.Count > 20)
1208 {
1209 item.ClearInventory(ClearInventoryType.Purge);
1210 }
1211 }
1212 }
1213 }
1214 VirtualDate.current = virtualDate;
1215 for (int i = 0; i < HourSinceLastActive; i++)
1216 {
1217 virtualDate.SimulateHour();
1218 if (!virtualDate.IsWinter)
1219 {
1220 num3++;
1221 }
1222 }
1223 EClass._map.things.ForeachReverse(delegate(Thing t)
1224 {
1226 });
1227 VirtualDate.current = null;
1228 if (!IsPCFaction)
1229 {
1230 return;
1231 }
1232 int num4 = 0;
1233 foreach (Chara item2 in list)
1234 {
1235 if (item2.IsPCParty)
1236 {
1237 continue;
1238 }
1239 if (!item2.IsHomeMember())
1240 {
1241 if (item2.id == "bee")
1242 {
1243 num4++;
1244 }
1245 if (num2 > 0 && item2.IsGuest())
1246 {
1247 item2.ChooseNewGoal();
1248 item2.ai.SimulateZone(num2);
1249 }
1250 continue;
1251 }
1252 if (num2 > 0)
1253 {
1254 Goal goalWork = item2.GetGoalWork();
1255 item2.SetAI(goalWork);
1256 if (goalWork is GoalWork)
1257 {
1258 (goalWork as GoalWork).FindWork(item2);
1259 }
1260 item2.ai.SimulateZone(num2);
1261 goalWork = item2.GetGoalHobby();
1262 item2.SetAI(goalWork);
1263 if (goalWork is GoalWork)
1264 {
1265 (goalWork as GoalWork).FindWork(item2);
1266 }
1267 item2.ai.SimulateZone(num2);
1268 }
1269 item2.ChooseNewGoal();
1270 if (item2.conSuspend == null)
1271 {
1272 item2.ai.OnSimulatePosition();
1273 }
1274 }
1275 List<Thing> list2 = new List<Thing>();
1276 foreach (Thing thing in map.things)
1277 {
1278 if (thing.IsInstalled && thing.trait is TraitBeekeep)
1279 {
1280 list2.Add(thing);
1281 }
1282 }
1283 if (num4 >= list2.Count)
1284 {
1285 return;
1286 }
1287 for (int j = num4; j < list2.Count; j++)
1288 {
1289 if (EClass.rnd(200) <= HourSinceLastActive)
1290 {
1291 Chara chara = CharaGen.Create("bee");
1292 AddCard(chara, list2.RandomItem().pos);
1293 Hostility c_originalHostility = (chara.hostility = Hostility.Neutral);
1294 chara.c_originalHostility = c_originalHostility;
1295 }
1296 }
1297 }
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:3848
int hp
Definition: Card.cs:226
string Name
Definition: Card.cs:2073
AIAct ai
Definition: Chara.cs:198
ConSuspend conSuspend
Definition: Chara.cs:104
Goal GetGoalWork()
Definition: Chara.cs:8149
override int MaxHP
Definition: Chara.cs:704
Goal GetGoalHobby()
Definition: Chara.cs:8162
Stats mana
Definition: Chara.cs:1006
Stats stamina
Definition: Chara.cs:998
bool IsHomeMember()
Definition: Chara.cs:6092
bool IsGuest()
Definition: Chara.cs:6117
void ChooseNewGoal()
Definition: Chara.cs:8085
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:8795
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 2446 of file Zone.cs.

2447 {
2449 {
2450 if (r.points.Count <= 4)
2451 {
2452 return false;
2453 }
2454 map.poiMap.OccyupyPOI(r.points[0]);
2455 List<Point> points = r.points;
2456 Religion randomReligion = EClass.game.religions.GetRandomReligion();
2457 "altarPoint".lang(randomReligion.NameDomain.lang());
2458 Thing thing = ThingGen.Create("altar");
2459 (thing.trait as TraitAltar).SetDeity(randomReligion.id);
2460 Chara t = CharaGen.Create("twintail");
2461 EClass._zone.AddCard(t, points.RandomItem());
2462 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2463 {
2464 Chara t2 = CharaGen.Create("twintail");
2465 EClass._zone.AddCard(t2, points.RandomItem());
2466 }
2467 if (points[0].Installed == null)
2468 {
2469 EClass._zone.AddCard(thing, points[0]).Install();
2470 }
2471 foreach (Point item in points)
2472 {
2473 if (item.x % 3 == 0 && item.z % 2 == 0 && item != points[0] && !item.Equals(points[0].Front) && item.Installed == null)
2474 {
2475 thing = ThingGen.Create("pillar1");
2476 EClass._zone.AddCard(thing, item).Install();
2477 }
2478 item.SetObj();
2479 item.SetFloor(3, 6);
2480 }
2481 return true;
2482 });
2483 }
Crawler start
Definition: CoreRef.cs:212
Crawlers crawlers
Definition: CoreRef.cs:333
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 3547 of file Zone.cs.

3548 {
3549 for (int i = 0; i < 2 + EClass.rnd(4); i++)
3550 {
3551 Point point = GetPos();
3552 if (point == null)
3553 {
3554 continue;
3555 }
3556 if (EClass.rnd(30) == 0)
3557 {
3558 Thing thing = ThingGen.Create("purse");
3559 thing.isLostProperty = true;
3560 thing.things.DestroyAll();
3561 int num2 = (thing.c_lockLv = EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3562 thing.Add("money", EClass.rndHalf(num2 * 60 + 1000));
3563 if (EClass.rnd(2) == 0)
3564 {
3565 thing.Add("plat", EClass.rnd(4));
3566 }
3567 else
3568 {
3569 thing.Add("medal", EClass.rnd(2));
3570 }
3571 EClass._zone.AddCard(thing, point);
3572 }
3573 else
3574 {
3576 }
3577 }
3578 static Point GetPos()
3579 {
3580 for (int j = 0; j < 10; j++)
3581 {
3582 Point randomPoint = EClass._zone.bounds.GetRandomPoint();
3583 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
3584 {
3585 return randomPoint;
3586 }
3587 }
3588 return null;
3589 }
3590 }
ThingContainer things
Definition: Card.cs:34
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:2997
static int rndHalf(int a)
Definition: EClass.cs:82
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 2645 of file Zone.cs.

2646 {
2647 if (setting == null)
2648 {
2650 }
2651 if (pos == null)
2652 {
2653 pos = GetSpawnPos(setting.position, setting.tries);
2654 if (pos == null)
2655 {
2656 pos = GetSpawnPos(SpawnPosition.Random, setting.tries);
2657 if (pos == null)
2658 {
2659 return null;
2660 }
2661 }
2662 }
2664 if (IsUnderwater && EClass.rnd(15) != 0)
2665 {
2667 }
2668 SpawnList spawnList = null;
2669 spawnList = ((setting.idSpawnList != null) ? SpawnList.Get(setting.idSpawnList) : ((EClass._zone is Zone_DungeonYeek) ? SpawnListChara.Get("dungeon_yeek", (SourceChara.Row r) => r.race == "yeek") : ((setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) < ChanceSpawnNeutral)) ? SpawnList.Get("c_neutral") : ((biome.spawn.chara.Count <= 0) ? SpawnList.Get(biome.name, "chara", new CharaFilter
2670 {
2671 ShouldPass = delegate(SourceChara.Row s)
2672 {
2673 if (s.hostility != "")
2674 {
2675 return false;
2676 }
2677 return s.biome == biome.name || s.biome.IsEmpty();
2678 }
2680 int dangerLv = DangerLv;
2681 CardBlueprint cardBlueprint = new CardBlueprint
2682 {
2683 rarity = Rarity.Normal,
2684 idEle = setting.idEle
2685 };
2686 int num = ((setting.filterLv == -1) ? dangerLv : setting.filterLv);
2688 {
2689 num = ((dangerLv - 1) % 50 + 5) * 150 / 100;
2690 }
2691 CardRow cardRow = (setting.id.IsEmpty() ? spawnList.Select(num, setting.levelRange) : EClass.sources.cards.map[setting.id]);
2692 int num2 = ((setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv);
2694 {
2695 num2 = (50 + cardRow.LV) * Mathf.Max(1, (dangerLv - 1) / 50);
2696 }
2697 if (setting.rarity == Rarity.Random)
2698 {
2699 if (EClass.rnd(100) == 0)
2700 {
2701 cardBlueprint.rarity = Rarity.Legendary;
2702 num2 = num2 * 125 / 100;
2703 }
2704 }
2705 else
2706 {
2707 cardBlueprint.rarity = setting.rarity;
2708 }
2709 if (setting.isBoss)
2710 {
2711 num2 = num2 * 150 / 100;
2712 }
2713 if (setting.isEvolved)
2714 {
2715 num2 = num2 * 2 + 20;
2716 }
2717 if (num2 != cardRow.LV)
2718 {
2719 cardBlueprint.lv = num2;
2720 }
2721 CardBlueprint.Set(cardBlueprint);
2722 Chara chara = CharaGen.Create(cardRow.id, num);
2723 AddCard(chara, pos);
2724 if (setting.forcedHostility.HasValue)
2725 {
2726 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
2727 chara.c_originalHostility = c_originalHostility;
2728 }
2729 if (setting.isBoss)
2730 {
2731 chara.c_bossType = BossType.Boss;
2732 }
2733 if (setting.isEvolved)
2734 {
2735 chara.c_bossType = BossType.Evolved;
2736 }
2737 return chara;
2738 }
BossType
Definition: BossType.cs:2
SpawnHostility
string GetRandomCharaId()
static void Set(CardBlueprint _bp)
string id
Definition: CardRow.cs:7
BiomeProfile biome
Definition: Cell.cs:1075
BiomeProfile Water
Definition: CoreRef.cs:150
BiomeProfile Sand
Definition: CoreRef.cs:148
Biomes biomes
Definition: CoreRef.cs:331
static int Range(int min, int max)
Definition: Rand.cs:42
int LV
Definition: RenderRow.cs:22
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:29
virtual float ChanceSpawnNeutral
Definition: Zone.cs:340
virtual bool ScaleMonsterLevel
Definition: Zone.cs:406

References 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(), ZonePreEnterEncounter.Execute(), Zone_RandomDungeon.OnGenerateMap(), Zone_Void.OnGenerateMap(), ZoneEventHarvest.OnVisit(), ZoneEventQuest.Spawn(), ZoneEventQuest.SpawnBoss(), CoreDebug.SpawnBoss(), GenRoom.SpawnMob(), CoreDebug.TestSpawn(), TraitSpotSpawn.Update(), and CoreDebug.UpdateInput().

◆ TextLevel()

string Zone.TextLevel ( int  _lv)
inline

Definition at line 545 of file Zone.cs.

546 {
547 if (_lv != 0)
548 {
549 if (base.lv <= 0)
550 {
551 return " " + "zoneLevelB".lang((_lv * -1).ToString() ?? "");
552 }
553 return " " + "zoneLevel".lang((_lv + 1).ToString() ?? "");
554 }
555 return "";
556 }
override string ToString()
Definition: Zone.cs:540

References ToString().

◆ ToString()

override string Zone.ToString ( )
inline

Definition at line 540 of file Zone.cs.

541 {
542 return Name + "(" + base.uid + ")(" + _regionPos?.ToString() + ") instance?" + IsInstance + "/" + EClass.world.date.GetRemainingHours(base.dateExpire) + "h";
543 }
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 2150 of file Zone.cs.

2151 {
2152 int num = 0;
2153 if (p.cell.detail != null)
2154 {
2155 foreach (Thing thing in p.cell.detail.things)
2156 {
2157 if (thing.placeState == PlaceState.roaming)
2158 {
2159 if (target.TryStackTo(thing))
2160 {
2161 return true;
2162 }
2163 num++;
2164 }
2165 }
2166 }
2167 if (num == 0 || !destroyIfFail)
2168 {
2169 EClass._zone.AddCard(target, p);
2170 return true;
2171 }
2172 target.Destroy();
2173 return false;
2174 }
bool TryStackTo(Thing to)
Definition: Card.cs:3258
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 2053 of file Zone.cs.

2054 {
2055 Thing dest = null;
2056 int priority = -1;
2057 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
2058 if (flag == ContainerFlag.none)
2059 {
2060 flag = ContainerFlag.other;
2061 }
2062 if (containers == null)
2063 {
2064 containers = EClass._map.props.installed.containers;
2065 }
2066 if (SearchDest() != null)
2067 {
2068 return true;
2069 }
2070 if (dest == null)
2071 {
2072 return false;
2073 }
2074 if (add)
2075 {
2076 if (msg)
2077 {
2078 chara.Say("putSharedItem", chara, t, dest.GetName(NameStyle.Full));
2079 }
2080 dest.AddThing(t);
2081 }
2082 return true;
2083 Thing SearchDest()
2084 {
2085 foreach (Thing container in containers)
2086 {
2087 Thing thing = container;
2088 if (thing.trait is TraitShippingChest)
2089 {
2091 }
2092 if ((!sharedOnly || thing.IsSharedContainer) && thing.c_lockLv <= 0 && (thing.things.Count < thing.things.MaxCapacity || thing.things.CanStack(t) != t))
2093 {
2094 Window.SaveData windowSaveData = thing.GetWindowSaveData();
2095 if (windowSaveData != null)
2096 {
2097 if (windowSaveData.priority <= priority || (windowSaveData.noRotten && t.IsDecayed) || (windowSaveData.onlyRottable && t.trait.Decay == 0))
2098 {
2099 continue;
2100 }
2102 if (windowSaveData.userFilter)
2103 {
2104 filterResult = windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1));
2105 if (filterResult == Window.SaveData.FilterResult.Block)
2106 {
2107 continue;
2108 }
2109 }
2110 if (filterResult != Window.SaveData.FilterResult.PassWithoutFurtherTest)
2111 {
2112 if (windowSaveData.advDistribution)
2113 {
2114 bool flag2 = false;
2115 foreach (int cat in windowSaveData.cats)
2116 {
2117 if (t.category.uid == cat)
2118 {
2119 flag2 = true;
2120 break;
2121 }
2122 }
2123 if (!flag2)
2124 {
2125 continue;
2126 }
2127 }
2128 else if (windowSaveData.flag.HasFlag(flag))
2129 {
2130 continue;
2131 }
2132 }
2133 priority = windowSaveData.priority;
2134 }
2135 else
2136 {
2137 if (priority != -1)
2138 {
2139 continue;
2140 }
2141 priority = 0;
2142 }
2143 dest = thing;
2144 }
2145 }
2146 return null;
2147 }
2148 }
ContainerFlag
Definition: ContainerFlag.cs:5
NameStyle
Definition: NameStyle.cs:2
Thing container_shipping
Definition: CardManager.cs:52
bool IsDecayed
Definition: Card.cs:2223
int c_lockLv
Definition: Card.cs:936
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3020
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2452
SourceCategory.Row category
Definition: Card.cs:1985
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6423
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:498
bool IsSharedContainer
Definition: Thing.cs:92
virtual int Decay
Definition: Trait.cs:119
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 1976 of file Zone.cs.

1976 : Trait
1977 {
1978 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<T>();
1979 if (randomThing == null)
1980 {
1982 return false;
1983 }
1984 if (useContainer && (!t.IsContainer || t.things.Count == 0))
1985 {
1986 List<Thing> list = new List<Thing>();
1987 foreach (Point item in randomThing.trait.ListPoints(null, onlyPassable: false))
1988 {
1989 foreach (Card item2 in item.ListCards())
1990 {
1991 if (item2.IsContainer && !(item2.trait is TraitDeliveryChest))
1992 {
1993 list.Add(item2.Thing);
1994 }
1995 }
1996 }
1997 if (TryAddThingInSharedContainer(t, list, add: true, msg: false, null, sharedOnly: false))
1998 {
1999 return true;
2000 }
2001 }
2002 AddCard(t, randomThing.trait.GetRandomPoint());
2003 return true;
2004 }
virtual Thing Thing
Definition: Card.cs:1994
bool IsContainer
Definition: Card.cs:2025
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
Definition: Trait.cs:745
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:727
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2053

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

2558 {
2559 if (!(BigDaddyChance <= EClass.rndf(1f)))
2560 {
2561 int num = DangerLv * 125 / 100;
2562 if (num >= 30)
2563 {
2565 {
2566 lv = num
2567 });
2568 }
2569 Chara t = CharaGen.Create("big_daddy");
2570 EClass._zone.AddCard(t, GetSpawnPos(SpawnPosition.Random, 10000));
2571 Msg.Say("sign_bigdaddy");
2572 }
2573 }
static float rndf(float a)
Definition: EClass.cs:87
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 2538 of file Zone.cs.

2539 {
2540 if (!force && EvolvedChance <= EClass.rndf(1f))
2541 {
2542 return null;
2543 }
2544 Chara chara = SpawnMob(p, SpawnSetting.Evolved());
2545 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2546 {
2547 chara.ability.AddRandom();
2548 }
2549 chara.AddThing(chara.MakeGene(DNA.Type.Default));
2550 if (EClass.rnd(2) == 0)
2551 {
2552 chara.AddThing(chara.MakeGene(DNA.Type.Superior));
2553 }
2554 return chara;
2555 }
void AddRandom()
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:7546
CharaAbility ability
Definition: Chara.cs:420
Definition: DNA.cs:8
Type
Definition: DNA.cs:10
static SpawnSetting Evolved(int fixedLv=-1)
Definition: SpawnSetting.cs:33
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 Zone_Dungeon.OnGenerateMap(), and ZoneEventQuest.SpawnBoss().

◆ TryGenerateOre()

void Zone.TryGenerateOre ( )
inline

Definition at line 2511 of file Zone.cs.

2512 {
2513 if (OreChance <= 0f)
2514 {
2515 return;
2516 }
2517 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)
2518 {
2519 byte b = 18;
2520 string group = "ore";
2521 if (EClass.rnd(5) == 0)
2522 {
2523 b++;
2524 group = "gem";
2525 }
2526 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(DangerLv, group);
2527 foreach (Point point in r.points)
2528 {
2529 if (point.sourceBlock.ContainsTag("ore"))
2530 {
2531 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2532 }
2533 }
2534 return false;
2535 });
2536 }
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:43
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 2575 of file Zone.cs.

2576 {
2577 for (int i = 0; i < 3; i++)
2578 {
2579 Rand.SetSeed(base.uid + i);
2580 if (ShrineChance <= EClass.rndf(1f))
2581 {
2582 continue;
2583 }
2584 Point randomSpace = EClass._map.GetRandomSpace(3, 3);
2585 if (randomSpace == null)
2586 {
2587 continue;
2588 }
2589 randomSpace.x++;
2590 randomSpace.z++;
2591 if (randomSpace.HasThing || randomSpace.HasChara)
2592 {
2593 continue;
2594 }
2595 randomSpace.SetObj();
2598 if (EClass.rnd(EClass.debug.test ? 2 : 15) == 0)
2599 {
2600 EClass._zone.AddCard(ThingGen.Create("pedestal_power"), randomSpace).Install();
2601 EClass._zone.AddCard(ThingGen.Create(EClass.gamedata.godStatues.RandomItemWeighted((GodStatueData a) => a.chance).idThing, -1, DangerLv), randomSpace).Install();
2602 }
2603 else
2604 {
2605 EClass._zone.AddCard(ThingGen.Create("statue_power", -1, DangerLv), randomSpace).Install().SetRandomDir();
2606 }
2607 }
2608 Rand.SetSeed();
2609 }
void SetRandomDir()
Definition: Card.cs:5838
bool test
Definition: CoreDebug.cs:169
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:760
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:908
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 2192 of file Zone.cs.

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

2177 {
2178 foreach (Thing container in EClass._map.props.installed.containers)
2179 {
2180 if (container.IsSharedContainer)
2181 {
2182 Thing thing = container.things.Find(func);
2183 if (thing != null)
2184 {
2185 return thing;
2186 }
2187 }
2188 }
2189 return null;
2190 }

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

2006 : TraitSpot
2007 {
2008 List<T> list = new List<T>();
2009 List<Thing> list2 = new List<Thing>();
2010 foreach (Thing thing in EClass._map.things)
2011 {
2012 if (thing.IsInstalled && thing.trait is T)
2013 {
2014 list.Add(thing.trait as T);
2015 }
2016 }
2017 foreach (T item in list)
2018 {
2019 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2020 {
2021 foreach (Thing thing2 in item2.Things)
2022 {
2023 if (!thing2.IsInstalled)
2024 {
2025 continue;
2026 }
2027 if (thing2.things.Count == 0)
2028 {
2029 if (IsValid(thing2))
2030 {
2031 list2.Add(thing2);
2032 }
2033 continue;
2034 }
2035 foreach (Thing item3 in thing2.things.List((Thing _t) => IsValid(_t)))
2036 {
2037 list2.Add(item3);
2038 }
2039 }
2040 }
2041 }
2042 return list2;
2043 bool IsValid(Thing t)
2044 {
2045 if (func != null && !func(t))
2046 {
2047 return false;
2048 }
2049 return true;
2050 }
2051 }
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 2412 of file Zone.cs.

2413 {
2414 bool flag = EClass.pc.HasCondition<ConDrawBacker>();
2415 if (!EClass.debug.enable && EClass.rnd(flag ? 3 : 20) != 0)
2416 {
2417 return;
2418 }
2419 Point randomSurface = EClass._map.bounds.GetRandomSurface();
2420 if (!randomSurface.IsValid)
2421 {
2422 return;
2423 }
2424 Chara c = CharaGen.Create("follower");
2425 EClass._zone.AddCard(c, randomSurface);
2426 (EClass._zone.AddThing("gallows", randomSurface).Install().trait as TraitShackle).Restrain(c);
2427 c.c_rescueState = RescueState.WaitingForRescue;
2428 if (EClass.rnd(flag ? 1 : 2) == 0 || EClass.debug.enable)
2429 {
2431 if (row != null)
2432 {
2433 c.ApplyBacker(row.id);
2434 }
2435 }
2436 Religion faith = EClass.game.religions.dictAll.Values.Where((Religion a) => a != c.faith).RandomItem();
2437 for (int i = 0; i < 3 + EClass.rnd(4); i++)
2438 {
2439 Chara chara = CharaGen.Create("fanatic");
2440 chara.SetFaith(faith);
2441 Point point = randomSurface.GetRandomPoint(4) ?? randomSurface.GetNearestPoint();
2442 EClass._zone.AddCard(chara, point);
2443 }
2444 }
RescueState
Definition: RescueState.cs:2
static int indexFollower
bool HasCondition(string alias)
Definition: Chara.cs:8716
Religion faith
Definition: Chara.cs:435
void SetFaith(string id)
Definition: Chara.cs:1538
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 1662 of file Zone.cs.

1663 {
1664 map = null;
1665 if (bp != null)
1666 {
1667 bp.map = null;
1668 }
1669 if (branch != null)
1670 {
1672 }
1673 Debug.Log("Unloaded Map:" + this);
1674 }
void OnUnloadMap()

References Debug, and FactionBranch.OnUnloadMap().

Referenced by Activate().

◆ UpdateQuests()

void Zone.UpdateQuests ( bool  force = false)
inline

Definition at line 3424 of file Zone.cs.

3425 {
3426 if (!IsPCFaction && (!(this is Zone_Town) || base.lv != 0))
3427 {
3428 return;
3429 }
3430 Debug.Log("Updating Quest:" + force);
3431 List<SourceQuest.Row> list = EClass.sources.quests.rows.Where((SourceQuest.Row a) => a.group == "random").ToList();
3432 int num = 0;
3433 foreach (Chara item in map.charas.Concat(map.deadCharas))
3434 {
3435 if (item.quest != null && !EClass.game.quests.list.Contains(item.quest))
3436 {
3437 if (item.quest.IsExpired || completedQuests.Contains(item.quest.uid) || force)
3438 {
3439 item.quest = null;
3440 }
3441 else
3442 {
3443 num++;
3444 }
3445 }
3446 }
3447 if (EClass._zone.dateQuest > EClass.world.date.GetRaw() && !force)
3448 {
3449 return;
3450 }
3451 EClass._zone.dateQuest = EClass.world.date.GetRaw() + 1440;
3452 int maxQuest = 3;
3453 Rand.UseSeed(base.uid + EClass.player.stats.days / 7 % 100, delegate
3454 {
3455 maxQuest = 4 + EClass.rnd(4);
3456 });
3457 completedQuests.Clear();
3458 List<Zone> list2 = Quest.ListDeliver();
3459 List<Tuple<string, int>> listTag = new List<Tuple<string, int>>();
3460 string[] array = EClass._zone.source.questTag;
3462 {
3463 array = new string[9] { "supply/8", "deliver/7", "food/8", "escort/4", "deliver/4", "monster/0", "war/0", "farm/0", "music/0" };
3464 }
3465 string[] array2 = array;
3466 for (int i = 0; i < array2.Length; i++)
3467 {
3468 string[] array3 = array2[i].Split('/');
3469 listTag.Add(new Tuple<string, int>(array3[0], array3[1].ToInt()));
3470 }
3471 for (int j = 0; j < map.charas.Count * 2; j++)
3472 {
3473 if (num > maxQuest)
3474 {
3475 break;
3476 }
3477 if (num > 15)
3478 {
3479 break;
3480 }
3481 Chara chara = map.charas.RandomItem();
3482 if (!chara.trait.CanGiveRandomQuest || chara.isSubsetCard || chara.homeZone != EClass._zone || chara.IsGuest() || chara.memberType == FactionMemberType.Livestock || (chara.quest != null && !force))
3483 {
3484 continue;
3485 }
3486 SourceQuest.Row row = list.RandomItemWeighted(delegate(SourceQuest.Row a)
3487 {
3488 int num2 = 1;
3489 foreach (Tuple<string, int> item2 in listTag)
3490 {
3491 if (a.tags.Contains(item2.Item1))
3492 {
3493 num2 = item2.Item2;
3494 break;
3495 }
3496 }
3497 if (!EClass._zone.IsPCFaction && a.tags.Contains("bulk"))
3498 {
3499 num2 = 0;
3500 }
3501 return a.chance * num2;
3502 });
3503 if ((!row.tags.Contains("needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame < EClass.player.fame || EClass.debug.enable))
3504 {
3505 Quest.Create(row.id, null, chara);
3506 num++;
3507 }
3508 }
3509 }
QuestManager quests
Definition: Game.cs:179
int days
Definition: Player.cs:68
int fame
Definition: Player.cs:700
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:118
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 3094 of file Zone.cs.

3095 {
3096 }

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 486 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:2546

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

439 {
440 get
441 {
443 {
444 return base.mainFaction == EClass.pc.faction;
445 }
446 return true;
447 }
448 }
bool godBuild
Definition: CoreDebug.cs:303
bool ignoreBuildRule
Definition: CoreDebug.cs:184

◆ CanEnterBuildModeAnywhere

bool Zone.CanEnterBuildModeAnywhere
get

Definition at line 450 of file Zone.cs.

451 {
452 get
453 {
455 {
456 if (base.mainFaction == EClass.pc.faction)
457 {
458 return EClass.Branch.elements.Has(4003);
459 }
460 return false;
461 }
462 return true;
463 }
464 }
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 490 of file Zone.cs.

491 {
492 get
493 {
494 if (!IsInstance)
495 {
496 return !HiddenInRegionMap;
497 }
498 return false;
499 }
500 }
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:528

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

◆ InspectPoint

Point Zone.InspectPoint
get

Implements IInspect.

Definition at line 504 of file Zone.cs.

◆ InspectPosition

Vector3 Zone.InspectPosition
get

Implements IInspect.

Definition at line 506 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 484 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 466 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 468 of file Zone.cs.

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

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

◆ 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

virtual bool Zone.IsSkyLevel
get

◆ IsStartZone

bool Zone.IsStartZone
get

Definition at line 480 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 508 of file Zone.cs.

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

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().

◆ ScaleMonsterLevel

virtual bool Zone.ScaleMonsterLevel
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().

◆ TextDeepestLv

string Zone.TextDeepestLv
get

Definition at line 426 of file Zone.cs.

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

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: