Elin Decompiled Documentation EA 23.351.2 Nightly
Loading...
Searching...
No Matches
Region Class Reference
Inheritance diagram for Region:
Zone Spatial ICardParent IInspect EClass

Public Member Functions

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

Public Attributes

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

Properties

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

Private Member Functions

void _OnDeserialized (StreamingContext context)
 

Additional Inherited Members

- Public Types inherited from IInspect
enum  NoteMode { Default , Recipe , Product , Info }
 
- Static Public Member Functions inherited from Zone
static string string int zoneLv ParseZoneFullName (string zoneFullName)
 
static bool IsImportValid (string path)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from Zone
static bool forceRegenerate
 
static string forceSubset
 
static CardRow sourceHat
 
static int okaerinko = 0
 
static bool ignoreSpawnAnime
 
static List< Thing > Suckers = new List<Thing>()
 
static string zoneType
 
static string string zoneId
 
- Static Public Attributes inherited from EClass
static Core core
 
- Protected Member Functions inherited from Spatial
Zone _FindZone (string _id)
 
- Protected Attributes inherited from Spatial
Point _regionPos = new Point()
 

Detailed Description

Definition at line 7 of file Region.cs.

Member Function Documentation

◆ _OnDeserialized()

void Region._OnDeserialized ( StreamingContext  context)
inlineprivate

Definition at line 389 of file Region.cs.

390 {
391 for (int num = children.Count - 1; num >= 0; num--)
392 {
393 if (!EClass.sources.zones.map.ContainsKey(children[num].id))
394 {
395 RemoveChild(children[num]);
396 }
397 }
398 }
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:43
SourceZone zones
void RemoveChild(Spatial child)
Definition: Spatial.cs:709
List< Spatial > children
Definition: Spatial.cs:37

References EClass.sources, and SourceManager.zones.

◆ CanCreateZone()

bool Region.CanCreateZone ( Point  pos)
inline

Definition at line 257 of file Region.cs.

258 {
261 if (!tileInfo.idZoneProfile.IsEmpty())
262 {
263 return !tileInfo.blocked;
264 }
265 return false;
266 }
static Scene scene
Definition: EClass.cs:31
static World world
Definition: EClass.cs:41
void Initialize(EloMap _elomap)
Definition: EloMapActor.cs:28
EloMap elomap
Definition: EloMapActor.cs:7
string idZoneProfile
Definition: EloMap.cs:68
bool blocked
Definition: EloMap.cs:34
TileInfo GetTileInfo(int gx, int gy)
Definition: EloMap.cs:286
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
EloMap elomap
Definition: Region.cs:9
EloMapActor elomapActor
Definition: Scene.cs:101
Region region
Definition: World.cs:23

References EloMap.TileInfo.blocked, EloMapActor.elomap, elomap, Scene.elomapActor, EloMap.GetTileInfo(), EloMap.TileInfo.idZoneProfile, EloMapActor.Initialize(), World.region, EClass.scene, EClass.world, Point.x, and Point.z.

Referenced by Player.EnterLocalZone().

◆ CheckRandomSites()

void Region.CheckRandomSites ( )
inline

Definition at line 76 of file Region.cs.

77 {
79 {
82 }
83 TryAddZone("cave_fairy");
84 TryAddZone("foxtown_nefu");
85 TryAddZone("little_garden");
86 TryAddZone("cave_yeek");
87 TryAddZone("cave_dragon");
88 TryAddZone("cave_mino");
89 TryAddZone("village_exile");
90 TryAddZone("temple_undersea");
91 TryAddZone("curryruin");
92 TryAddZone("cave_dead");
93 TryAddZone("oldkeep");
94 elomap.objmap.UpdateMeshImmediate();
95 void TryAddZone(string id)
96 {
97 if (FindZone(id) == null)
98 {
99 SpatialGen.Create(id, this, register: true);
100 }
101 }
102 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
bool IsExpired(int time)
Definition: Date.cs:338
STETilemap objmap
Definition: EloMap.cs:102
void UpdateRandomSites()
Definition: Region.cs:115
int dateCheckSites
Definition: Region.cs:12
static Spatial Create(string id, Spatial parent, bool register, int x=-99999, int y=-99999, int icon=0)
Definition: SpatialGen.cs:16
Zone FindZone(int lv)
Definition: Spatial.cs:728
GameDate date
Definition: World.cs:6

References SpatialGen.Create(), World.date, dateCheckSites, elomap, Spatial.FindZone(), Date.GetRaw(), Date.IsExpired(), EloMap.objmap, UpdateRandomSites(), and EClass.world.

Referenced by GameDate.AdvanceHour(), and OnActivate().

◆ CreateRandomSite() [1/2]

Zone Region.CreateRandomSite ( Point  pos,
string  idSource,
bool  updateMesh,
int  lv = 0 
)
inline

Definition at line 152 of file Region.cs.

153 {
154 if (pos == null)
155 {
156 return null;
157 }
158 if (idSource.IsEmpty())
159 {
160 idSource = GetRandomSiteSource().id;
161 }
162 Zone zone = SpatialGen.Create(idSource, this, register: true, pos.x, pos.z) as Zone;
163 if (lv <= 0)
164 {
165 if (EClass.player.CountKeyItem("license_adv") == 0 && !EClass.debug.enable)
166 {
167 lv = ((EClass.rnd(3) == 0) ? EClass.pc.LV : EClass.pc.FameLv) * (75 + EClass.rnd(50)) / 100 + EClass.rnd(EClass.rnd(10) + 1) - 3;
168 if (lv >= 50)
169 {
170 lv = EClass.rndHalf(50);
171 }
172 }
173 else
174 {
175 lv = EClass.pc.FameLv * 100 / (100 + EClass.rnd(50)) + EClass.rnd(EClass.rnd(10) + 1) - 3;
176 if (EClass.rnd(10) == 0)
177 {
178 lv = lv * 3 / 2;
179 }
180 if (EClass.rnd(10) == 0)
181 {
182 lv /= 2;
183 }
184 }
185 }
186 zone._dangerLv = Mathf.Max(1, lv);
187 zone.isRandomSite = true;
188 zone.dateExpire = EClass.world.date.GetRaw() + 10080;
189 if (elomap.IsSnow(zone.x, zone.y))
190 {
191 zone.icon++;
192 }
193 elomap.SetZone(zone.x, zone.y, zone);
194 if (updateMesh)
195 {
196 elomap.objmap.UpdateMeshImmediate();
197 }
198 return zone;
199 }
int FameLv
Definition: Card.cs:2368
int LV
Definition: Card.cs:389
bool enable
Definition: CoreDebug.cs:302
static int rnd(long a)
Definition: EClass.cs:59
static int rndHalf(int a)
Definition: EClass.cs:97
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
void SetZone(int gx, int gy, Zone z, bool updateMesh=false)
Definition: EloMap.cs:234
bool IsSnow(int gx, int gy)
Definition: EloMap.cs:434
int CountKeyItem(string alias)
Definition: Player.cs:2266
SourceZone.Row GetRandomSiteSource()
Definition: Region.cs:201
int lv
Definition: Spatial.cs:142
int icon
Definition: Spatial.cs:82
int y
Definition: Spatial.cs:106
int x
Definition: Spatial.cs:94
Definition: Zone.cs:12

References Player.CountKeyItem(), SpatialGen.Create(), World.date, EClass.debug, elomap, CoreDebug.enable, Card.FameLv, GetRandomSiteSource(), Date.GetRaw(), Spatial.icon, EloMap.IsSnow(), Card.LV, Spatial.lv, EloMap.objmap, EClass.pc, EClass.player, EClass.rnd(), EClass.rndHalf(), EloMap.SetZone(), EClass.world, Point.x, Spatial.x, Spatial.y, and Point.z.

◆ CreateRandomSite() [2/2]

Zone Region.CreateRandomSite ( Zone  center,
int  radius = 8,
string  idSource = null,
bool  updateMesh = true,
int  lv = 0 
)
inline

Definition at line 141 of file Region.cs.

142 {
143 InitElomap();
144 Point point = new Point(center.IsRegion ? (EClass.pc.pos.x + EClass.scene.elomap.minX) : center.x, center.IsRegion ? (EClass.pc.pos.z + EClass.scene.elomap.minY) : center.y);
145 if (elomap.IsWater(point.x, point.z))
146 {
147 return CreateRandomSite(GetRandomPoint(point.x, point.z, radius, increaseRadius: false, ElomapSiteType.NefiaWater), "dungeon_water", updateMesh, lv);
148 }
149 return CreateRandomSite(GetRandomPoint(point.x, point.z, radius), idSource, updateMesh, lv);
150 }
ElomapSiteType
Point pos
Definition: Card.cs:60
int minX
Definition: EloMap.cs:112
int minY
Definition: EloMap.cs:114
bool IsWater(int gx, int gy)
Definition: EloMap.cs:416
Definition: Point.cs:9
Point GetRandomPoint(ElomapSiteType type=ElomapSiteType.Nefia)
Definition: Region.cs:206
void InitElomap()
Definition: Region.cs:136
Zone CreateRandomSite(Zone center, int radius=8, string idSource=null, bool updateMesh=true, int lv=0)
Definition: Region.cs:141
EloMap elomap
Definition: Scene.cs:149
virtual bool IsRegion
Definition: Spatial.cs:515

References CreateRandomSite(), elomap, Scene.elomap, GetRandomPoint(), InitElomap(), Spatial.IsRegion, EloMap.IsWater(), Spatial.lv, EloMap.minX, EloMap.minY, EClass.pc, Card.pos, EClass.scene, Point.x, Spatial.x, Spatial.y, and Point.z.

Referenced by CreateRandomSite(), Expedition.End(), TraitScrollMap.OnRead(), SurvivalManager.RefreshGateZones(), and UpdateRandomSites().

◆ CreateZone()

Zone Region.CreateZone ( Point  pos)
inline

Definition at line 268 of file Region.cs.

269 {
270 return SpatialGen.Create("field", this, register: true, pos.x, pos.z) as Zone;
271 }

References SpatialGen.Create(), Point.x, and Point.z.

Referenced by Player.EnterLocalZone().

◆ GetRandomPoint() [1/3]

Point Region.GetRandomPoint ( ElomapSiteType  type = ElomapSiteType::Nefia)
inline

Definition at line 206 of file Region.cs.

207 {
208 Point point = new Point();
209 for (int i = 0; i < 1000; i++)
210 {
211 point = map.bounds.GetRandomPoint();
212 point.x += elomap.minX;
213 point.z += elomap.minY;
214 if (elomap.CanBuildSite(point.x, point.z, 1, type))
215 {
216 return point;
217 }
218 }
219 return null;
220 }
bool CanBuildSite(int gx, int gy, int radius=0, ElomapSiteType type=ElomapSiteType.Nefia)
Definition: EloMap.cs:358
Point GetRandomPoint()
Definition: MapBounds.cs:97
MapBounds bounds
Definition: Map.cs:55
Map map
Definition: Zone.cs:66

References Map.bounds, EloMap.CanBuildSite(), elomap, MapBounds.GetRandomPoint(), Zone.map, EloMap.minX, EloMap.minY, Point.x, and Point.z.

Referenced by CreateRandomSite(), OnAdvanceHour(), and UpdateRandomSites().

◆ GetRandomPoint() [2/3]

Point Region.GetRandomPoint ( int  orgX,
int  orgY,
int  minRadius,
int  maxRadius 
)
inline

Definition at line 241 of file Region.cs.

242 {
243 Point point = new Point();
244 Point p = new Point(orgX, orgY);
245 for (int i = 0; i < 1000; i++)
246 {
247 point.x = orgX + Rand.Range(-maxRadius, maxRadius);
248 point.z = orgY + Rand.Range(-maxRadius, maxRadius);
249 if (point.Distance(p) >= minRadius && !point.IsBlocked && elomap.CanBuildSite(point.x + elomap.minX, point.z + elomap.minY, 0, ElomapSiteType.Mob))
250 {
251 return point;
252 }
253 }
254 return null;
255 }
bool IsBlocked
Definition: Point.cs:363
int Distance(Point p)
Definition: Point.cs:995
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:49

References EloMap.CanBuildSite(), Point.Distance(), elomap, Point.IsBlocked, EloMap.minX, EloMap.minY, Rand.Range(), Point.x, and Point.z.

◆ GetRandomPoint() [3/3]

Point Region.GetRandomPoint ( int  orgX,
int  orgY,
int  radius = 8,
bool  increaseRadius = false,
ElomapSiteType  type = ElomapSiteType::Nefia 
)
inline

Definition at line 222 of file Region.cs.

223 {
224 Point point = new Point();
225 for (int i = 0; i < 1000; i++)
226 {
227 point.x = orgX + Rand.Range(-radius / 2, radius / 2);
228 point.z = orgY + Rand.Range(-radius / 2, radius / 2);
229 if (i % 100 == 0 && increaseRadius)
230 {
231 radius++;
232 }
233 if (elomap.CanBuildSite(point.x, point.z, 0, type))
234 {
235 return point;
236 }
237 }
238 return null;
239 }

References EloMap.CanBuildSite(), elomap, Rand.Range(), Point.x, and Point.z.

◆ GetRandomSiteSource()

SourceZone.Row Region.GetRandomSiteSource ( )
inline

Definition at line 201 of file Region.cs.

202 {
203 return EClass.sources.zones.rows.Where((SourceZone.Row a) => a.tag.Contains("random") && (EClass.debug.enable || !a.tag.Contains("debug"))).ToList().RandomItemWeighted((SourceZone.Row a) => a.chance);
204 }

References EClass.debug, CoreDebug.enable, EClass.sources, and SourceManager.zones.

Referenced by ThingGen.CreateMap(), and CreateRandomSite().

◆ GetRandomTown()

Zone Region.GetRandomTown ( )
inline

Definition at line 286 of file Region.cs.

287 {
288 List<Zone> list = ListTowns();
289 Zone zone = null;
290 for (int i = 0; i < 5; i++)
291 {
292 zone = list.RandomItem();
293 _ = zone is Zone_SubTown;
294 }
295 return zone;
296 }
List< Zone > ListTowns()
Definition: Region.cs:273

References ListTowns().

Referenced by GlobalGoalAdv.OnAdvanceHour().

◆ InitElomap()

void Region.InitElomap ( )
inline

Definition at line 136 of file Region.cs.

References elomap, Scene.elomapActor, EloMapActor.Initialize(), and EClass.scene.

Referenced by CreateRandomSite().

◆ ListMobs()

List< Chara > Region.ListMobs ( )
inline

Definition at line 375 of file Region.cs.

376 {
377 List<Chara> list = new List<Chara>();
378 foreach (Chara chara in EClass._map.charas)
379 {
380 if (!chara.IsPCFactionOrMinion && !chara.IsGlobal)
381 {
382 list.Add(chara);
383 }
384 }
385 return list;
386 }
bool IsPCFactionOrMinion
Definition: Card.cs:2342
Definition: Chara.cs:10
override bool IsGlobal
Definition: Chara.cs:628
static Map _map
Definition: EClass.cs:19
List< Chara > charas
Definition: Map.cs:84

References EClass._map, Map.charas, Chara.IsGlobal, and Card.IsPCFactionOrMinion.

Referenced by OnAdvanceHour().

◆ ListRandomSites()

List< Zone > Region.ListRandomSites ( )
inline

Definition at line 298 of file Region.cs.

299 {
300 return (from Zone a in children
301 where a.isRandomSite
302 select a).ToList();
303 }

References Spatial.children.

Referenced by RenewRandomSites(), and UpdateRandomSites().

◆ ListTowns()

List< Zone > Region.ListTowns ( )
inline

Definition at line 273 of file Region.cs.

274 {
275 List<Zone> list = new List<Zone>();
276 foreach (Spatial value in EClass.game.spatials.map.Values)
277 {
278 if (value != null && value.CanSpawnAdv)
279 {
280 list.Add(value as Zone);
281 }
282 }
283 return list;
284 }
static Game game
Definition: EClass.cs:9
SpatialManager spatials
Definition: Game.cs:153
GlobalSpatialList map
virtual bool CanSpawnAdv
Definition: Spatial.cs:505

References Spatial.CanSpawnAdv, EClass.game, SpatialManager.map, and Game.spatials.

Referenced by GameDate.AdvanceDay(), GlobalGoalVisitTown.GetDestZone(), GetRandomTown(), and Chara.OnBanish().

◆ ListTravelZones()

List< Zone > Region.ListTravelZones ( int  radius = 100)
inline

Definition at line 318 of file Region.cs.

319 {
320 bool isRegion = EClass.pc.currentZone.IsRegion;
321 List<Zone> list = new List<Zone>();
322 if (!isRegion)
323 {
325 }
326 else
327 {
328 _ = EClass.pc.pos;
329 }
330 foreach (Zone zone in EClass.game.spatials.Zones)
331 {
332 if (zone.CanFastTravel && !zone.IsInstance && (zone.isKnown || EClass.debug.returnAnywhere) && zone.parent == this)
333 {
334 list.Add(zone);
335 zone.tempDist = zone.Dist(EClass.pc.pos);
336 }
337 }
338 return list;
339 }
Zone currentZone
Definition: Chara.cs:259
bool returnAnywhere
Definition: CoreDebug.cs:219
List< Zone > Zones
int Dist(Point p)
Definition: Spatial.cs:779
Spatial parent
Definition: Spatial.cs:10
bool isKnown
Definition: Spatial.cs:346
virtual bool CanFastTravel
Definition: Spatial.cs:518
bool IsInstance
Definition: Zone.cs:496

References Spatial.CanFastTravel, Chara.currentZone, EClass.debug, Spatial.Dist(), Scene.elomap, EClass.game, Zone.IsInstance, Spatial.isKnown, Spatial.IsRegion, EloMap.minX, EloMap.minY, Spatial.parent, EClass.pc, Card.pos, CoreDebug.returnAnywhere, EClass.scene, Game.spatials, Spatial.x, Spatial.y, and SpatialManager.Zones.

Referenced by LayerTravel.Refresh().

◆ ListZonesInRadius()

List< Zone > Region.ListZonesInRadius ( Zone  center,
int  radius = 10 
)
inline

Definition at line 305 of file Region.cs.

306 {
307 List<Zone> list = new List<Zone>();
308 foreach (Zone zone in EClass.game.spatials.Zones)
309 {
310 if (zone.Dist(center) <= radius && zone != center && !(zone.source.parent != base.source.id))
311 {
312 list.Add(zone);
313 }
314 }
315 return list;
316 }
SourceZone.Row source
Definition: Spatial.cs:453

References Spatial.Dist(), EClass.game, Spatial.source, Game.spatials, and SpatialManager.Zones.

Referenced by Expedition.End().

◆ OnActivate()

override void Region.OnActivate ( )
inlinevirtual

Reimplemented from Zone.

Definition at line 29 of file Region.cs.

30 {
31 children.ForeachReverse(delegate(Spatial _z)
32 {
33 Zone zone = _z as Zone;
34 if (zone.CanDestroy())
35 {
36 zone.Destroy();
37 }
38 });
39 children.ForeachReverse(delegate(Spatial _z)
40 {
41 if (_z.destryoed)
42 {
43 children.Remove(_z);
44 }
45 });
46 children.ForEach(delegate(Spatial a)
47 {
48 Zone zone = a as Zone;
49 if (!zone.IsInstance && (zone.IsPCFaction || !(zone is Zone_Field)) && !(zone is Zone_SisterHouse))
50 {
51 elomap.SetZone(zone.x, zone.y, zone);
52 }
53 });
54 if (!beachFix)
55 {
56 Cell[,] cells = EClass._map.cells;
57 foreach (Cell cell in cells)
58 {
59 if (cell.blocked)
60 {
61 int gx = cell.x + EClass.scene.elomap.minX;
62 int gy = cell.z + EClass.scene.elomap.minY;
64 if (tileInfo != null && tileInfo.source != null && tileInfo.source.idBiome.IsEmpty("Plain") == "Sand")
65 {
66 cell.blocked = false;
67 cell.impassable = false;
68 }
69 }
70 }
71 beachFix = true;
72 }
74 }
Definition: Cell.cs:7
SourceGlobalTile.Row source
Definition: EloMap.cs:52
Cell[,] cells
Definition: Map.cs:88
bool beachFix
Definition: Region.cs:15
void CheckRandomSites()
Definition: Region.cs:76
bool destryoed
Definition: Spatial.cs:45
bool CanDestroy()
Definition: Zone.cs:1957
bool IsPCFaction
Definition: Zone.cs:480

References EClass._map, beachFix, Algorithms.WeightCell.blocked, Zone.CanDestroy(), Map.cells, CheckRandomSites(), Spatial.children, Spatial.destryoed, EloMapActor.elomap, Scene.elomap, Scene.elomapActor, EloMap.GetTileInfo(), Zone.IsInstance, Zone.IsPCFaction, EloMap.minX, EloMap.minY, EClass.scene, and EloMap.TileInfo.source.

◆ OnAdvanceHour()

override void Region.OnAdvanceHour ( )
inlinevirtual

Reimplemented from Zone.

Definition at line 341 of file Region.cs.

342 {
343 if (EClass.world.date.hour == 0)
344 {
345 foreach (Chara item in ListMobs())
346 {
347 if (item.Dist(EClass.pc) > 20 && EClass.rnd(2) == 0)
348 {
349 item.Destroy();
350 }
351 }
352 }
353 if (ListMobs().Count >= (EClass.debug.enable ? 100 : 6) || EClass.rnd(EClass.debug.enable ? 1 : 3) != 0)
354 {
355 return;
356 }
357 Point randomPoint = GetRandomPoint(EClass.pc.pos.x, EClass.pc.pos.z, 8, 14);
358 if (randomPoint != null)
359 {
360 RegionPoint regionPoint = new RegionPoint(EClass.pc.pos);
361 BiomeProfile biome = regionPoint.biome;
362 SpawnList list = ((biome.spawn.chara.Count <= 0) ? SpawnList.Get(biome.name, "chara", new CharaFilter
363 {
364 ShouldPass = (SourceChara.Row s) => s.biome == biome.name || s.biome.IsEmpty()
366 Chara chara = null;
367 chara = ((EClass.rnd(EClass.debug.enable ? 5 : 50) != 0) ? CharaGen.CreateFromFilter(list, regionPoint.dangerLv) : CharaGen.Create((EClass.rnd(5) == 0) ? "merchant_travel" : "merchant_travel2"));
368 if (chara != null && chara.rarity < Rarity.Legendary)
369 {
370 AddCard(chara, randomPoint);
371 }
372 }
373 }
Rarity
Definition: Rarity.cs:2
string GetRandomCharaId()
Rarity rarity
Definition: Card.cs:317
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
Definition: CharaGen.cs:22
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
int hour
Definition: Date.cs:74
int dangerLv
Definition: RegionPoint.cs:5
BiomeProfile biome
Definition: RegionPoint.cs:9
List< Chara > ListMobs()
Definition: Region.cs:375
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
Definition: SpawnList.cs:18
BiomeProfile biome
Definition: Zone.cs:134
Card AddCard(Card t, Point point)
Definition: Zone.cs:2158

References Zone.AddCard(), RegionPoint.biome, Zone.biome, CharaGen.Create(), CharaGen.CreateFromFilter(), World.date, EClass.debug, CoreDebug.enable, SpawnList.Get(), BiomeProfile.Spawns.GetRandomCharaId(), GetRandomPoint(), Date.hour, item, ListMobs(), EClass.pc, Card.pos, Card.rarity, EClass.rnd(), BiomeProfile.spawn, EClass.world, Point.x, and Point.z.

◆ RenewRandomSites()

void Region.RenewRandomSites ( )
inline

Definition at line 104 of file Region.cs.

105 {
106 dateCheckSites = 0;
107 Msg.Say("renewNefia");
108 Debug.Log(ListRandomSites().Count);
109 foreach (Zone item in ListRandomSites())
110 {
111 item.dateExpire = 1;
112 }
113 }
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
List< Zone > ListRandomSites()
Definition: Region.cs:298

References dateCheckSites, Debug, item, ListRandomSites(), and Msg.Say().

Referenced by LayerSleep.Advance().

◆ UpdateRandomSites()

void Region.UpdateRandomSites ( )
inline

Definition at line 115 of file Region.cs.

116 {
117 List<Zone> list = ListRandomSites();
118 int num = 70 - list.Count;
119 if (num <= 0)
120 {
121 return;
122 }
123 for (int i = 0; i < num; i++)
124 {
125 if (EClass.rnd(100) < 25)
126 {
127 CreateRandomSite(GetRandomPoint(ElomapSiteType.NefiaWater), "dungeon_water", updateMesh: false);
128 }
129 else
130 {
131 CreateRandomSite(GetRandomPoint(), null, updateMesh: false);
132 }
133 }
134 }

References CreateRandomSite(), GetRandomPoint(), ListRandomSites(), and EClass.rnd().

Referenced by LayerSleep.Advance(), and CheckRandomSites().

Member Data Documentation

◆ beachFix

bool Region.beachFix

Definition at line 15 of file Region.cs.

Referenced by OnActivate().

◆ dateCheckSites

int Region.dateCheckSites

Definition at line 12 of file Region.cs.

Referenced by CheckRandomSites(), and RenewRandomSites().

◆ elomap

Property Documentation

◆ BlockBorderExit

override bool Region.BlockBorderExit
get

Definition at line 25 of file Region.cs.

◆ DangerLv

override int Region.DangerLv
get

Definition at line 23 of file Region.cs.

◆ DefaultActionMode

override ActionMode Region.DefaultActionMode
get

Definition at line 19 of file Region.cs.

◆ IsRegion

override bool Region.IsRegion
get

Definition at line 21 of file Region.cs.

◆ RegionPos

override Point Region.RegionPos
get

Definition at line 27 of file Region.cs.

◆ WillAutoSave

override bool Region.WillAutoSave
get

Definition at line 17 of file Region.cs.


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