12 public override bool WillAutoSave
32 public override bool IsRegion
42 public override int DangerLv
52 public override bool BlockBorderExit
62 public override Point RegionPos
66 return this._regionPos.Set(
EClass.pc.pos);
71 public override void OnActivate()
73 this.children.ForeachReverse(delegate(
Spatial _z)
76 if (zone.CanDestroy())
81 this.children.ForeachReverse(delegate(
Spatial _z)
85 this.children.Remove(_z);
88 this.children.ForEach(delegate(
Spatial a)
95 this.elomap.SetZone(zone.x, zone.y, zone,
false);
97 this.CheckRandomSites();
101 public void CheckRandomSites()
103 if (
EClass.world.date.IsExpired(
this.dateCheckSites))
105 this.dateCheckSites =
EClass.world.date.GetRaw(0) + 1440;
106 this.UpdateRandomSites();
108 if (base.FindZone(
"foxtown_nefu") ==
null)
110 SpatialGen.Create(
"foxtown_nefu",
this,
true, -99999, -99999, 0);
112 if (base.FindZone(
"little_garden") ==
null)
114 SpatialGen.Create(
"little_garden",
this,
true, -99999, -99999, 0);
116 this.elomap.objmap.UpdateMeshImmediate();
120 public void RenewRandomSites()
122 this.dateCheckSites = 0;
123 Msg.Say(
"renewNefia");
124 Debug.Log(this.ListRandomSites().Count);
125 foreach (
Zone zone
in this.ListRandomSites())
132 public void UpdateRandomSites()
134 List<Zone> list = this.ListRandomSites();
135 int num = 50 - list.Count;
140 for (
int i = 0; i < num; i++)
142 this.CreateRandomSite(this.GetRandomPoint(),
null,
false, -1);
147 public void InitElomap()
149 EClass.scene.elomapActor.Initialize(this.elomap);
153 public Zone CreateRandomSite(
Zone center,
int radius = 8,
string idSource =
null,
bool updateMesh =
true)
156 return this.CreateRandomSite(this.GetRandomPoint(center.IsRegion ? (
EClass.pc.pos.x +
EClass.scene.elomap.minX) : center.x, center.IsRegion ? (
EClass.pc.pos.z +
EClass.scene.elomap.minY) : center.y, radius,
false), idSource, updateMesh, -1);
160 private Zone CreateRandomSite(
Point pos,
string idSource,
bool updateMesh,
int lv = -1)
166 if (idSource.IsEmpty())
168 idSource = this.GetRandomSiteSource().id;
175 zone._dangerLv = Mathf.Max(1, lv);
176 if (zone._dangerLv >= 50 &&
EClass.player.CountKeyItem(
"license_adv") == 0)
178 zone._dangerLv =
EClass.rndHalf(50);
182 zone._dangerLv =
EClass.pc.LV;
184 zone.isRandomSite =
true;
185 zone.dateExpire =
EClass.world.date.GetRaw(0) + 10080;
186 if (this.elomap.IsSnow(zone.x, zone.y))
189 int icon = zone2.icon;
190 zone2.icon = icon + 1;
192 this.elomap.SetZone(zone.x, zone.y, zone,
false);
195 this.elomap.objmap.UpdateMeshImmediate();
203 return (from a in
EClass.sources.zones.rows
204 where a.tag.Contains(
"random") && (
EClass.debug.enable || !a.tag.Contains(
"debug"))
209 public Point GetRandomPoint()
212 for (
int i = 0; i < 1000; i++)
214 point = this.map.bounds.GetRandomPoint();
215 point.x += this.elomap.minX;
216 point.z += this.elomap.minY;
217 if (this.elomap.CanBuildSite(point.x, point.z, 1, ElomapSiteType.Nefia))
226 public Point GetRandomPoint(
int orgX,
int orgY,
int radius = 8,
bool increaseRadius =
false)
229 for (
int i = 0; i < 1000; i++)
231 point.x = orgX + Rand.Range(-radius / 2, radius / 2);
232 point.z = orgY + Rand.Range(-radius / 2, radius / 2);
233 if (i % 100 == 0 && increaseRadius)
237 if (this.elomap.CanBuildSite(point.x, point.z, 0, ElomapSiteType.Nefia))
246 public bool CanCreateZone(
Point pos)
248 EClass.scene.elomapActor.Initialize(
EClass.world.region.elomap);
250 return !tileInfo.idZoneProfile.IsEmpty() && !tileInfo.blocked;
256 return SpatialGen.Create(
"field",
this,
true, pos.x, pos.z, 0) as
Zone;
260 public List<Zone> ListTowns()
262 List<Zone> list =
new List<Zone>();
265 if (spatial.CanSpawnAdv)
267 list.Add(spatial as
Zone);
274 public Zone GetRandomTown()
276 List<Zone> source = this.ListTowns();
278 for (
int i = 0; i < 5; i++)
280 zone = source.RandomItem<
Zone>();
287 public List<Zone> ListRandomSites()
289 return (from
Zone a in this.children
291 select a).ToList<
Zone>();
295 public List<Zone> ListZonesInRadius(
Zone center,
int radius = 10)
297 List<Zone> list =
new List<Zone>();
298 foreach (
Zone zone
in EClass.game.spatials.Zones)
300 if (zone.Dist(center) <= radius && zone != center && !(zone.source.parent != base.source.id))
309 public List<Zone> ListTravelZones(
int radius = 100)
311 bool isRegion =
EClass.pc.currentZone.IsRegion;
312 List<Zone> list =
new List<Zone>();
321 foreach (
Zone zone
in EClass.game.spatials.Zones)
323 if (zone.CanFastTravel && !zone.IsInstance && (zone.isKnown ||
EClass.debug.returnAnywhere) && zone.parent ==
this)
326 zone.tempDist = zone.Dist(
EClass.pc.pos);
337 public int dateCheckSites;