11 public int GetInt(
int id,
int? defaultInt =
null)
14 if (this.mapInt.TryGetValue(
id, out result))
18 return defaultInt.GetValueOrDefault();
22 public void AddInt(
int id,
int value)
24 this.SetInt(
id, this.GetInt(
id,
null) + value);
28 public void SetInt(
int id,
int value = 0)
32 if (this.mapInt.ContainsKey(
id))
34 this.mapInt.Remove(
id);
38 this.mapInt[id] = value;
52 this._ints[0] = value;
67 this._ints[1] = value;
82 this._ints[2] = value;
97 this._ints[3] = value;
108 return this._ints[4];
112 this._ints[4] = value;
119 public int lastActive
123 return this._ints[5];
127 this._ints[5] = value;
138 return this._ints[6];
142 this._ints[6] = value;
153 return this._ints[7];
157 this._ints[7] = value;
164 public int visitCount
168 return this._ints[8];
172 this._ints[8] = value;
179 public int dateExpire
183 return this._ints[9];
187 this._ints[9] = value;
194 public int dateRevive
198 return this._ints[10];
202 this._ints[10] = value;
213 return this._ints[11];
217 this._ints[11] = value;
224 public int dateRegenerate
228 return this._ints[12];
232 this._ints[12] = value;
243 return this._ints[13];
247 this._ints[13] = value;
254 public int investment
258 return this._ints[14];
262 this._ints[14] = value;
269 public int development
273 return this._ints[15];
277 this._ints[15] = value;
284 public int electricity
288 return this._ints[16];
292 this._ints[16] = value;
303 return this._ints[17];
307 this._ints[17] = value;
318 return this._ints[18];
322 this._ints[18] = value;
333 return this._ints[19];
337 this._ints[19] = value;
348 return this._ints[20];
352 this._ints[20] = value;
359 public bool isGenerated
367 this.bits[0] = value;
382 this.bits[3] = value;
389 public bool isRandomSite
397 this.bits[6] = value;
412 this.bits[7] = value;
419 public bool isMapSaved
427 this.bits[8] = value;
434 public bool isExternalZone
442 this.bits[9] = value;
449 public bool isConquered
453 return this.bits[10];
457 this.bits[10] = value;
468 return this.bits[11];
472 this.bits[11] = value;
483 return this.bits[12];
487 this.bits[12] = value;
498 return EClass.game.factions.dictAll.TryGetValue(this.idMainFaction,
null) ??
EClass.Wilds;
502 this.idMainFaction = ((value ==
null) ? EClass.Wilds.uid : value.uid);
513 if ((result = this._source) ==
null)
515 result = (this._source =
EClass.sources.zones.map[this.id]);
523 public bool IsPlayerFaction
527 return this.mainFaction ==
EClass.pc.faction;
537 return this.source.tag.Contains(
"closed");
547 if (!
EClass._zone.IsRegion)
551 return this.x -
EClass.scene.elomap.minX;
561 if (!
EClass._zone.IsRegion)
565 return this.y -
EClass.scene.elomap.minY;
571 public virtual int DangerLv
575 return this._dangerLv;
581 public virtual int DangerLvFix
591 public virtual float VolumeSea
605 public virtual bool ShowDangerLv
615 public virtual bool CanSpawnAdv
625 public string pathSave
629 return GameIO.pathCurrentSave + this.uid.ToString() +
"/";
635 public virtual string Name
639 return ((this.idPrefix == 0) ?
"" : (
EClass.sources.zoneAffixes.map[
this.idPrefix].GetName().ToTitleCase(
false) + Lang.space)) + this.name.IsEmpty(this.source.GetText(
"name",
false)) + this.NameSuffix;
645 public virtual string NameSuffix
654 public override string ToString()
656 return this.Name +
"(" + this.uid.ToString() +
")";
661 public virtual bool IsRegion
671 public virtual bool CanFastTravel
675 return !this.isRandomSite && !this.IsClosed;
685 if (this._tile ==
null)
687 EClass.scene.elomapActor.Initialize(
EClass.world.region.elomap);
688 this._tile =
EClass.scene.elomapActor.elomap.GetTileInfo(this.x, this.y);
696 public virtual bool IsSnowZone
700 return this.Tile.IsSnow;
706 public virtual bool IsSnowCovered
710 return !EClass._map.IsIndoor && (this.IsSnowZone ||
EClass.world.season.isWinter);
716 public virtual Point RegionPos
720 return this._regionPos.Set(this.x -
EClass.scene.elomap.minX,
this.y -
EClass.scene.elomap.minY);
726 public virtual bool isClaimable
740 return EClass.game.seed + Mathf.Abs(this.x) * 1000 + Mathf.Abs(this.y);
746 private void OnSerializing(StreamingContext context)
748 this._bits = (int)this.bits.Bits;
753 private void OnDeserialized(StreamingContext context)
755 this.bits.Bits = (uint)this._bits;
759 public void Create(
string _id,
int _x,
int _y,
int _icon)
764 Rand.SetSeed(this.Seed);
766 this.development = this.source.dev;
767 this.source.name ==
"*r";
768 this._dangerLv = this.source.LV;
769 if (
EClass.debug.travelAnywhere)
778 public void Register()
782 EClass.game.spatials.AssignUID(
this);
787 public virtual void OnCreate()
792 public virtual void OnAfterCreate()
797 public virtual void SetMainFaction(
Faction f)
799 this.mainFaction = f;
803 public Zone GetFirstZone()
809 foreach (
Spatial spatial
in this.children)
811 Zone firstZone = spatial.GetFirstZone();
812 if (firstZone !=
null)
821 public void OnBeforeSave()
823 this._OnBeforeSave();
827 public virtual void _OnBeforeSave()
832 public void _OnLoad()
834 foreach (
Spatial spatial
in this.children)
842 public virtual void OnLoad()
847 public virtual void Destroy()
852 public void DeleteMapRecursive()
854 foreach (
Spatial spatial
in this.children)
856 spatial.DeleteMapRecursive();
858 IO.DeleteDirectory(this.pathSave);
862 public virtual void AddChild(
Spatial child)
865 this.children.Add(child);
869 public void RemoveChild(
Spatial child)
871 this.children.Remove(child);
876 public Zone FindDeepestZone()
879 foreach (
Spatial spatial2
in this.children)
881 if (!spatial2.isExternalZone && spatial2.lv < spatial.lv)
886 return spatial as
Zone;
890 public Zone FindZone(
int lv)
892 foreach (
Spatial spatial
in this.children)
894 if (!spatial.isExternalZone && spatial.lv == lv)
896 return spatial as
Zone;
907 public Zone FindZone(
string _id)
909 foreach (
Spatial spatial
in this.children)
911 Zone zone = spatial._FindZone(_id);
921 protected Zone _FindZone(
string _id)
923 foreach (
Spatial spatial
in this.children)
925 Zone zone = spatial._FindZone(_id);
931 if (
this is
Zone && this.
id == _id)
939 public virtual bool CanKill()
945 public int Dist(
Point p)
948 if (pathProgress.HasPath)
950 return pathProgress.nodes.Count;
952 return Fov.Distance(this.x, this.y, p.x +
EClass.scene.elomap.minX, p.z +
EClass.scene.elomap.minY);
958 return Fov.Distance(s.x, s.y,
this.x,
this.y);
962 public void MakeGameObject(GameObject parentGo)
964 GameObject gameObject =
new GameObject();
965 gameObject.name = this.ToString();
966 gameObject.transform.SetParent(parentGo.transform);
968 foreach (
Spatial spatial
in this.children)
970 spatial.MakeGameObject(gameObject);
984 public string idUser;
992 public string idMainFaction;
996 public string idProfile;
1000 public string idCurrentSubset;
1004 public string idHat;
1008 public int[] _ints =
new int[30];
1012 public List<Spatial> children =
new List<Spatial>();
1016 public List<Spatial> connections =
new List<Spatial>();
1019 [JsonProperty(PropertyName =
"Y")]
1020 public Dictionary<int, int> mapInt =
new Dictionary<int, int>();
1023 public bool destryoed;
1026 public bool isImported;
1029 public BitArray32 bits;