22 return EClass._map.FindChara(base.uidBoss);
26 base.uidBoss = ((value !=
null) ? value.uid : 0);
32 public override int DangerLv
36 if (this.GetTopZone() !=
this)
38 return this.GetTopZone().DangerLv + Mathf.Abs(base.lv) - 1;
40 return (
int)Mathf.Max(1f, (
float)base._dangerLv + MathF.Abs((
float)base.lv) + (
float)
this.DangerLvFix);
46 public virtual bool DisableRooms
56 public int HourSinceLastActive
60 return EClass.world.date.GetElapsedHour(base.lastActive);
66 public int MinsSinceLastActive
70 return EClass.world.date.GetElapsedMins(base.lastActive);
76 public virtual string pathExport
80 return CorePath.ZoneSave + this.idExport.IsEmpty(
"_new") +
".z";
91 if ((result = this._biome) ==
null)
93 result = (this._biome =
EClass.core.refs.biomes.dict[this.IdBiome]);
101 public virtual string IdBiome
105 return this.map.config.idBiome.IsEmpty(base.source.idBiome);
110 public virtual string GetDungenID()
117 public virtual string IDGenerator
127 public virtual string TextWidgetDate
137 public MapGenerator Generator
141 return ResourceCache.Load<MapGenerator>(
"DunGenProfile/Generator_" + this.GetDungenID());
147 public virtual string IdProfile
151 return this.idProfile.IsEmpty(base.source.idProfile);
157 public virtual string IDPlayList
161 return base.source.idPlaylist.IsEmpty((base.lv != 0) ?
"Underground" :
null);
167 public virtual string IDPlaylistOverwrite
177 public virtual string IDHat
187 public virtual string IDBaseLandFeat
191 return base.Tile.source.trait[0];
197 public virtual string idExport
201 if (base.source.idFile.Length != 0)
203 return base.source.idFile[this.fileVariation] + ((base.lv == 0) ?
"" : (
"_F" + base.lv.ToString()));
211 public string pathTemp
215 return GameIO.pathTemp + base.uid.ToString() +
"/";
231 public Zone ParentZone
235 return this.parent as
Zone;
251 public virtual bool BlockBorderExit
261 public virtual int ExpireDays
265 return EClass.setting.balance.dateExpireRandomMap;
271 public virtual ZoneTransition.EnterState RegionEnterState
281 public virtual ZoneFeatureType FeatureType
285 return ZoneFeatureType.Default;
291 public virtual string IDAmbience
295 if (this.IsRegion || this.map.IsIndoor)
309 public virtual string IDSceneTemplate
317 if (!this.IsSnowZone)
327 public virtual bool IsFestival
337 public virtual string IDSubset
341 if (!this.IsFestival)
351 public virtual bool IsTown
361 public virtual bool CanBeDeliverDestination
371 public virtual bool CountDeepestLevel
381 public virtual bool HasLaw
391 public virtual bool MakeEnemiesNeutral
395 return this.IsTown || this.HasLaw;
401 public virtual bool MakeTownProperties
411 public virtual bool AllowCriminal
421 public virtual bool AllowNewZone
431 public virtual bool WillAutoSave
441 public virtual bool RegenerateOnEnter
451 public virtual bool IsSkyLevel
461 public virtual bool IsUserZone
471 public virtual bool CanDigUnderground
481 public virtual bool LockExit
491 public virtual bool CanUnlockExit
495 return !this.LockExit;
501 public virtual int MaxLv
511 public virtual int MinLv
521 public virtual bool AddPrefix
531 public virtual bool IsNefia
541 public virtual bool PetFollow
551 public virtual bool RestrictBuild
561 public virtual bool KeepAllyDistance
565 return this.HasLaw || this.IsPCFaction;
571 public virtual int MaxSpawn
575 return this.map.bounds.Width * this.map.bounds.Height / 175 + 2;
581 public int MaxRespawn
585 return (
int)((float)this.MaxSpawn * this.RespawnRate) + 1;
591 public virtual float RuinChance
601 public virtual float OreChance
611 public virtual float BigDaddyChance
621 public virtual float EvolvedChance
631 public virtual float ShrineChance
641 public virtual float PrespawnRate
651 public virtual float RespawnRate
655 return this.PrespawnRate * 0.5f;
661 public virtual int RespawnPerHour
665 return this.MaxSpawn / 5 + 1;
671 public virtual float ChanceSpawnNeutral
681 public virtual bool GrowPlant
685 return base.mainFaction ==
EClass.pc.faction;
691 public virtual bool GrowWeed
695 return this.GrowPlant;
701 public virtual bool IsExplorable
705 return !base.isRandomSite;
711 public virtual bool IsReturnLocation
715 return EClass.pc.homeZone ==
this || base.source.tag.Contains(
"return");
721 public virtual bool ShouldMakeExit
725 return base.lv > this.MinLv && base.lv < this.MaxLv;
731 public virtual bool ShouldRegenerate
741 public virtual bool ShouldAutoRevive
745 return this.ShouldRegenerate || this.IsPCFaction;
751 public virtual bool UseFog
761 public virtual bool RevealRoom
771 public virtual bool AlwaysLowblock
775 return this.map.IsIndoor;
781 public virtual bool UseLight
785 return base.mainFaction == EClass.pc.faction || base.source.tag.Contains(
"light");
791 public virtual int StartLV
801 public virtual bool ScaleMonsterLevel
811 public virtual bool HiddenInRegionMap
820 public virtual string GetNewZoneID(
int level)
822 return base.source.id;
827 public virtual FlockController.SpawnType FlockType
831 return FlockController.SpawnType.Default;
836 public override string ToString()
838 string[] array =
new string[10];
839 array[0] = this.Name;
841 array[2] = base.uid.ToString();
844 Point regionPos = this._regionPos;
845 array[num] = ((regionPos !=
null) ? regionPos.ToString() :
null);
846 array[5] =
") instance?";
847 array[6] = this.IsInstance.ToString();
849 array[8] =
EClass.world.date.GetRemainingHours(base.dateExpire).ToString();
851 return string.Concat(array);
856 public override string NameSuffix
860 if (!this.IsNefia || !this.GetTopZone().isConquered)
864 return "conquered".lang();
870 public string NameWithLevel
874 return this.Name + this.TextLevel(base.lv);
879 public string TextLevel(
int _lv)
887 return " " +
"zoneLevelB".lang((_lv * -1).ToString() ??
"",
null,
null,
null,
null);
889 return " " +
"zoneLevel".lang((_lv + 1).ToString() ??
"",
null,
null,
null,
null);
894 public string TextDeepestLv
898 if (this.GetDeepestLv() != 0)
900 return "zoneLevelMax".lang(this.TextLevel(this.GetDeepestLv()),
null,
null,
null,
null);
908 public bool CanEnterBuildMode
912 return EClass.debug.godBuild || EClass.debug.ignoreBuildRule || base.mainFaction ==
EClass.pc.faction;
918 public bool CanEnterBuildModeAnywhere
922 return EClass.debug.godBuild || EClass.debug.ignoreBuildRule || (base.mainFaction == EClass.pc.faction &&
EClass.Branch.elements.Has(4003));
928 public bool IsPCFaction
932 return base.mainFaction ==
EClass.pc.faction;
938 public bool IsStartZone
942 return this ==
EClass.game.StartZone;
948 public bool IsInstance
952 return this.instance !=
null;
962 return this.map !=
null;
968 public virtual int BaseElectricity
978 public bool IsActiveZone
982 return EClass.game.activeZone ==
this;
988 public bool CanInspect
992 return !this.IsInstance && !this.HiddenInRegionMap;
998 public string InspectName
1002 return this.Name + ((this.IsTown || this.IsPCFaction ||
this is
Zone_Civilized) ?
"" :
"dangerLv".lang(this.DangerLv.ToString() ??
"",
null,
null,
null,
null));
1008 public Point InspectPoint
1018 public Vector3 InspectPosition
1022 return default(Vector3);
1027 public override void OnCreate()
1029 this.events.zone =
this;
1030 base.lv = this.StartLV;
1034 public override void OnAfterCreate()
1038 if (this.GetTopZone() ==
this)
1043 base.idPrefix = this.GetTopZone().idPrefix;
1048 public void Activate()
1052 EClass.scene.elomapActor.Initialize(this.
Region.elomap);
1054 this.isStarted = (this.isSimulating =
false);
1055 base.isKnown =
true;
1056 EClass.game.config.reverseSnow =
false;
1057 if (this.RegenerateOnEnter &&
EClass.game.activeZone !=
null &&
EClass.game.activeZone.GetTopZone() !=
this.GetTopZone() &&
EClass.world.date.IsExpired(base.dateExpire))
1059 Msg.Say(
"regenerateZone", this.Name,
null,
null,
null);
1060 this.ClearZones(
null);
1061 if (
EClass.pc.global.transition !=
null)
1063 EClass.pc.global.transition.uidLastZone = 0;
1067 if (
EClass.game.activeZone !=
null)
1069 EClass.game.activeZone.Deactivate();
1071 EClass.game.activeZone =
this;
1073 Debug.Log(
string.Concat(
new string[]
1079 base.uid.ToString(),
1081 base.isGenerated.ToString(),
1083 this.IsLoaded.ToString(),
1085 File.Exists(base.pathSave +
"map").ToString()
1087 if (base.isGenerated && !
this.IsLoaded && !File.Exists(base.pathSave +
"map"))
1089 Debug.Log(
"(Bug) File does not exist:" + this.destryoed.ToString() +
"/" + base.pathSave);
1090 base.isGenerated =
false;
1093 Debug.Log(this.idCurrentSubset +
"/" + this.IDSubset);
1094 bool flag2 = this.idCurrentSubset != this.IDSubset || Zone.forceSubset !=
null;
1095 if (flag2 && this.map !=
null)
1099 Debug.Log(
string.Concat(
new string[]
1103 File.Exists(this.pathExport).ToString(),
1107 if (!base.isGenerated && (
this.idExport.IsEmpty() || !File.Exists(
this.pathExport)))
1109 Debug.Log(
"generating random map");
1111 base.dateExpire =
EClass.world.date.GetRaw(0) + 1440 * this.ExpireDays;
1113 this.OnGenerateMap();
1114 if (this.instance !=
null)
1116 this.instance.OnGenerateMap();
1120 this.map.ForeachCell(delegate(global::Cell c)
1127 this.AddGlobalCharasOnActivate();
1130 else if (this.IsLoaded)
1132 Debug.Log(
"zone is already loaded");
1133 this.map.SetZone(
this);
1134 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave :
this.pathTemp);
1135 this.AddGlobalCharasOnActivate();
1140 bool flag3 = (base.isGenerated && flag2) || (base.isGenerated && !
this.IsInstance && !
this.IsPCFaction &&
this.ShouldRegenerate &&
EClass.world.date.IsExpired(base.dateRegenerate)) ||
Zone.forceRegenerate;
1141 if (this.pathExport.IsEmpty() || !File.Exists(
this.pathExport))
1145 Debug.Log(
string.Concat(
new string[]
1147 base.isGenerated.ToString(),
1155 if (!base.isGenerated || flag3 || flag2)
1157 Debug.Log(
"importing map:" + this.pathExport);
1159 base.dateRegenerate =
EClass.world.date.GetRaw(0) + 1440 *
EClass.setting.balance.dateRegenerateZone;
1162 IO.DeleteDirectory(this.pathTemp +
"Texture Replace");
1163 Debug.Log(this.pathTemp);
1165 zoneExportData = this.Import(this.pathExport);
1166 base.isGenerated =
true;
1167 this.isImported =
true;
1170 zoneExportData.orgMap =
GameIO.LoadFile<
Map>(base.pathSave +
"map");
1173 EClass.game.countLoadedMaps++;
1174 Debug.Log(
"loading map: imported? " + this.isImported.ToString() +
" regenerate? " + flag3.ToString());
1175 this.map =
GameIO.LoadFile<
Map>((this.isImported ? this.pathTemp : base.pathSave) +
"map");
1176 if (this.map ==
null)
1178 EClass.ui.Say(
string.Concat(
new string[]
1180 "System.IO.EndOfStreamException: Unexpected end of stream:",
1181 Environment.NewLine,
1182 "File may be corrupted. Try replacing the following file if you have a backup:",
1183 Environment.NewLine,
1184 this.isImported ? this.pathTemp : base.pathSave,
1189 this.map.SetZone(
this);
1190 this.map.Load(this.isImported ? this.pathTemp : base.pathSave,
this.isImported,
null);
1191 this.map.SetReference();
1192 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave :
this.pathTemp);
1193 if (this.isImported)
1195 this.map.deadCharas.Clear();
1196 this.map.OnImport(zoneExportData);
1197 if (this.UseFog && !flag3)
1199 this.map.ForeachCell(delegate(global::Cell c)
1204 if (zoneExportData.orgMap !=
null)
1206 Map orgMap = zoneExportData.orgMap;
1207 List<Chara> serializedCharas = this.map.serializedCharas;
1208 this.map.charas = orgMap.charas;
1209 this.map.serializedCharas = orgMap.serializedCharas;
1210 this.map.deadCharas = orgMap.deadCharas;
1211 foreach (
Chara chara
in serializedCharas)
1213 string[] array =
new string[6];
1214 array[0] =
"Importing New Chara:";
1215 array[1] = chara.id;
1217 array[3] = chara.Name;
1220 Point orgPos = chara.orgPos;
1221 array[num] = ((orgPos !=
null) ? orgPos.ToString() :
null);
1222 Debug.Log(
string.Concat(array));
1223 this.map.serializedCharas.Add(chara);
1225 this.map.things.ForeachReverse(delegate(
Thing t)
1229 foreach (
Thing thing4
in orgMap.things)
1231 if (t.id == thing4.id && t.pos.Equals(thing4.pos))
1234 this.map.things.Insert(0, thing4);
1235 thing4.stackOrder = 0;
1243 foreach (
Thing thing5
in orgMap.things)
1245 if (thing5.trait is
TraitNewZone && t.pos.Equals(thing5.pos))
1248 this.map.things.Add(thing5);
1254 if (t.id ==
"medal" || t.id ==
"856")
1256 foreach (
Thing thing6
in orgMap.things)
1258 if (t.id == thing6.id && t.pos.Equals(thing6.pos))
1266 foreach (KeyValuePair<int, int> keyValuePair
in EClass._map.backerObjs.ToList<KeyValuePair<int, int>>())
1268 EClass._map.GetCell(keyValuePair.Key);
1270 if (
EClass.player.doneBackers.Contains(row.id) && !
EClass.core.config.test.ignoreBackerDestoryFlag)
1272 this.map.backerObjs.Remove(keyValuePair.Key);
1275 foreach (
Chara chara2
in this.map.serializedCharas)
1277 if (chara2.orgPos !=
null && chara2.orgPos.IsValid)
1279 chara2.pos.Set(chara2.orgPos);
1282 foreach (
Thing thing
in orgMap.things)
1284 if (thing.trait is
TraitTent && !thing.isNPCProperty)
1286 thing.AddEditorTag(EditorTag.NoNpcProperty);
1287 thing.isSubsetCard =
false;
1288 this.map.things.Add(thing);
1294 foreach (
Thing c2
in this.map.things)
1296 this.map.AddCardOnActivate(c2);
1298 foreach (
Chara chara3
in this.map.serializedCharas)
1300 this.map.charas.Add(chara3);
1301 this.map.AddCardOnActivate(chara3);
1303 this.map.serializedCharas.Clear();
1304 if (this.isImported && this.IsTown)
1306 this.RefreshListCitizen();
1308 this.map.RefreshAllTiles();
1309 this.AddGlobalCharasOnActivate();
1313 foreach (
Card card
in this.map.Cards.ToList<
Card>())
1315 if (card.isSubsetCard)
1321 if (this.isImported)
1323 this.idCurrentSubset = (Zone.forceSubset ?? this.IDSubset);
1324 if (this.idCurrentSubset !=
null)
1326 this.subset =
MapSubset.Load(this.idCurrentSubset);
1327 this.subset.Apply();
1330 if (this.isImported)
1332 if (this.MakeTownProperties)
1334 using (List<Thing>.Enumerator enumerator3 = this.map.things.GetEnumerator())
1336 while (enumerator3.MoveNext())
1338 Thing thing2 = enumerator3.Current;
1339 thing2.isNPCProperty = (!thing2.isHidden && !thing2.HasEditorTag(EditorTag.NoNpcProperty));
1344 foreach (
Thing thing3
in this.map.things)
1346 thing3.isNPCProperty =
false;
1349 this.OnGenerateMap();
1350 if (this.instance !=
null)
1352 this.instance.OnGenerateMap();
1355 if (this.isImported && !flag3 && !this.RevealRoom)
1357 foreach (global::Room room
in this.map.rooms.listRoom)
1359 if (room.HasRoof && !room.data.atrium)
1361 foreach (
Point point
in room.points)
1363 point.cell.isSeen =
false;
1370 this.OnRegenerate();
1373 PathManager.Instance._pathfinder.PunishChangeDirection =
false;
1374 this.isImported =
false;
1375 if (flag && this.IsTown && base.lv == 0)
1377 this.SpawnLostItems();
1379 if (base.visitCount == 0)
1381 base.dateRevive =
EClass.world.date.GetRaw(0) + 1440 *
EClass.setting.balance.dateRevive;
1383 this.map.ForeachCell(delegate(global::Cell c)
1387 this.map.effectManager.GetOrCreate(c.GetSharedPoint());
1394 if (
EClass.world.weather.IsRaining)
1398 if (
EClass.debug.revealMap)
1400 this.map.ForeachCell(delegate(global::Cell c)
1405 this.isStarted =
true;
1406 this.map.RefreshAllTiles();
1407 if (this.events.listPreEnter.Count > 0)
1411 zonePreEnterEvent.Execute();
1413 this.events.listPreEnter.Clear();
1415 foreach (
Card card2
in this.map.Cards)
1417 card2.CalculateFOV();
1420 Chara chara4 = card2.Chara;
1421 if (card2.IsUnique && !card2.IsPCFaction && !card2.IsPCParty)
1423 Point point2 = chara4.orgPos ?? card2.pos;
1431 int @
int = card2.GetInt(55,
null);
1434 foreach (
Chara chara5
in this.map.charas)
1436 if (chara5.uid == @
int)
1438 if (!chara4.IsHostile(chara5))
1442 chara4.enemy = chara5;
1444 chara4.calmCheckTurn = 20 +
EClass.rnd(30);
1448 card2.SetInt(55, 0);
1450 if (card2.pos.cell.IsBlocked && !card2.isRestrained && !card2.HasCondition<
ConSuspend>())
1452 card2.MoveImmediate(card2.pos.GetNearestPoint(
false,
true,
true,
false) ?? card2.pos,
true,
true);
1455 if (card2.c_uidMaster != 0 && chara4.master ==
null)
1457 chara4.FindMaster();
1459 if (!
EClass.game.isLoading)
1461 chara4.enemy =
null;
1462 if (chara4.IsInCombat)
1468 else if (card2.IsInstalled)
1471 if (traitDoor !=
null && card2.pos.HasChara && !traitDoor.IsOpen())
1473 traitDoor.ToggleDoor(
false,
false);
1478 Zone.forceRegenerate =
false;
1479 Zone.forceSubset =
null;
1480 EClass.ui.OnActivateZone();
1481 EClass.scene.RebuildActorEx();
1482 EClass.Sound.LoadAmbience(this.IDAmbience);
1483 if (
EClass.Branch !=
null)
1485 EClass.Branch.OnActivateZone();
1490 this.OnVisitNewMapOrRegenerate();
1492 Guild currentGuild =
Guild.GetCurrentGuild();
1493 if (currentGuild !=
null)
1495 currentGuild.RefreshDevelopment();
1497 if (this.IsPCFaction)
1499 EClass.player.uidLastTown = 0;
1501 else if (this.IsTown && base.lv == 0)
1503 EClass.player.uidLastTown = base.uid;
1506 Rand.InitBytes(this.map.seed + 1);
1507 this.RefreshElectricity();
1511 this.ModInfluence(2000);
1525 public void RefreshHat()
1527 if (this.idHat !=
null &&
EClass.world.date.IsExpired(base.dateHat))
1532 Zone.sourceHat = ((this.idHat !=
null) ?
EClass.sources.cards.map[this.idHat] : ((this.IDHat !=
null) ?
EClass.sources.cards.map[this.IDHat] :
null));
1536 public void OnVisit()
1538 if (this.CountDeepestLevel && this.DangerLv >
EClass.player.stats.deepest)
1540 EClass.player.stats.deepest = this.DangerLv;
1542 if (
EClass.world.date.IsExpired(base.dateRevive))
1544 this.ResetHostility();
1548 chara.TryRestock(
false);
1549 if (!chara.IsPCFaction)
1555 this.RefreshCriminal();
1556 EClass._map.rooms.AssignCharas();
1557 this.events.OnVisit();
1559 this.UpdateQuests(
false);
1560 this.OnBeforeSimulate();
1561 this.isSimulating =
true;
1563 this.isSimulating =
false;
1564 this.OnAfterSimulate();
1565 if (
EClass.Branch !=
null)
1567 EClass.Branch.OnAfterSimulate();
1569 base.lastActive =
EClass.world.date.GetRaw(0);
1570 if (!
EClass.game.isLoading)
1572 int visitCount = base.visitCount;
1573 base.visitCount = visitCount + 1;
1575 base.version =
EClass.core.version.GetInt();
1579 public void Revive()
1581 base.dateRevive =
EClass.world.date.GetRaw(0) + 1440 *
EClass.setting.balance.dateRevive;
1582 if (this.ShouldAutoRevive)
1584 foreach (
Chara chara
in this.map.deadCharas)
1586 if (chara.trait.CanAutoRevive)
1588 chara.Revive(
null,
false);
1589 if (chara.isBackerContent &&
EClass.player.doneBackers.Contains(chara.c_idBacker) && !
EClass.core.config.test.ignoreBackerDestoryFlag)
1591 chara.RemoveBacker();
1593 EClass._zone.AddCard(chara, (chara.orgPos !=
null && chara.orgPos.IsInBounds) ? chara.orgPos : chara.pos);
1597 foreach (
Chara chara2
in EClass.game.cards.globalCharas.Values)
1599 if (chara2.isDead && chara2.homeZone ==
this)
1601 chara2.Revive(
null,
false);
1603 if (chara2.orgPos !=
null && chara2.orgPos.IsInBounds)
1605 point = (chara2.orgPos.GetNearestPoint(
false,
true,
true,
false) ?? point);
1607 EClass._zone.AddCard(chara2, point);
1610 this.map.deadCharas.Clear();
1614 public virtual void OnRegenerate()
1619 public virtual void OnActivate()
1624 public virtual void OnBeforeDeactivate()
1629 public virtual void OnDeactivate()
1634 public virtual void OnBeforeSimulate()
1639 public virtual void OnVisitNewMapOrRegenerate()
1644 public virtual void OnAfterSimulate()
1649 public void Simulate()
1651 if (!
EClass.game.isLoading && base.visitCount > 0)
1653 if (this.Boss !=
null && this.IsNefia)
1655 Msg.Say(
"bossLeave", this.Boss.Name.ToTitleCase(
false),
EClass._zone.Name,
null,
null);
1656 EClass._zone.RemoveCard(this.Boss);
1657 EClass._zone.GetTopZone().isConquered =
true;
1659 int num = Mathf.Clamp(this.MinsSinceLastActive, 1, 10000);
1666 if (!chara.IsPCParty)
1668 if (chara.mana.value < 0)
1670 chara.mana.value = 0;
1672 if (chara.stamina.value < 0)
1674 chara.stamina.value = 0;
1679 chara.resistCon =
null;
1681 if (chara.rarity >= Rarity.Legendary && !chara.IsPCFaction && num > 0)
1683 Msg.ignoreAll =
true;
1684 chara.Cure(CureType.Boss, 20 + num * 10, BlessedState.Normal);
1685 chara.HealHP(Mathf.Max(1, chara.MaxHP) * num / 20, HealSource.None);
1686 chara.mana.Mod(Mathf.Max(1, chara.mana.max) * num / 20);
1687 chara.stamina.Mod(Mathf.Max(1, chara.stamina.max) * num / 20);
1688 Msg.ignoreAll =
false;
1692 if (this.HourSinceLastActive <= 1)
1696 Debug.Log(this.Name +
" Simulate:" + this.HourSinceLastActive.ToString() +
" hours");
1698 List<Chara> list =
EClass._map.charas.ToList<
Chara>();
1699 int num2 = this.HourSinceLastActive / 24;
1702 foreach (
Chara chara2
in list)
1704 if (!chara2.IsPCParty)
1706 chara2.OnSleep(200, num2);
1707 if (chara2.conSleep !=
null)
1709 chara2.conSleep.Kill(
false);
1711 if (
EClass.rnd(
EClass.world.date.IsNight ? 20 : 200) == 0 && !chara2.IsPCFaction)
1715 if (chara2.things.Count > 20)
1717 chara2.ClearInventory(ClearInventoryType.Silent);
1722 EClass._map.things.ForeachReverse(delegate(
Thing t)
1724 t.DecayNatural(this.HourSinceLastActive);
1726 VirtualDate.current = virtualDate;
1727 for (
int i = 0; i < this.HourSinceLastActive; i++)
1729 virtualDate.SimulateHour();
1731 VirtualDate.current =
null;
1732 if (!this.IsPCFaction)
1737 foreach (
Chara chara3
in list)
1739 if (!chara3.IsPCParty)
1741 if (!chara3.IsHomeMember())
1743 if (chara3.id ==
"bee")
1747 if (num2 > 0 && chara3.IsGuest())
1749 chara3.ChooseNewGoal();
1750 chara3.ai.SimulateZone(num2);
1757 Goal goal = chara3.GetGoalWork();
1761 (goal as
GoalWork).FindWork(chara3,
true);
1763 chara3.ai.SimulateZone(num2);
1764 goal = chara3.GetGoalHobby();
1768 (goal as
GoalWork).FindWork(chara3,
true);
1770 chara3.ai.SimulateZone(num2);
1772 chara3.ChooseNewGoal();
1773 if (chara3.conSuspend ==
null)
1775 chara3.ai.OnSimulatePosition();
1780 List<Thing> list2 =
new List<Thing>();
1781 foreach (
Thing thing
in this.map.things)
1788 if (num3 < list2.Count)
1790 for (
int j = num3; j < list2.Count; j++)
1792 if (
EClass.rnd(200) <=
this.HourSinceLastActive)
1795 this.AddCard(chara4, list2.RandomItem<
Thing>().pos);
1796 chara4.c_originalHostility = (chara4.hostility = Hostility.Neutral);
1806 ZoneTransition zoneTransition = (global !=
null) ? global.transition :
null;
1807 Zone zone = (zoneTransition !=
null) ? zoneTransition.lastZone :
null;
1808 ZoneTransition.EnterState enterState = (zoneTransition !=
null) ? zoneTransition.state : destState;
1809 bool flag = zone ==
null || zone.lv > base.lv;
1812 if (zone !=
null && !
EClass.player.simulatingZone)
1814 Zone topZone = zone.GetTopZone();
1815 if (this.GetZoneAt(topZone.x, topZone.y) !=
null)
1817 return new Point(topZone.mapX, topZone.mapY);
1823 return EClass.player.lastZonePos;
1827 enterState = this.RegionEnterState;
1833 float rate = (zoneTransition ==
null) ? -1f : zoneTransition.ratePos;
1834 if (this.IsPCFaction)
1841 Point nearestPoint = (spot.trait as
TraitSpotGuidePC).GetRandomPoint((
Point p) => !p.IsBlocked && !p.Equals(spot.pos)).GetNearestPoint(
false,
true,
true,
false);
1842 if (nearestPoint !=
null && nearestPoint.IsValid)
1844 return nearestPoint;
1884 foreach (
Thing thing
in this.map.things)
1886 if (thing.IsInstalled)
1889 if (traitTeleporter !=
null)
1891 Debug.Log(
string.Concat(
new string[]
1893 zoneTransition.idTele,
1895 traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3,
null)),
1897 traitTeleporter.GetParam(3,
null)
1900 if (traitTeleporter !=
null && !zoneTransition.idTele.IsEmpty() && zoneTransition.idTele == traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3,
null)))
1902 return thing.pos.GetNearestPoint(
false,
true,
true,
false);
1906 foreach (
Thing thing2
in this.map.things)
1908 if (thing2.IsInstalled)
1911 if (traitTeleporter2 !=
null && traitTeleporter2.IsFor(zoneTransition.lastZone))
1913 return thing2.pos.GetNearestPoint(
false,
true,
true,
false);
1918 if (randomThing !=
null)
1925 foreach (
Thing thing3
in this.map.things)
1927 if (thing3.IsInstalled)
1930 if (traitElevator !=
null && traitElevator.IsFor(zoneTransition.lastZone))
1932 return thing3.pos.GetNearestPoint(
false,
true,
true,
false);
1937 if (randomThing2 !=
null)
1942 randomThing3 = this.map.props.installed.traits.GetRandomThing<
TraitWaystone>();
1943 if (randomThing3 !=
null)
1947 randomThing3 = this.map.props.installed.traits.GetRandomThing<
TraitCoreZone>();
1948 if (randomThing3 !=
null)
1965 return new Point(zoneTransition.x, zoneTransition.z);
1967 return randomThing.pos.GetNearestPoint(
false,
true,
true,
false);
1969 return randomThing2.pos.GetNearestPoint(
false,
true,
true,
false);
1971 return randomThing3.pos.GetNearestPoint(
false,
true,
true,
false);
1973 return randomThing3.pos.GetNearestPoint(
false,
true,
true,
false);
1975 flag = (base.lv <= 0);
1978 if (this.map.config.embarkX != 0)
1980 return new Point(this.map.config.embarkX,
this.map.config.embarkY);
1982 return this.map.GetCenterPos().GetNearestPoint(
false,
false,
true,
false);
1984 return this.map.bounds.GetTopPos(rate).GetNearestPoint(
false,
false,
true,
false);
1986 return this.map.bounds.GetRightPos(rate).GetNearestPoint(
false,
false,
true,
false);
1988 return this.map.bounds.GetBottomPos(rate).GetNearestPoint(
false,
false,
true,
false);
1990 return this.map.bounds.GetLeftPos(rate).GetNearestPoint(
false,
false,
true,
false);
1992 if (zoneTransition.x == 0 &&
EClass._map.bounds.x != 0)
1994 return new Point(this.map.config.embarkX,
this.map.config.embarkY);
1996 return new Point(zoneTransition.x, zoneTransition.z);
1998 return this.GetRandomVisitPos(c);
2005 foreach (
Thing thing4
in this.map.things)
2008 if (traitNewZone !=
null && traitNewZone.zone !=
null && zone !=
null && traitNewZone.zone.uid == zone.uid)
2012 c.SetDir(traitNewZone.owner.dir);
2014 return traitNewZone.GetExitPos();
2017 foreach (
Thing thing5
in this.map.things)
2020 if (traitNewZone2 !=
null && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
2024 c.SetDir(traitNewZone2.owner.dir);
2026 return traitNewZone2.GetExitPos();
2029 return this.GetRandomVisitPos(c);
2036 if (
EClass.rnd(3) == 0 &&
this.map.rooms.listRoom.Count > 0)
2038 point = this.map.rooms.listRoom.RandomItem<global::Room>().points.RandomItem<
Point>();
2040 if (point ==
null &&
EClass.rnd(4) != 0)
2042 IEnumerable<Chara> enumerable = from t in this.map.charas
2043 where t.trait.ShopType != ShopType.None && t.pos !=
null && t.pos.IsValid
2045 if (enumerable.Count<
Chara>() > 0)
2047 point = enumerable.RandomItem<
Chara>().pos.GetRandomPoint(3,
true,
true,
false, 100);
2052 point = (this.map.bounds.GetRandomSurface(
false,
true, !this.IsPCFaction && !(
this is
Zone_Civilized)) ?? this.map.bounds.GetRandomPoint());
2054 return point.GetNearestPoint(
false,
false,
false,
false) ??
EClass._map.GetCenterPos();
2058 public void AddGlobalCharasOnActivate()
2060 Point spawnPosPC =
null;
2061 if (
EClass.pc.currentZone ==
this)
2065 if (spawnPosPC ==
null)
2067 spawnPosPC = this.map.GetCenterPos();
2069 if (spawnPosPC.IsValid &&
EClass.pc.global.transition !=
null && spawnPosPC.HasBlock)
2071 spawnPosPC = spawnPosPC.GetNearestPoint(
false,
true,
true,
false);
2073 spawnPosPC = spawnPosPC.Clamp(
true).GetNearestPoint(
false,
false,
true,
false);
2074 using (Dictionary<int, Chara>.ValueCollection.Enumerator enumerator =
EClass.game.cards.globalCharas.Values.GetEnumerator())
2076 while (enumerator.MoveNext())
2078 Chara c = enumerator.Current;
2079 if (c.currentZone ==
this)
2081 if (c.parent is
Chara)
2084 c.currentZone = chara.currentZone;
2088 if (c.global.transition !=
null)
2090 Point pos = c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(
false,
false,
true,
true) : this.GetSpawnPos(c,
ZoneTransition.EnterState.Auto));
2091 if (c.IsPCParty && !c.IsPC)
2095 pos.Set(spawnPosPC);
2097 else if (pos.Equals(spawnPosPC) || !
PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
2099 c.pos.Set(spawnPosPC);
2100 if (!spawnPosPC.ForeachNearestPoint(delegate(
Point p)
2102 if (
PathManager.Instance.IsPathClear(spawnPosPC, p, c, 5) && !p.Equals(spawnPosPC))
2108 },
false,
false,
true,
true))
2110 pos.Set(spawnPosPC);
2115 c.global.transition =
null;
2117 this.map.charas.Add(c);
2118 this.map.AddCardOnActivate(c);
2123 foreach (
Chara chara2
in EClass.player.listSummon)
2125 Point nearestPoint = spawnPosPC.GetNearestPoint(
false,
false,
true,
true);
2126 chara2.enemy =
null;
2127 chara2.pos.Set(nearestPoint);
2128 this.map.charas.Add(chara2);
2129 this.map.AddCardOnActivate(chara2);
2131 EClass.player.listSummon.Clear();
2135 public void Deactivate()
2137 base.isPeace =
false;
2138 this.OnBeforeDeactivate();
2139 if (this.IsPCFaction)
2141 foreach (
Chara chara
in this.branch.members)
2143 chara.ValidateWorks();
2146 EClass.game.lastActiveZone =
EClass.game.activeZone;
2147 base.lastActive =
EClass.world.date.GetRaw(0);
2148 this.map.OnDeactivate();
2150 EClass.game.activeZone =
null;
2151 if (this.IsInstance)
2154 base.isGenerated =
false;
2156 if (
Zone.forceRegenerate)
2160 this.OnDeactivate();
2164 public void OnKillGame()
2166 foreach (
Thing thing
in this.map.things)
2168 if (thing.renderer.hasActor)
2170 thing.renderer.KillActor();
2176 public void UnloadMap()
2179 if (this.bp !=
null)
2183 if (this.branch !=
null)
2185 this.branch.OnUnloadMap();
2187 Debug.Log(
"Unloaded Map:" + ((
this !=
null) ? this.ToString() :
null));
2191 public void ClaimZone(
bool debug =
false)
2193 EClass._map.RevealAll(
true);
2194 this.SetMainFaction(
EClass.pc.faction);
2196 this.branch.OnCreate(
this);
2201 this.instance =
null;
2202 base.dateExpire = 0;
2203 base.SetInt(2,
EClass.world.date.GetRaw(0));
2205 foreach (
Thing thing
in this.map.things)
2207 thing.isNPCProperty =
false;
2209 EClass.Branch.OnClaimZone();
2213 for (
int i = 0; i < 7; i++)
2215 Chara chara =
CharaGen.CreateFromFilter(
"c_neutral", -1, -1);
2216 EClass._zone.AddCard(chara,
EClass._map.bounds.GetRandomPoint().GetNearestPoint(
false,
false,
false,
false));
2217 this.branch.AddMemeber(chara);
2222 Msg.Say(
"claimedZone");
2223 EClass.Branch.Log(
"claimedZone",
null,
null,
null,
null);
2224 EClass.Sound.Play(
"jingle_embark");
2225 EClass.pc.PlaySound(
"build", 1f,
true);
2226 Effect.Get(
"aura_heaven").Play(
EClass.pc.pos, 0f,
null,
null);
2227 Point nearestPoint =
EClass.pc.pos.GetNearestPoint(
false,
true,
false,
false);
2228 EClass._zone.AddCard(
ThingGen.Create(
"core_zone", -1, -1), nearestPoint).SetPlaceState(PlaceState.installed,
false);
2231 EClass.player.spawnZone =
EClass._zone;
2235 public void AbandonZone()
2238 this.branch.members.ForeachReverse(delegate(
Chara m)
2240 destBranch.AddMemeber(m);
2246 EClass.Branch.OnUnclaimZone();
2247 this.SetMainFaction(
null);
2248 base.dateExpire =
EClass.world.date.GetRaw(0) + 10080;
2252 public bool CanDestroy()
2254 if (this.IsActiveZone || this.IsPCFaction ||
EClass.player.simulatingZone)
2258 if (this.IsInstance)
2262 if (base.dateExpire == 0 || !
EClass.world.date.IsExpired(base.dateExpire))
2266 Zone topZone = this.GetTopZone();
2267 return (base.isRandomSite ||
this is
Zone_Field || (topZone !=
null && topZone !=
this && topZone.FindDeepestZone() !=
this)) && EClass.pc.currentZone !=
null && !(EClass.pc.currentZone is
Zone_Tent) && topZone !=
EClass.pc.currentZone.GetTopZone() && (EClass.player.nextZone ==
null || topZone !=
EClass.player.nextZone.GetTopZone());
2271 public override void _OnBeforeSave()
2273 if (this.CanDestroy())
2275 Debug.Log(
"Deleting Zone:" + ((
this !=
null) ? this.ToString() :
null));
2276 if (!this.destryoed)
2282 if (this.map !=
null)
2284 Debug.Log(
"Saving Zone:" + ((
this !=
null) ? this.ToString() :
null));
2285 this.map.Save(base.pathSave,
null,
null);
2286 if (!base.isMapSaved)
2288 base.isMapSaved =
true;
2289 IO.DeleteDirectory(base.pathSave +
"Texture Replace");
2290 IO.CopyDir(this.pathTemp +
"Texture Replace", base.pathSave +
"/Texture Replace",
null);
2292 if (!this.IsActiveZone)
2300 public override void OnLoad()
2302 if (this.branch !=
null)
2304 this.branch.SetOwner(
this);
2306 this.events.OnLoad(
this);
2310 public override void Destroy()
2312 this.children.ForeachReverse(delegate(
Spatial z)
2316 if (this.map !=
null)
2320 if (this.parent !=
null && this.parent.IsRegion &&
this.instance ==
null)
2322 EClass.scene.elomap.SetZone(base.x, base.y,
null,
true);
2324 EClass.game.spatials.Remove(
this);
2325 this.destryoed =
true;
2326 base.isGenerated =
false;
2330 public void ClearZones(
Zone current =
null)
2332 if (this.map !=
null)
2336 base.isGenerated =
false;
2337 Zone topZone = this.GetTopZone();
2338 if (topZone !=
this)
2340 topZone.ClearZones(
this);
2343 this.children.ForeachReverse(delegate(
Spatial c)
2353 public void OnChildNumChange(
Card c)
2364 public Zone GetTopZone()
2366 if (this.parent ==
null || this.parent.IsRegion)
2370 return this.parent as
Zone;
2374 public Card AddCardSplinkle(
Card t,
Point center,
int radius = 4)
2377 for (
int i = 0; i < 1000; i++)
2379 point.x = center.x +
EClass.rnd(radius) -
EClass.rnd(radius);
2380 point.z = center.z +
EClass.rnd(radius) -
EClass.rnd(radius);
2381 if (point.IsValid && !point.IsBlocked && !point.HasChara)
2383 return this.AddCard(t, point);
2386 return this.AddCard(t, center);
2390 public Card AddChara(
string id,
int x,
int z)
2392 return this.AddCard(
CharaGen.Create(
id, -1), x, z);
2396 public Card AddThing(
string id,
int x,
int z)
2398 return this.AddCard(
ThingGen.Create(
id, -1, -1), x, z);
2402 public Card AddThing(
string id,
Point p)
2404 return this.AddThing(
id, p.x, p.z);
2410 return this.AddCard(t, point.x, point.z);
2416 return this.AddCard(t, 0, 0);
2420 public Card AddCard(
Card t,
int x,
int z)
2422 if (t.parent !=
null)
2424 t.parent.RemoveCard(t);
2427 Chara chara = t.Chara;
2430 chara.currentZone =
this;
2431 chara.SetAI(
new NoGoal());
2433 if (this.IsActiveZone)
2435 this.map.OnCardAddedToZone(t, x, z);
2436 if (this.isStarted && t.isThing && t.placeState == PlaceState.roaming && !
Zone.ignoreSpawnAnime)
2440 Zone.ignoreSpawnAnime =
false;
2446 public void RemoveCard(
Card t)
2448 if (this.IsActiveZone)
2450 this.map.OnCardRemovedFromZone(t);
2455 t.Chara.currentZone =
null;
2457 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
2459 EClass.scene.RemoveActorEx(t);
2461 if (t.renderer.hasActor)
2463 t.renderer.OnLeaveScreen();
2468 public T GetRandomSpot<T>() where T :
Trait
2470 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
2474 public bool TryAddThingInSpot<T>(
Thing t,
bool useContainer =
true,
bool putRandomPosIfNoSpot =
true) where T :
Trait
2476 Thing randomThing =
EClass._map.props.installed.traits.GetRandomThing<T>();
2477 if (randomThing !=
null)
2479 if (useContainer && (!t.IsContainer || t.things.Count == 0))
2481 List<Thing> list =
new List<Thing>();
2482 foreach (
Point point
in randomThing.trait.ListPoints(
null,
false))
2484 foreach (
Card card
in point.ListCards(
false))
2486 if (card.IsContainer)
2488 list.Add(card.Thing);
2492 if (this.TryAddThingInSharedContainer(t, list,
true,
false,
null,
false))
2497 this.AddCard(t, randomThing.trait.GetRandomPoint(
null));
2500 if (putRandomPosIfNoSpot)
2502 this.AddCard(t,
EClass._map.bounds.GetRandomSurface(
false,
true,
false));
2509 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func =
null) where T :
TraitSpot
2511 Zone.<>c__DisplayClass252_0<T> CS$<>8__locals1 =
new Zone.<>c__DisplayClass252_0<T>();
2512 CS$<>8__locals1.func = func;
2513 List<T> list =
new List<T>();
2514 List<Thing> list2 =
new List<Thing>();
2517 if (thing.IsInstalled && thing.trait is T)
2519 list.Add(thing.trait as T);
2522 foreach (T t
in list)
2524 foreach (
Point point
in t.ListPoints(
null,
false))
2526 foreach (
Thing thing2
in point.Things)
2528 if (thing2.IsInstalled)
2530 if (thing2.things.Count == 0)
2532 if (CS$<>8__locals1.<TryListThingsInSpot>g__IsValid|0(thing2))
2540 Func<Thing, bool> func2;
2541 if ((func2 = CS$<>8__locals1.<>9__1) ==
null)
2543 func2 = (CS$<>8__locals1.<>9__1 = ((
Thing _t) => base.<TryListThingsInSpot>g__IsValid|0(_t)));
2545 foreach (
Thing item
in things.List(func2,
false))
2558 public bool TryAddThingInSharedContainer(
Thing t, List<Thing> containers =
null,
bool add =
true,
bool msg =
false,
Chara chara =
null,
bool sharedOnly =
true)
2560 Zone.<>c__DisplayClass253_0 CS$<>8__locals1;
2561 CS$<>8__locals1.containers = containers;
2562 CS$<>8__locals1.sharedOnly = sharedOnly;
2563 CS$<>8__locals1.add = add;
2564 CS$<>8__locals1.t = t;
2565 CS$<>8__locals1.msg = msg;
2566 CS$<>8__locals1.chara = chara;
2567 CS$<>8__locals1.dest =
null;
2568 CS$<>8__locals1.priority = -1;
2569 CS$<>8__locals1.flag = CS$<>8__locals1.t.category.GetRoot().id.ToEnum(
true);
2570 if (CS$<>8__locals1.flag == ContainerFlag.none)
2572 CS$<>8__locals1.flag = ContainerFlag.other;
2574 if (CS$<>8__locals1.containers ==
null)
2576 CS$<>8__locals1.containers =
EClass._map.props.installed.containers;
2578 if (
Zone.<TryAddThingInSharedContainer>g__SearchDest|253_0(ref CS$<>8__locals1) !=
null)
2582 if (CS$<>8__locals1.dest ==
null)
2586 if (CS$<>8__locals1.add)
2588 if (CS$<>8__locals1.msg)
2590 CS$<>8__locals1.chara.Say(
"putSharedItem", CS$<>8__locals1.chara, CS$<>8__locals1.t, CS$<>8__locals1.dest.GetName(NameStyle.Full, -1),
null);
2592 CS$<>8__locals1.dest.AddThing(CS$<>8__locals1.t,
true, -1, -1);
2598 public bool TryAddThing(
Thing target,
Point p,
bool destroyIfFail =
false)
2601 if (p.cell.detail !=
null)
2603 foreach (
Thing thing
in p.cell.detail.things)
2605 if (thing.placeState == PlaceState.roaming)
2607 if (target.TryStackTo(thing))
2615 if (num == 0 || !destroyIfFail)
2617 EClass._zone.AddCard(target, p);
2625 public Thing TryGetThingFromSharedContainer(Func<Thing, bool> func)
2627 foreach (
Thing thing
in EClass._map.props.installed.containers)
2629 if (thing.IsSharedContainer)
2631 Thing thing2 = thing.things.Find(func,
true);
2644 Zone.<>c__DisplayClass256_0<T> CS$<>8__locals1 =
new Zone.<>c__DisplayClass256_0<T>();
2645 CS$<>8__locals1.idCat = idCat;
2646 List<T> list =
new List<T>();
2649 if (thing.IsInstalled && thing.trait is T)
2651 list.Add(thing.trait as T);
2654 foreach (T t
in list)
2656 foreach (
Point point
in t.ListPoints(
null,
false))
2658 foreach (
Thing thing2
in point.Things)
2660 if (thing2.IsInstalled && !thing2.isSale)
2662 if (thing2.things.Count == 0)
2664 if (CS$<>8__locals1.<TryGetRestock>g__IsValid|0(thing2,
false))
2672 Func<Thing, bool> func;
2673 if ((func = CS$<>8__locals1.<>9__1) ==
null)
2675 func = (CS$<>8__locals1.<>9__1 = ((
Thing _t) => base.<TryGetRestock>g__IsValid|0(_t,
true)));
2677 Thing thing3 = things.Find(func,
true);
2693 string text = this.IdProfile;
2699 text = ((base.lv < 0) ?
"Underground" :
"Sky");
2701 else if (region !=
null)
2703 EClass.scene.elomapActor.Initialize(region.elomap);
2704 text =
EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2705 if (this.bp !=
null)
2707 this.name = Lang.GetList(
"zone_" + text.Split(
'/', StringSplitOptions.None)[1]).RandomItem<
string>();
2709 for (
int i = 0; i < 3; i++)
2711 for (
int j = 0; j < 3; j++)
2713 this.bp.surrounding[j, i] =
EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2716 if (text ==
"Random/R_Shore")
2718 base.isBeach =
true;
2726 this.idProfile = text;
2732 public void CreateBP()
2736 this.bp.genSetting.seed = base.Seed;
2741 public virtual void OnCreateBP()
2746 public void Generate()
2748 base.isGenerated =
true;
2749 if (this.bp ==
null)
2753 if (this.bp.map ==
null)
2755 this.bp.GenerateMap(
this);
2757 this.map.SetZone(
this);
2763 for (
int i = 0; i < num; i++)
2765 Point randomSurface =
EClass._map.bounds.GetRandomSurface(
false,
true,
false);
2766 if (!randomSurface.HasObj)
2768 Card t =
ThingGen.Create(
"chest3", -1, -1).ChangeMaterial(this.biome.style.matDoor);
2769 EClass._zone.AddCard(t, randomSurface).Install();
2779 this.SpawnFollower();
2782 this.map.plDay = this.CreatePlaylist(ref this.map._plDay,
EClass.Sound.GetPlaylist(
this.IDPlayList) ??
EClass.Sound.GetPlaylist(
"Day"));
2786 public void SpawnFollower()
2788 Point randomSurface =
EClass._map.bounds.GetRandomSurface(
false,
true,
false);
2789 if (!randomSurface.IsValid)
2794 EClass._zone.AddCard(c, randomSurface);
2795 (
EClass._zone.AddThing(
"gallows", randomSurface).Install().trait as
TraitShackle).Restrain(c,
false);
2796 c.c_rescueState = RescueState.WaitingForRescue;
2802 c.ApplyBacker(row.id);
2805 Religion faith = (from a in EClass.game.religions.dictAll.Values
2807 select a).RandomItem<Religion>();
2808 for (
int i = 0; i < 3 +
EClass.rnd(4); i++)
2811 chara.SetFaith(faith);
2812 Point point = randomSurface.GetRandomPoint(4,
true,
true,
false, 100) ?? randomSurface.GetNearestPoint(
false,
true,
true,
false);
2813 EClass._zone.AddCard(chara, point);
2818 public void SpawnAltar()
2820 EClass.core.refs.crawlers.start.CrawlUntil(this.map, () => this.map.poiMap.GetCenterCell(1).GetCenter(), 1, delegate(
Crawler.
Result r)
2822 if (r.points.Count <= 4)
2826 this.map.poiMap.OccyupyPOI(r.points[0], 0);
2827 List<Point> points = r.points;
2828 Religion randomReligion =
EClass.game.religions.GetRandomReligion(
true,
false);
2829 "altarPoint".lang(randomReligion.NameDomain.lang(),
null,
null,
null,
null);
2831 (thing.trait as
TraitAltar).SetDeity(randomReligion.id);
2833 EClass._zone.AddCard(t, points.RandomItem<
Point>());
2834 for (
int i = 0; i < 2 +
EClass.rnd(2); i++)
2837 EClass._zone.AddCard(t2, points.RandomItem<
Point>());
2839 if (points[0].Installed ==
null)
2841 EClass._zone.AddCard(thing, points[0]).Install();
2843 foreach (
Point point
in points)
2845 if (point.x % 3 == 0 && point.z % 2 == 0 && point != points[0] && !point.Equals(points[0].Front) && point.Installed ==
null)
2847 thing =
ThingGen.Create(
"pillar1", -1, -1);
2848 EClass._zone.AddCard(thing, point).Install();
2850 point.SetObj(0, 1, 0);
2851 point.SetFloor(3, 6);
2858 public virtual void OnGenerateMap()
2860 if (this.MakeEnemiesNeutral)
2864 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral)
2866 chara.hostility = (chara.c_originalHostility = Hostility.Neutral);
2870 if (this.PrespawnRate != 0f && !this.IsSkyLevel)
2872 for (
int i = 0; i < (int)((float)this.MaxSpawn * this.PrespawnRate); i++)
2874 this.SpawnMob(
null,
null);
2877 this.TryGenerateOre();
2878 this.TryGenerateBigDaddy();
2879 this.TryGenerateEvolved(
false);
2880 this.TryGenerateShrine();
2884 public void TryGenerateOre()
2886 if (this.OreChance <= 0f)
2891 int tries =
EClass.rnd((
int)((
float)(this.map.bounds.Width *
this.map.bounds.Height / 200 + 1) *
this.OreChance + 2f));
2895 string group =
"ore";
2896 if (EClass.rnd(5) == 0)
2902 foreach (
Point point in r.points)
2904 if (point.sourceBlock.ContainsTag(
"ore"))
2906 this.map.SetObj(point.x, point.z, randomMaterial.id, (int)b, 1, 0);
2914 public void TryGenerateEvolved(
bool force =
false)
2916 if (!force && this.EvolvedChance <=
EClass.rndf(1f))
2921 for (
int i = 0; i < 2 +
EClass.rnd(2); i++)
2923 chara.ability.AddRandom();
2925 chara.AddThing(chara.MakeGene(
new DNA.Type?(
DNA.Type.Default)),
true, -1, -1);
2928 chara.AddThing(chara.MakeGene(
new DNA.Type?(
DNA.Type.Superior)),
true, -1, -1);
2933 public void TryGenerateBigDaddy()
2935 if (this.BigDaddyChance <=
EClass.rndf(1f))
2939 int num = this.DangerLv * 125 / 100;
2948 EClass._zone.AddCard(t, this.GetSpawnPos(SpawnPosition.Random, 10000));
2949 Msg.Say(
"sign_bigdaddy");
2953 public void TryGenerateShrine()
2955 for (
int i = 0; i < 3; i++)
2957 Rand.SetSeed(base.uid + i);
2958 if (this.ShrineChance >
EClass.rndf(1f))
2960 Point randomSpace =
EClass._map.GetRandomSpace(3, 3, 100);
2961 if (randomSpace !=
null)
2965 if (!randomSpace.HasThing && !randomSpace.HasChara)
2967 randomSpace.SetObj(0, 1, 0);
2968 Rand.SetSeed(
EClass.player.seedShrine);
2969 EClass.player.seedShrine++;
2972 EClass._zone.AddCard(
ThingGen.Create(
"pedestal_power", -1, -1), randomSpace).Install();
2973 EClass._zone.AddCard(
ThingGen.Create(
EClass.gamedata.godStatues.RandomItemWeighted((
GodStatueData a) => a.chance).idThing, -1,
this.DangerLv), randomSpace).Install();
2977 EClass._zone.AddCard(
ThingGen.Create(
"statue_power", -1,
this.DangerLv), randomSpace).Install().SetRandomDir();
2987 public void ResetHostility()
2991 chara.hostility = chara.OriginalHostility;
2992 if (chara.enemy !=
null && (chara.enemy.IsPCFaction || chara.IsPCFaction))
2994 chara.SetEnemy(
null);
3000 public virtual void OnGenerateRooms(
BaseMapGen gen)
3005 public Point GetSpawnPos(SpawnPosition type,
int tries = 100)
3008 for (
int i = 0; i < tries; i++)
3010 point =
EClass._map.bounds.GetRandomSurface(
false,
true,
true);
3011 if (point.IsValid && !point.cell.hasDoor && !point.IsSync && (type != SpawnPosition.Outside || (!point.cell.HasRoof && point.cell.light <= 0)))
3022 if (setting ==
null)
3028 pos = this.GetSpawnPos(setting.position, setting.tries);
3031 pos = this.GetSpawnPos(SpawnPosition.Random, setting.tries);
3040 if (setting.idSpawnList !=
null)
3042 spawnList =
SpawnList.Get(setting.idSpawnList,
null,
null);
3044 else if (setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) <
this.ChanceSpawnNeutral))
3046 spawnList =
SpawnList.Get(
"c_neutral",
null,
null);
3048 else if (biome.spawn.chara.Count > 0)
3050 spawnList =
SpawnList.Get(biome.spawn.GetRandomCharaId(),
null,
null);
3056 ShouldPass = ((SourceChara.Row s) => !(s.hostility !=
"") && (s.biome == biome.name || s.biome.IsEmpty()))
3059 int dangerLv = this.DangerLv;
3062 rarity = Rarity.Normal
3064 int lv = (setting.filterLv == -1) ? dangerLv : setting.filterLv;
3065 if (this.ScaleMonsterLevel)
3067 lv = ((dangerLv - 1) % 50 + 5) * 150 / 100;
3069 CardRow cardRow = setting.id.IsEmpty() ? spawnList.Select(lv, setting.levelRange) :
EClass.sources.cards.map[setting.id];
3070 int num = (setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv;
3071 if (this.ScaleMonsterLevel)
3073 num = (50 + cardRow.LV) * Mathf.Max(1, (dangerLv - 1) / 50);
3075 if (setting.rarity == Rarity.Random)
3077 if (
EClass.rnd(100) == 0)
3079 cardBlueprint.rarity = Rarity.Legendary;
3080 num = num * 125 / 100;
3085 cardBlueprint.rarity = setting.rarity;
3089 num = num * 150 / 100;
3091 if (setting.isEvolved)
3095 if (num != cardRow.LV)
3097 cardBlueprint.lv = num;
3101 this.AddCard(chara, pos);
3102 if (setting.forcedHostility !=
null)
3104 chara.c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
3108 chara.c_bossType = BossType.Boss;
3110 if (setting.isEvolved)
3112 chara.c_bossType = BossType.Evolved;
3118 public void RefreshElectricity()
3120 this.dirtyElectricity =
false;
3121 base.electricity = this.elements.Value(2201) * 10 + this.BaseElectricity;
3124 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
3126 base.electricity += thing.trait.Electricity;
3131 if (thing2.IsInstalled)
3133 thing2.trait.TryToggle();
3139 public int GetElectricity(
bool cost =
false)
3144 if (thing.IsInstalled && thing.trait.Electricity != 0)
3148 if (thing.trait.Electricity < 0)
3150 num += -thing.trait.Electricity;
3153 else if (thing.trait.Electricity > 0)
3155 num += thing.trait.Electricity;
3161 num += this.elements.Value(2201) * 10;
3167 public void SetBGM(List<int> ids,
bool refresh =
true)
3169 this.map._plDay.Clear();
3172 foreach (
int num
in ids)
3176 this.map._plDay.Add(num);
3180 UnityEngine.Object.DestroyImmediate(this.map.plDay);
3181 this.map.plDay =
null;
3182 this.RefreshPlaylist();
3185 EClass.Sound.StopBGM(0f,
false);
3191 public void SetBGM(
int id = -1,
bool refresh =
true)
3193 this.SetBGM(
new List<int>
3200 public void RefreshPlaylist()
3202 if (this.map.plDay ==
null)
3204 this.map.plDay = this.CreatePlaylist(ref this.map._plDay,
EClass.Sound.GetPlaylist(
this.IDPlayList));
3209 public void RefreshBGM()
3211 if (!
EClass.pc.IsInActiveZone ||
EClass.player.simulatingZone)
3215 this.RefreshPlaylist();
3216 Playlist playlist = this.map.plDay;
3217 foreach (
ZoneEvent zoneEvent
in this.events.list)
3219 if (zoneEvent.playlist !=
null)
3221 playlist = zoneEvent.playlist;
3224 if (this.IDPlaylistOverwrite !=
null)
3226 playlist =
EClass.Sound.GetPlaylist(this.IDPlaylistOverwrite);
3228 if (
EClass.pc.IsInActiveZone)
3230 global::Room room =
EClass.pc.pos.cell.room;
3231 if (room !=
null && room.lot !=
null && room.lot.idBGM != 0)
3233 playlist =
EClass.Sound.plLot;
3234 BGMData data = playlist.list[0].data;
3235 int? num = (data !=
null) ?
new int?(data.id) :
null;
3236 int idBGM = room.lot.idBGM;
3237 if (!(num.GetValueOrDefault() == idBGM & num !=
null))
3239 playlist.list[0].data =
EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM,
null);
3243 EClass.Sound.StopBGM(1f,
false);
3248 EClass.core.config.SetBGMInterval();
3253 public Playlist CreatePlaylist(ref List<int> list, Playlist mold =
null)
3255 Playlist playlist =
EClass.Sound.plBlank.Instantiate<Playlist>();
3256 if (list.Count == 0 && mold)
3258 list = mold.ToInts();
3259 playlist.shuffle = mold.shuffle;
3260 playlist.minSwitchTime = mold.minSwitchTime;
3261 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
3262 playlist.ignoreLoop = mold.ignoreLoop;
3264 foreach (
int key
in list)
3266 playlist.list.Add(
new Playlist.Item
3268 data = EClass.core.refs.dictBGM[key]
3275 public Chara FindChara(
string id)
3277 return this.map.charas.Find((
Chara c) => c.id ==
id);
3281 public Chara FindChara(
int uid)
3283 return this.map.charas.Find((
Chara c) => c.uid == uid);
3287 public int GetDeepestLv()
3290 return this.GetDeepestLv(ref lv);
3294 public int GetDeepestLv(ref
int max)
3296 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
3300 foreach (
Spatial spatial
in this.children)
3302 (spatial as
Zone).GetDeepestLv(ref max);
3308 public List<Element> ListLandFeats()
3310 if (this.landFeats ==
null)
3312 this.landFeats =
new List<int>();
3313 Rand.SetSeed(
EClass._zone.uid);
3314 string[] listBase = this.IDBaseLandFeat.Split(
',', StringSplitOptions.None);
3315 foreach (
string text
in listBase)
3317 if (!text.IsEmpty())
3319 this.landFeats.Add(
EClass.sources.elements.alias[text].id);
3322 if (listBase.Length == 1)
3326 if (e.category !=
"landfeat" || e.chance == 0)
3331 foreach (
string text2 in e.tag)
3333 if (text2.StartsWith(
"bf"))
3336 if (listBase[0] == text2)
3344 }).ToList<SourceElement.Row>();
3346 this.landFeats.Add(row.id);
3349 this.landFeats.Add(row.id);
3353 List<Element> list2 =
new List<Element>();
3354 foreach (
int id in this.landFeats)
3356 list2.Add(
Element.Create(
id, 0));
3364 ZipFile zipFile = ZipFile.Read(path);
3365 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3366 zipFile.ExtractAll(this.pathTemp);
3372 public void Export(
string path,
PartialMap partial =
null,
bool usermap =
false)
3374 if (this.subset !=
null)
3386 IO.CreateTempDirectory(
null);
3387 if (!this.map.config.retainDecal)
3389 this.map.ClearRainAndDecal();
3391 this.map.Save(IO.TempPath +
"/", zoneExportData, partial);
3392 this.map.ExportMetaData(IO.TempPath +
"/", Path.GetFileNameWithoutExtension(path), partial);
3393 if (partial ==
null)
3395 IO.CopyDir(base.pathSave +
"Texture Replace", IO.TempPath +
"/Texture Replace",
null);
3397 IO.SaveFile(IO.TempPath +
"/export", zoneExportData,
true,
null);
3398 using (ZipFile zipFile =
new ZipFile())
3400 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3401 zipFile.AddDirectory(IO.TempPath);
3405 IO.DeleteTempDirectory(
null);
3407 catch (Exception ex)
3409 EClass.ui.Say(ex.Message +
":" + path,
null);
3414 public void ExportDialog(
string dir =
null)
3416 EClass.core.WaitForEndOfFrame(delegate
3418 string text = StandaloneFileBrowser.SaveFilePanel(
"Export Zone", dir ?? CorePath.ZoneSave,
"new zone",
"z");
3419 if (!
string.IsNullOrEmpty(text))
3421 this.Export(text,
null,
false);
3422 Msg.SayRaw(
"Exported Zone");
3428 public void ImportDialog(
string dir =
null)
3430 EClass.core.WaitForEndOfFrame(delegate
3432 string[] array = StandaloneFileBrowser.OpenFilePanel(
"Import Zone", dir ?? CorePath.ZoneSave,
"z",
false);
3433 if (array.Length != 0)
3436 zone_User.path = array[0];
3438 thing.c_uidZone = zone_User.uid;
3446 public static bool IsImportValid(
string path)
3452 result = (metaData !=
null && metaData.IsValidVersion());
3454 catch (Exception ex)
3456 EClass.ui.Say(ex.Message,
null);
3463 public void Export()
3465 EClass._map.ResetEditorPos();
3466 string pathExport = this.pathExport;
3467 IO.Copy(pathExport, CorePath.ZoneSave +
"Backup/");
3468 this.Export(pathExport,
null,
false);
3469 Msg.Say(
"Exported Map:" + pathExport);
3473 public void WriteNote(UINote n, Action<UINote> onWriteNote =
null,
IInspect.NoteMode mode =
IInspect.NoteMode.Default,
Recipe recipe =
null)
3478 public void OnInspect()
3483 public Chara AddRandomVisitor(
bool guest =
false)
3490 Point point = random.GetPoint();
3495 chara =
EClass.game.cards.ListGlobalChara(z).RandomItem<
Chara>();
3498 this.AddCard(chara, point);
3499 Msg.Say(
"guestArrive", chara,
null,
null,
null);
3500 chara.visitorState = VisitorState.Arrived;
3505 chara =
CharaGen.CreateFromFilter(
"c_wilds", -1, -1);
3506 this.AddCard(chara, point);
3507 chara.goalListType = GoalListType.Enemy;
3515 if (base.IsPlayerFaction)
3517 this.branch.OnSimulateHour(date);
3519 this.events.OnSimulateHour();
3520 if (date.IsRealTime)
3524 if (thing.IsInstalled)
3526 thing.trait.TryToggle();
3529 EClass.pc.DecayNatural(1);
3531 EClass._map.things.ForeachReverse(delegate(
Thing t)
3533 t.OnSimulateHour(date);
3539 Zone.Suckers.Clear();
3540 if (this.RespawnRate != 0f)
3543 using (List<Chara>.Enumerator enumerator2 = this.map.charas.GetEnumerator())
3545 while (enumerator2.MoveNext())
3547 if (!enumerator2.Current.IsGlobal)
3553 if (num < this.MaxRespawn)
3555 for (
int i = 0; i < this.RespawnPerHour; i++)
3557 this.SpawnMob(
null,
null);
3561 if (!date.IsRealTime &&
EClass.rnd(24) == 0)
3567 this.GrowPlants(date);
3574 if (base.IsPlayerFaction)
3576 this.branch.OnSimulateDay(date);
3583 if (base.IsPlayerFaction)
3585 this.branch.OnSimulateMonth(date);
3587 if (date.IsRealTime)
3589 EClass._map.RefreshAllTiles();
3594 public void RainWater()
3596 if (
EClass._map.IsIndoor || !
this.IsPCFaction)
3600 EClass._map.bounds.ForeachCell(delegate(global::Cell c)
3602 if (c.IsFarmField && !c.HasRoof)
3612 Zone.<>c__DisplayClass298_0 CS$<>8__locals1 =
new Zone.<>c__DisplayClass298_0();
3613 CS$<>8__locals1.date = date;
3614 CS$<>8__locals1.<>4__this =
this;
3615 bool flag = EClass.player.isAutoFarming = (this.IsPCFaction &&
EClass.Branch.policies.IsActive(2707, -1));
3616 CS$<>8__locals1.weedChance = 1;
3617 if (this.IsPCFaction &&
EClass.Branch.policies.IsActive(2703, -1))
3619 CS$<>8__locals1.weedChance += (EClass.debug.enable ? 100000 : 20) +
EClass.Branch.Evalue(2703) * 10;
3621 if (CS$<>8__locals1.date.sunMap ==
null)
3623 CS$<>8__locals1.date.BuildSunMap();
3627 HashSet<int> hashSet =
new HashSet<int>();
3630 if (thing.IsInstalled)
3633 if (traitSpotFarm !=
null)
3635 foreach (
Point point
in traitSpotFarm.ListPoints(
null,
false))
3637 hashSet.Add(point.index);
3642 CS$<>8__locals1.<GrowPlants>g__Perform|0(hashSet);
3643 EClass.player.isAutoFarming =
false;
3644 CS$<>8__locals1.<GrowPlants>g__Perform|0(hashSet);
3647 CS$<>8__locals1.<GrowPlants>g__Perform|0(
null);
3651 public Zone GetZoneAt(
int _x,
int _y)
3655 foreach (
Spatial spatial
in this.children)
3657 if (!(spatial is
Zone_Field) && _x == spatial.x && _y == spatial.y)
3659 return spatial as
Zone;
3663 foreach (
Spatial spatial2
in this.children)
3665 if (_x == spatial2.x && _y == spatial2.y)
3667 return spatial2 as
Zone;
3674 public bool IsCrime(
Chara c,
Act act)
3676 return act.IsHostileAct && this.HasLaw && !this.IsPCFaction && c.IsPC;
3680 public void RefreshCriminal()
3682 bool flag = EClass.player.IsCriminal && (this.HasLaw && !this.AllowCriminal) && !this.IsPCFaction;
3683 Hostility hostility = flag ? Hostility.Neutral : Hostility.Friend;
3688 chara.hostility = hostility;
3689 if (!flag && chara.enemy !=
null && chara.enemy.IsPCParty)
3691 chara.SetEnemy(
null);
3698 public void RefreshListCitizen()
3704 this.dictCitizen.Clear();
3705 foreach (
Chara chara
in this.map.charas.Concat(
this.map.deadCharas))
3707 if (chara.trait.IsCitizen && !chara.IsGlobal && !chara.isSubsetCard)
3709 this.dictCitizen.Add(chara.uid, chara.Name);
3715 public void ModInfluence(
int a)
3717 base.influence += a;
3720 Msg.Say(
"gainInfluence", this.Name, a.ToString() ??
"",
null,
null);
3722 Tutorial.Reserve(
"influence",
null);
3726 public void ModDevelopment(
int a)
3728 base.development += a;
3731 Msg.Say(
"gainDevelopment", this.Name, a.ToString() ??
"",
null,
null);
3736 public void UpdateQuests(
bool force =
false)
3738 if (!this.IsPCFaction && (!(
this is
Zone_Town) || base.lv != 0))
3742 Debug.Log(
"Updating Quest:" + force.ToString());
3743 List<
SourceQuest.
Row> list = (from a in EClass.sources.quests.rows
3744 where a.@group ==
"random"
3745 select a).ToList<SourceQuest.Row>();
3747 foreach (
Chara chara
in this.map.charas.Concat(
this.map.deadCharas))
3749 if (chara.quest !=
null && !
EClass.game.quests.list.Contains(chara.quest))
3751 if (chara.quest.IsExpired ||
this.completedQuests.Contains(chara.quest.uid) || force)
3761 if (
EClass._zone.dateQuest >
EClass.world.date.GetRaw(0) && !force)
3765 EClass._zone.dateQuest =
EClass.world.date.GetRaw(0) + 1440;
3767 Rand.UseSeed(base.uid +
EClass.player.stats.days / 7 % 100, delegate
3769 maxQuest = 4 + EClass.rnd(4);
3771 this.completedQuests.Clear();
3772 List<Zone> list2 =
Quest.ListDeliver();
3773 List<Tuple<string, int>> listTag =
new List<Tuple<string, int>>();
3774 string[] array =
EClass._zone.source.questTag;
3775 if (
EClass._zone.IsPCFaction)
3777 array =
new string[]
3790 string[] array2 = array;
3791 for (
int i = 0; i < array2.Length; i++)
3793 string[] array3 = array2[i].Split(
'/', StringSplitOptions.None);
3794 listTag.Add(
new Tuple<string, int>(array3[0], array3[1].ToInt()));
3798 while (num2 < this.map.charas.Count * 2 && num <= maxQuest && num <= 15)
3800 Chara chara2 = this.map.charas.RandomItem<
Chara>();
3801 if (chara2.trait.CanGiveRandomQuest && !chara2.isSubsetCard && chara2.homeZone ==
EClass._zone && !chara2.IsGuest() && chara2.memberType != FactionMemberType.Livestock && (chara2.quest ==
null || force))
3805 if ((getWeight = <>9__2) ==
null)
3810 foreach (Tuple<string, int> tuple
in listTag)
3812 if (a.tags.Contains(tuple.Item1))
3818 if (!
EClass._zone.IsPCFaction && a.tags.Contains(
"bulk"))
3822 return (
float)(a.chance * num3);
3826 if ((!row.tags.Contains(
"needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame <
EClass.player.fame ||
EClass.debug.enable))
3828 Quest.Create(row.id,
null, chara2);
3837 public int CountMinions(
Chara c)
3842 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3851 public int GetSoilCost()
3854 EClass._map.bounds.ForeachCell(delegate(global::Cell c)
3856 n += c.sourceObj.costSoil;
3862 public void SpawnLostItems()
3864 for (
int i = 0; i < 2 +
EClass.rnd(4); i++)
3866 Point point =
Zone.<SpawnLostItems>g__GetPos|308_0();
3872 thing.isLostProperty =
true;
3873 thing.things.DestroyAll(
null);
3874 int num =
EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50));
3875 thing.c_lockLv = num;
3876 thing.Add(
"money",
EClass.rndHalf(num * 60 + 1000), 1);
3879 thing.Add(
"plat",
EClass.rnd(4), 1);
3883 thing.Add(
"medal",
EClass.rnd(2), 1);
3885 EClass._zone.AddCard(thing, point);
3889 EClass._zone.AddCard(
ThingGen.CreateFromCategory(
"junk", -1), point);
3896 public void ApplyBackerPet()
3898 bool flag =
this is
Zone_Yowyn && base.lv == -1;
3901 if (!
EClass.core.config.test.ignoreBackerDestoryFlag)
3905 if (EClass.player.doneBackers.Contains(a.id))
3913 if (!chara.IsGlobal && !chara.IsMinion)
3915 if (chara.isBackerContent)
3917 if (chara.sourceBacker.isStatic != 0)
3921 chara.RemoveBacker();
3923 if ((!flag || !(chara.race.id !=
"cat")) &&
EClass.rnd(flag ? 2 : 10) == 0)
3927 if (row.chara == chara.id)
3929 chara.ApplyBacker(row.id);
3941 internal static Thing <TryAddThingInSharedContainer>g__SearchDest|253_0(ref
Zone.<>c__DisplayClass253_0 A_0)
3943 foreach (
Thing thing
in A_0.containers)
3947 thing =
EClass.game.cards.container_shipping;
3949 if (!A_0.sharedOnly || thing.IsSharedContainer)
3953 Thing thing2 = thing.things.TryStack(A_0.t.Thing, -1, -1);
3954 if (thing2 != A_0.t)
3958 A_0.chara.Say(
"putSharedItem", A_0.chara, thing, thing2.GetName(NameStyle.Full, -1),
null);
3963 else if (thing.things.CanStack(A_0.t, -1, -1) != A_0.t)
3967 if (thing.things.Count < thing.things.MaxCapacity)
3969 Window.SaveData windowSaveData = thing.GetWindowSaveData();
3970 if (windowSaveData !=
null)
3972 if (windowSaveData.priority <= A_0.priority || (windowSaveData.noRotten && A_0.t.IsDecayed) || (windowSaveData.onlyRottable && A_0.t.trait.Decay == 0))
3976 if (windowSaveData.advDistribution)
3979 foreach (
int num
in windowSaveData.cats)
3981 if (A_0.t.category.uid == num)
3992 else if (windowSaveData.flag.HasFlag(A_0.flag))
3996 A_0.priority = windowSaveData.priority;
4000 if (A_0.priority != -1)
4015 internal static Point <SpawnLostItems>g__GetPos|308_0()
4017 for (
int i = 0; i < 10; i++)
4019 Point randomPoint =
EClass._zone.bounds.GetRandomPoint();
4020 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
4029 public static bool forceRegenerate;
4032 public static string forceSubset;
4035 public static CardRow sourceHat;
4038 public static int okaerinko = 0;
4046 public HashSet<int> completedQuests =
new HashSet<int>();
4062 public Dictionary<int, string> dictCitizen =
new Dictionary<int, string>();
4070 public List<int> landFeats;
4082 public int fileVariation;
4085 public bool dirtyElectricity;
4088 public bool isStarted;
4091 public bool isSimulating;
4094 public int tempDist;
4100 public static bool ignoreSpawnAnime;
4103 public static List<Thing> Suckers =
new List<Thing>();