2using System.Collections.Generic;
49 public Dictionary<int, string>
dictCitizen =
new Dictionary<int, string>();
80 public static List<Thing>
Suckers =
new List<Thing>();
90 base.uidBoss = value?.
uid ?? 0;
138 public virtual string IDPlayList => base.source.idPlaylist.IsEmpty((base.lv != 0) ?
"Underground" :
null);
142 public virtual string IDHat =>
null;
150 if (base.source.idFile.Length != 0)
152 return base.source.idFile[
fileVariation] + ((base.lv == 0) ?
"" : (
"_F" + base.lv));
158 public string pathTemp => GameIO.pathTemp + base.uid +
"/";
308 public virtual int MaxSpawn => map.bounds.Width * map.bounds.Height / 175 + 2;
354 return base.source.tag.Contains(
"return");
366 return base.lv <
MaxLv;
386 public virtual bool UseFog => base.lv < 0;
398 return base.source.tag.Contains(
"light");
410 public virtual FlockController.SpawnType
FlockType => FlockController.SpawnType.Default;
420 return "conquered".lang();
544 return base.source.id;
558 return " " +
"zoneLevelB".lang((_lv * -1).
ToString() ??
"");
560 return " " +
"zoneLevel".lang((_lv + 1).
ToString() ??
"");
594 EClass.game.config.reverseSnow =
false;
601 EClass.pc.global.transition.uidLastZone = 0;
609 EClass.game.activeZone =
this;
611 Debug.Log(
NameWithLevel +
"/" +
id +
"/" + base.uid +
"/" + base.isGenerated +
"/" +
IsLoaded +
"/" + File.Exists(base.pathSave +
"map"));
612 if (base.isGenerated && !
IsLoaded && !File.Exists(base.pathSave +
"map"))
614 Debug.Log(
"(Bug) File does not exist:" +
destryoed +
"/" + base.pathSave);
615 base.isGenerated =
false;
620 if (flag2 &&
map !=
null)
627 Debug.Log(
"generating random map");
650 Debug.Log(
"zone is already loaded");
664 Debug.Log(base.isGenerated +
"/" + flag3 +
"/" + flag2 +
"/" +
IDSubset);
665 if (!base.isGenerated || flag3 || flag2)
672 IO.DeleteDirectory(
pathTemp +
"Texture Replace");
678 base.isGenerated =
true;
682 zoneExportData.orgMap =
GameIO.LoadFile<
Map>(base.pathSave +
"map");
685 catch (Exception message)
689 base.isGenerated =
true;
694 Debug.Log(
"loading map: imported? " +
isImported +
" regenerate? " + flag3);
698 EClass.
ui.Say(
"System.IO.EndOfStreamException: Unexpected end of stream:" + Environment.NewLine +
"File may be corrupted. Try replacing the following file if you have a backup:" + Environment.NewLine + (
isImported ?
pathTemp : base.pathSave) +
"map");
716 if (zoneExportData.
orgMap !=
null)
720 map.charas = orgMap.
charas;
730 map.
cells[i, j].
isSeen = array[i * EClass._map.Size + j].GetBit(1);
736 Debug.Log(
"Importing New Chara:" +
item.id +
"/" +
item.Name +
"/" +
item.orgPos);
743 foreach (Thing thing in orgMap.things)
745 if (t.id == thing.id && t.pos.Equals(thing.pos))
747 if (t.trait is TraitNewZone)
750 map.things.Insert(0, thing);
751 thing.stackOrder = 0;
755 t.ChangeMaterial(thing.material);
765 foreach (Thing thing2 in orgMap.things)
767 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
770 map.things.Add(thing2);
776 if (t.id ==
"medal" || t.id ==
"856")
778 foreach (Thing thing3 in orgMap.things)
780 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
809 thing4.isSubsetCard =
false;
829 if (isImported && IsTown)
831 RefreshListCitizen();
834 AddGlobalCharasOnActivate();
838 foreach (
Card item3
in map.
Cards.ToList())
848 idCurrentSubset = forceSubset ?? IDSubset;
849 if (idCurrentSubset !=
null)
857 if (MakeTownProperties)
868 thing7.isNPCProperty =
false;
872 if (instance !=
null)
877 if (isImported && !flag3 && !RevealRoom)
887 point2.cell.isSeen =
false;
896 PathManager.Instance._pathfinder.PunishChangeDirection =
false;
900 EClass._map.config.idSceneProfile =
"indoor_water";
903 if (flag && IsTown && base.lv == 0)
907 if (base.visitCount == 0)
915 map.effectManager.GetOrCreate(c.GetSharedPoint());
934 Map.isDirtySunMap =
true;
950 chara.dirtySpeed =
true;
955 if (
card.IsUnique && !
card.IsPCFaction && !
card.IsPCParty)
965 int @
int =
card.GetInt(55);
970 if (chara2.
uid == @
int)
974 chara.enemy = chara2;
976 chara.calmCheckTurn = 20 +
EClass.
rnd(30);
984 if (
card.c_uidMaster != 0 && chara.
master ==
null)
997 else if (
card.IsInstalled &&
card.trait is
TraitDoor traitDoor &&
card.pos.HasChara && !traitDoor.IsOpen())
999 traitDoor.ToggleDoor(sound:
false, refresh:
false);
1003 forceRegenerate =
false;
1015 OnVisitNewMapOrRegenerate();
1020 EClass.player.uidLastTown = 0;
1022 else if (IsTown && base.lv == 0)
1024 EClass.player.uidLastTown = base.uid;
1028 RefreshElectricity();
1058 EClass.player.stats.deepest = DangerLv;
1079 isSimulating =
true;
1081 isSimulating =
false;
1098 if (ShouldAutoRevive)
1118 Point point = GetSpawnPos(value);
1165 if (
Boss !=
null && IsNefia)
1171 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1182 chara2.mana.value = 0;
1186 chara2.stamina.value = 0;
1191 chara2.resistCon =
null;
1195 Msg.ignoreAll =
true;
1197 chara2.
HealHP(Mathf.Max(1, chara2.
MaxHP) * Mathf.Min(num, 20) / 20);
1198 chara2.
mana.
Mod(Mathf.Max(1, chara2.
mana.
max) * Mathf.Min(num, 20) / 20);
1200 Msg.ignoreAll =
false;
1204 Debug.Log(
"Last Active:" + base.lastActive);
1205 if (base.lastActive == 0 || HourSinceLastActive <= 1 || IsRegion)
1209 Debug.Log(Name +
" Simulate:" + HourSinceLastActive +
" hours");
1212 int num2 = HourSinceLastActive / 24;
1218 if (!
item.IsPCParty)
1220 item.OnSleep(200, num2);
1221 if (
item.conSleep !=
null)
1223 item.conSleep.Kill();
1229 if (
item.things.Count > 20)
1236 VirtualDate.current = virtualDate;
1237 for (
int i = 0; i < HourSinceLastActive; i++)
1249 VirtualDate.current =
null;
1255 foreach (
Chara item2
in list)
1263 if (item2.
id ==
"bee")
1267 if (num2 > 0 && item2.
IsGuest())
1277 item2.
SetAI(goalWork);
1280 (goalWork as
GoalWork).FindWork(item2);
1284 item2.
SetAI(goalWork);
1287 (goalWork as
GoalWork).FindWork(item2);
1297 List<Thing> list2 =
new List<Thing>();
1305 if (num4 >= list2.Count)
1309 for (
int j = num4; j < list2.Count; j++)
1311 if (
EClass.
rnd(200) <= HourSinceLastActive)
1314 AddCard(chara, list2.RandomItem().
pos);
1316 chara.c_originalHostility = c_originalHostility;
1326 bool flag = zone ==
null || zone.lv > base.
lv;
1332 if (GetZoneAt(topZone.
x, topZone.
y) !=
null)
1344 enterState = RegionEnterState;
1350 float rate = zoneTransition?.
ratePos ?? (-1f);
1359 if (nearestPoint !=
null && nearestPoint.
IsValid)
1361 return nearestPoint;
1371 return new Point(zoneTransition.
x, zoneTransition.
z);
1379 if (traitTeleporter !=
null)
1383 if (traitTeleporter !=
null && !zoneTransition.
idTele.IsEmpty() && zoneTransition.
idTele == traitTeleporter.
id.IsEmpty(traitTeleporter.
GetParam(3)))
1397 if (randomThing2 !=
null)
1417 if (randomThing !=
null)
1437 flag = base.lv <= 0;
1463 return new Point(zoneTransition.
x, zoneTransition.
z);
1465 return GetRandomVisitPos(c);
1479 if (thing5.
trait is
TraitNewZone { zone: not null } traitNewZone && zone !=
null && traitNewZone.
zone.
uid == zone.uid)
1481 if (c !=
null && enterState != 0)
1483 c.SetDir(traitNewZone.owner.dir);
1485 return traitNewZone.GetExitPos();
1490 if (thing6.
trait is
TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1492 if (c !=
null && enterState != 0)
1494 c.SetDir(traitNewZone2.owner.dir);
1496 return traitNewZone2.GetExitPos();
1499 return GetRandomVisitPos(c);
1507 point = map.
rooms.
listRoom.RandomItem().points.RandomItem();
1509 if (point ==
null &&
EClass.
rnd(4) != 0)
1526 Point spawnPosPC =
null;
1529 spawnPosPC = GetSpawnPos(
EClass.
pc);
1531 if (spawnPosPC ==
null)
1559 c.isRestrained =
false;
1563 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true) : GetSpawnPos(c)));
1568 pos.
Set(spawnPosPC);
1573 if (!spawnPosPC.ForeachNearestPoint(delegate(
Point p)
1581 }, allowBlock:
false, EClass.pc.party.members.Count >= 12, allowInstalled:
true, ignoreCenter:
true, EClass._zone.IsRegion ? 2 : 6))
1583 pos.
Set(spawnPosPC);
1588 c.global.transition =
null;
1596 Point nearestPoint = spawnPosPC.
GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true);
1598 item.pos.Set(nearestPoint);
1607 if (!IsUserZone && !IsPCFaction && map !=
null)
1609 List<Thing> list =
new List<Thing>();
1621 if (
item.IsContainer)
1639 Msg.
Say(
"pick_valuable");
1640 foreach (
Thing item2
in list)
1642 Msg.
Say(
"pick_valuable2", item2);
1647 base.isPeace =
false;
1648 OnBeforeDeactivate();
1660 EClass.game.activeZone =
null;
1664 base.isGenerated =
false;
1666 if (forceRegenerate)
1695 Debug.Log(
"Unloaded Map:" +
this);
1709 base.dateExpire = 0;
1714 thing.isNPCProperty =
false;
1720 for (
int i = 0; i < 7; i++)
1764 SetMainFaction(
null);
1780 if (!(text ==
"cave_yeek"))
1791 Zone topZone = GetTopZone();
1798 if (!base.isRandomSite && !(
this is
Zone_Field) && (topZone ==
null || topZone ==
this || topZone.
FindDeepestZone() ==
this))
1810 if (zone !=
null && zone.
GetTopZone() ==
this)
1822 Debug.Log(
"Deleting Zone:" +
this);
1828 else if (map !=
null)
1830 Debug.Log(
"Saving Zone:" +
this);
1831 map.
Save(base.pathSave);
1832 if (!base.isMapSaved)
1834 base.isMapSaved =
true;
1835 IO.DeleteDirectory(base.pathSave +
"Texture Replace");
1836 IO.CopyDir(pathTemp +
"Texture Replace", base.pathSave +
"/Texture Replace");
1856 children.ForeachReverse(delegate(
Spatial z)
1864 if (parent !=
null && parent.IsRegion && instance ==
null)
1870 base.isGenerated =
false;
1879 base.isGenerated =
false;
1880 Zone topZone = GetTopZone();
1881 if (topZone !=
this)
1886 children.ForeachReverse(delegate(
Spatial c)
1906 if (parent ==
null || parent.IsRegion)
1910 return parent as
Zone;
1916 for (
int i = 0; i < 1000; i++)
1922 return AddCard(t, point);
1925 return AddCard(t, center);
1940 return AddThing(
id, p.
x, p.
z);
1945 return AddCard(t, point.
x, point.
z);
1950 return AddCard(t, 0, 0);
1963 chara.currentZone =
this;
1973 ignoreSpawnAnime =
false;
1978 chara.hasSpawned =
true;
1992 t.Chara.currentZone =
null;
2004 public T GetRandomSpot<T>() where T :
Trait
2009 public bool TryAddThingInSpot<T>(
Thing t,
bool useContainer =
true) where T :
Trait
2012 if (randomThing ==
null)
2019 List<Thing> list =
new List<Thing>();
2022 foreach (
Card item2
in item.ListCards())
2026 list.Add(item2.
Thing);
2030 if (TryAddThingInSharedContainer(t, list, add:
true, msg:
false,
null, sharedOnly:
false))
2039 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func =
null) where T :
TraitSpot
2041 List<T> list =
new List<T>();
2042 List<Thing> list2 =
new List<Thing>();
2047 list.Add(thing.
trait as T);
2050 foreach (T
item in list)
2052 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2060 if (thing2.
things.Count == 0)
2062 if (IsValid(thing2))
2076 bool IsValid(
Thing t)
2078 if (func !=
null && !func(t))
2095 if (containers ==
null)
2099 if (SearchDest() !=
null)
2118 foreach (
Thing container
in containers)
2120 Thing thing = container;
2128 if (windowSaveData !=
null)
2148 foreach (
int cat
in windowSaveData.
cats)
2161 else if (windowSaveData.
flag.HasFlag(flag))
2166 priority = windowSaveData.
priority;
2200 if (num == 0 || !destroyIfFail)
2227 List<T> list =
new List<T>();
2232 list.Add(thing2.
trait as T);
2235 foreach (T
item in list)
2237 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2245 if (thing3.
things.Count == 0)
2247 if (IsValid(thing3, insideContainer:
false))
2262 bool IsValid(
Thing t,
bool insideContainer)
2274 string text = IdProfile;
2280 text = ((base.lv < 0) ?
"Underground" :
"Sky");
2282 else if (region !=
null)
2288 name =
Lang.
GetList(
"zone_" + text.Split(
'/')[1]).RandomItem();
2290 for (
int i = 0; i < 3; i++)
2292 for (
int j = 0; j < 3; j++)
2297 if (text ==
"Random/R_Shore")
2299 base.isBeach =
true;
2316 bp.genSetting.seed = base.Seed;
2326 base.isGenerated =
true;
2337 if (IdBiome ==
"Sand" || IdBiome ==
"Water" || IsUnderwater)
2339 int num = 1 +
EClass.
rnd((IdBiome ==
"Water") ? 3 : 2);
2340 for (
int i = 0; i < num; i++)
2345 Thing t =
ThingGen.
Create(
"pearl_oyster",
new string[3] {
"wood_birch",
"poplar",
"coralwood" }.RandomItem(), ContentLv);
2350 for (
int j = 0; j < num; j++)
2361 for (
int k = 0; k < 30 +
EClass.
rnd(30); k++)
2384 foreach (
Point point
in r.points)
2388 map.
SetObj(point.
x, point.
z, num6);
2402 foreach (
Point point2
in r.points)
2414 foreach (
Point point3
in r.points)
2421 if (zone_Field !=
null)
2426 for (
int l = 0; l < num4; l++)
2470 for (
int i = 0; i < 3 +
EClass.
rnd(4); i++)
2483 if (r.points.Count <= 4)
2488 List<Point> points = r.points;
2490 "altarPoint".lang(randomReligion.NameDomain.lang());
2495 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2500 if (points[0].Installed ==
null)
2506 if (
item.x % 3 == 0 &&
item.z % 2 == 0 &&
item != points[0] && !
item.Equals(points[0].Front) &&
item.Installed ==
null)
2508 thing = ThingGen.Create(
"pillar1");
2509 EClass._zone.AddCard(thing, item).Install();
2512 item.SetFloor(3, 6);
2520 if (MakeEnemiesNeutral)
2527 chara.hostility = hostility2;
2531 if (PrespawnRate != 0f && !IsSkyLevel)
2533 for (
int i = 0; i < (int)((
float)MaxSpawn * PrespawnRate); i++)
2539 TryGenerateBigDaddy();
2540 TryGenerateEvolved();
2541 TryGenerateShrine();
2546 if (OreChance <= 0f)
2553 string group =
"ore";
2554 if (EClass.rnd(5) == 0)
2560 foreach (
Point point in r.points)
2562 if (point.sourceBlock.ContainsTag(
"ore"))
2564 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2573 if (!force && EvolvedChance <=
EClass.
rndf(1f))
2578 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2594 int num = DangerLv * 125 / 100;
2604 Msg.
Say(
"sign_bigdaddy");
2610 for (
int i = 0; i < 3; i++)
2618 if (randomSpace ==
null)
2650 chara.c_originalHostility = (
Hostility)0;
2667 for (
int i = 0; i < tries; i++)
2699 if (setting ==
null)
2705 pos = GetSpawnPos(setting.position, setting.tries);
2716 if (IsUnderwater &&
EClass.
rnd(15) != 0)
2725 if (s.hostility !=
"")
2729 return s.biome == biome.name || s.biome.IsEmpty();
2732 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
2736 idEle = setting.idEle
2738 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
2741 num2 = ((num - 1) % 50 + 5) * 150 / 100;
2742 if (num2 >= 20 &&
EClass.
rnd(100) < num2)
2748 int num3 = ((setting.fixedLv == -1) ? cardRow.
LV : setting.fixedLv);
2751 num3 = (50 + cardRow.
LV) * Mathf.Max(1, (num - 1) / 50);
2753 num3 += DangerLvBoost;
2754 if (setting.rarity ==
Rarity.Random)
2758 cardBlueprint.rarity =
Rarity.Legendary;
2759 num3 = num3 * 125 / 100;
2764 cardBlueprint.rarity = setting.rarity;
2768 num3 = num3 * 150 / 100;
2770 if (setting.isEvolved)
2772 num3 = num3 * 2 + 20;
2774 if (num3 != cardRow.
LV)
2776 cardBlueprint.lv = num3;
2780 AddCard(chara, pos);
2781 if (setting.forcedHostility.HasValue)
2783 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
2784 chara.c_originalHostility = c_originalHostility;
2790 if (setting.isEvolved)
2792 chara.c_bossType =
BossType.Evolved;
2799 dirtyElectricity =
false;
2800 bool flag = GetSoilCost() > MaxSoil;
2801 base.electricity = elements.
Value(2201) * 10 + BaseElectricity;
2815 base.electricity += 20;
2830 bool flag = GetSoilCost() > MaxSoil;
2852 sum += elements.
Value(2201) * 10 + BaseElectricity;
2867 public void SetBGM(List<int> ids,
bool refresh =
true)
2872 foreach (
int id in ids)
2880 UnityEngine.Object.DestroyImmediate(map.
plDay);
2890 public void SetBGM(
int id = -1,
bool refresh =
true)
2892 SetBGM(
new List<int> {
id }, refresh);
2897 if (map.
plDay ==
null)
2899 map.plDay = CreatePlaylist(ref map.
_plDay,
EClass.
Sound.GetPlaylist(IDPlayList));
2910 Playlist playlist = map.
plDay;
2913 if (
item.playlist !=
null)
2915 playlist =
item.playlist;
2918 if (IDPlaylistOverwrite !=
null)
2920 playlist =
EClass.
Sound.GetPlaylist(IDPlaylistOverwrite);
2925 if (room !=
null && room.
lot !=
null && room.
lot.
idBGM != 0)
2928 if (playlist.list[0].data?.id != room.
lot.
idBGM)
2945 Playlist playlist =
EClass.
Sound.plBlank.Instantiate();
2946 if (list.Count == 0 && (
bool)mold)
2948 list = mold.ToInts();
2949 playlist.shuffle = mold.shuffle;
2950 playlist.minSwitchTime = mold.minSwitchTime;
2951 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
2952 playlist.ignoreLoop = mold.ignoreLoop;
2953 playlist.keepBGMifSamePlaylist = mold.keepBGMifSamePlaylist;
2954 playlist.name = mold.name;
2956 foreach (
int item in list)
2958 playlist.list.Add(
new Playlist.Item
2960 data = EClass.core.refs.dictBGM[item]
2979 return GetDeepestLv(ref max);
2984 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
2988 foreach (
Spatial child
in children)
2990 (child as
Zone).GetDeepestLv(ref max);
2997 if (landFeats ==
null)
2999 landFeats =
new List<int>();
3001 string[] listBase = IDBaseLandFeat.Split(
',');
3002 string[] array = listBase;
3003 foreach (
string text
in array)
3005 if (!text.IsEmpty())
3010 if (listBase.Length == 1)
3014 if (e.category !=
"landfeat" || e.chance == 0)
3019 string[] tag = e.tag;
3020 foreach (
string text2 in tag)
3022 if (text2.StartsWith(
"bf"))
3025 if (listBase[0] == text2)
3032 return flag ? true :
false;
3035 landFeats.Add(row.
id);
3038 landFeats.Add(row.
id);
3042 List<Element> list2 =
new List<Element>();
3043 foreach (
int landFeat
in landFeats)
3052 ZipFile zipFile = ZipFile.Read(path);
3053 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3054 zipFile.ExtractAll(pathTemp);
3073 IO.CreateTempDirectory();
3078 map.
Save(IO.TempPath +
"/", zoneExportData, partial);
3079 map.
ExportMetaData(IO.TempPath +
"/", Path.GetFileNameWithoutExtension(path), partial);
3080 if (partial ==
null)
3082 IO.CopyDir(base.pathSave +
"Texture Replace", IO.TempPath +
"/Texture Replace");
3084 IO.SaveFile(IO.TempPath +
"/export", zoneExportData, compress:
true);
3085 using (ZipFile zipFile =
new ZipFile())
3087 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3088 zipFile.AddDirectory(IO.TempPath);
3092 IO.DeleteTempDirectory();
3094 catch (Exception ex)
3096 EClass.
ui.Say(ex.Message +
":" + path);
3105 if (!
string.IsNullOrEmpty(text))
3118 if (array.Length != 0)
3120 Zone_User zone_User = SpatialGen.Create(
"user", EClass.world.region, register: true) as Zone_User;
3121 zone_User.path = array[0];
3122 Thing thing = ThingGen.Create(
"teleporter");
3123 thing.c_uidZone = zone_User.uid;
3124 EClass._zone.AddCard(thing, EClass.pc.pos);
3135 catch (Exception ex)
3145 string text = pathExport;
3148 Msg.
Say(
"Exported Map:" + text);
3163 return -100000 + base.uid;
3167 return -90000 + base.uid;
3187 AddCard(chara, point);
3188 Msg.
Say(
"guestArrive", chara);
3195 AddCard(chara, point);
3203 if (base.IsPlayerFaction)
3223 foreach (
Thing sucker
in Suckers)
3228 if (RespawnRate != 0f)
3238 if (num < MaxRespawn)
3240 for (
int i = 0; i < RespawnPerHour; i++)
3246 if (!date.IsRealTime &&
EClass.
rnd(24) == 0)
3258 if (base.IsPlayerFaction)
3266 if (base.IsPlayerFaction)
3305 HashSet<int> hashSet =
new HashSet<int>();
3312 foreach (
Point item in traitSpotFarm.ListPoints(
null, onlyPassable:
false))
3314 hashSet.Add(
item.index);
3318 EClass.player.isAutoFarming =
false;
3325 void Perform(HashSet<int> farmMap)
3330 if (farmMap !=
null)
3334 if (!farmMap.Contains(c.index))
3339 else if (farmMap.Contains(c.
index))
3353 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3358 if (!flag && (plantData ==
null || plantData.fert >= 0))
3364 if (date.sunMap == null)
3374 else if (c.
detail !=
null)
3376 c.Things.ForeachReverse(delegate(Thing t)
3378 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3380 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3393 c.isWatered =
false;
3402 foreach (
Spatial child
in children)
3404 if (!(child is
Zone_Field) && _x == child.
x && _y == child.
y)
3406 return child as
Zone;
3410 foreach (
Spatial child2
in children)
3412 if (_x == child2.
x && _y == child2.
y)
3414 return child2 as
Zone;
3431 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3437 chara.hostility = hostility;
3452 dictCitizen.Clear();
3455 if (
item.trait.IsCitizen && !
item.IsGlobal && !
item.isSubsetCard)
3464 base.influence += a;
3467 Msg.
Say(
"gainInfluence", Name, a.ToString() ??
"");
3474 base.development += a;
3477 Msg.
Say(
"gainDevelopment", Name, a.ToString() ??
"");
3483 if (!IsPCFaction && (!(
this is
Zone_Town) || base.lv != 0))
3487 Debug.Log(
"Updating Quest:" + force);
3494 if (
item.quest.IsExpired || completedQuests.Contains(
item.quest.uid) || force)
3512 maxQuest = 4 + EClass.rnd(4);
3514 completedQuests.Clear();
3516 List<Tuple<string, int>> listTag =
new List<Tuple<string, int>>();
3520 array =
new string[9] {
"supply/8",
"deliver/7",
"food/8",
"escort/4",
"deliver/4",
"monster/0",
"war/0",
"farm/0",
"music/0" };
3522 string[] array2 = array;
3523 for (
int i = 0; i < array2.Length; i++)
3525 string[] array3 = array2[i].Split(
'/');
3526 listTag.Add(
new Tuple<string, int>(array3[0], array3[1].ToInt()));
3528 for (
int j = 0; j < map.charas.Count * 2; j++)
3546 foreach (Tuple<string, int> item2
in listTag)
3548 if (a.tags.Contains(item2.Item1))
3558 return a.chance * num2;
3570 List<Chara> list =
new List<Chara>();
3606 for (
int i = 0; i < 2 +
EClass.
rnd(4); i++)
3608 Point point = GetPos();
3616 thing.isLostProperty =
true;
3618 int num2 = (thing.c_lockLv =
EClass.
rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3635 static Point GetPos()
3637 for (
int j = 0; j < 10; j++)
3651 bool flag =
this is
Zone_Yowyn && base.lv == -1;
3658 if (EClass.player.doneBackers.Contains(a.id))
3676 if (chara.
id !=
"follower")
3681 if ((flag && chara.
race.id !=
"cat") ||
EClass.
rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0)
3687 if (
item.chara == chara.
id)
3699 if (fortuneRoll ==
null)
3704 if (refresh || fortuneRoll.
count == 0)
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
virtual void OnSimulatePosition()
void SimulateZone(int days)
void Add(Act a, string s="")
virtual bool IsHostileAct
BaseArea.AccessType accessType
void WaitForEndOfFrame(Action action)
string GetRandomCharaId()
void Populate(Point point, bool interior=false, float mtpDensity=1f)
static void Set(CardBlueprint _bp)
GlobalCharaList globalCharas
List< Chara > ListGlobalChara(Zone z)
override void OnLeaveScreen()
virtual void OnSimulateHour(VirtualDate date)
void SetPlaceState(PlaceState newState, bool byPlayer=false)
SourceBacker.Row sourceBacker
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
virtual void HealHP(int a, HealSource origin=HealSource.None)
Thing AddThing(string id, int lv=-1)
void AddEditorTag(EditorTag tag)
void DecayNatural(int hour=1)
Window.SaveData GetWindowSaveData()
bool HasEditorTag(EditorTag tag)
bool TryStackTo(Thing to)
void ApplyBacker(int bid)
Thing Add(string id, int num=1, int lv=1)
SourceCategory.Row category
void Say(string lang, string ref1=null, string ref2=null)
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
static Chara Create(string id, int lv=-1)
Hostility OriginalHostility
bool HasCondition(string alias)
override bool IsPCFaction
void TryRestock(bool onCreate)
void Revive(Point p=null, bool msg=false)
Thing MakeGene(DNA.Type? type=null)
Chara SetEnemy(Chara c=null)
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
void MoveZone(string alias)
bool ignoreBackerDestoryFlag
Dictionary< int, BGMData > dictBGM
static Crawler Create(string id)
bool CrawlUntil(Map map, Func< Point > onStart, int tries, Func< Result, bool > canComplete, Action onFail=null)
int GetElapsedHour(int rawDate)
int GetRaw(int offsetHours=0)
int GetElapsedMins(int rawDate)
int GetRemainingHours(int rawDeadLine)
static int curve(int a, int start, int step, int rate=75)
static SourceManager sources
static float rndf(float a)
static FactionBranch Branch
static int rndHalf(int a)
static SoundManager Sound
static GameSetting setting
static Effect Get(Effect original)
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
static Element Create(int id, int v=0)
void Initialize(EloMap _elomap)
void SetZone(int gx, int gy, Zone z, bool updateMesh=false)
TileInfo GetTileInfo(int gx, int gy)
void OnSimulateMonth(VirtualDate date)
void OnSimulateDay(VirtualDate date)
void OnSimulateHour(VirtualDate date)
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
ElementContainerZone elements
List< GodStatueData > godStatues
ReligionManager religions
ZoneTransition transition
void SetStage(int idx, bool renewHarvest=false)
virtual bool NeedSunlight
bool CanGrow(VirtualDate date)
void RefreshDevelopment()
static Guild GetCurrentGuild()
static string[] GetList(string id)
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Point GetLeftPos(float rate=-1f)
void ForeachCell(Action< Cell > action)
Point GetBottomPos(float rate=-1f)
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Point GetTopPos(float rate=-1f)
Point GetRandomSpace(int width, int height, int tries=100)
Point GetRightPos(float rate=-1f)
static MapSubset Load(string id)
new void ForeachCell(Action< Cell > action)
PlantData TryGetPlant(Point p)
void ExportMetaData(string _path, string id, PartialMap partial=null)
Chara FindChara(string id)
IEnumerable< Card > Cards
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
void Save(string path, ZoneExportData export=null, PartialMap partial=null)
void AddCardOnActivate(Card c)
void OnCardRemovedFromZone(Card t)
byte[] TryLoadFile(string path, string s, int size)
Dictionary< int, int > backerObjs
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
PlantData AddPlant(Point pos, Thing seed)
void OnImport(ZoneExportData data)
List< Chara > serializedCharas
static MapMetaData GetMetaData(string pathZip)
void OnCardAddedToZone(Card t, int x, int z)
void Load(string path, bool import=false, PartialMap partial=null)
void RevealAll(bool reveal=true)
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
static string SayRaw(string text)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Cell GetCenterCell(int radius=1)
void OccyupyPOI(Point p, int radius=0)
static PathManager Instance
bool IsPathClear(Point origin, Point dest, IPathfindWalker walker, int radius)
HashSet< int > doneBackers
void SetObj(int id=0, int value=1, int dir=0)
override string ToString()
Point Set(int _x, int _z)
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
bool Equals(int _x, int _z)
Point Clamp(bool useBounds=false)
Thing FindThing(Func< Thing, bool > func)
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
bool IsActive(int id, int days=-1)
static List< Zone > ListDeliver()
static Quest Create(string _id, string _idPerson=null, Chara c=null)
static int Range(int min, int max)
static void InitBytes(int a)
static void UseSeed(int seed, Action action)
static void SetSeed(int a=-1)
Dictionary< string, Religion > dictAll
Religion GetRandomReligion(bool onlyJoinable=true, bool includeMinor=false)
static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect)
static string SaveFilePanel(string title, string directory, string defaultName, string extension)
static SceneProfile Load(string id)
void RemoveActorEx(Card c)
Dictionary< string, CardRow > map
SourceZoneAffix zoneAffixes
virtual int DangerLvBoost
static SpawnList Get(string id, Func< SourceChara.Row, bool > func)
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
static SpawnSetting Default
static SpawnSetting Fish()
static SpawnSetting Evolved(int fixedLv=-1)
void ApplyLocalReplace(string path)
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
void DestroyAll(Func< Thing, bool > funcExclude=null)
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)
static Thing CreateFromCategory(string idCat, int lv=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
override string GetName(NameStyle style, int _num=-1)
virtual bool CanGiveRandomQuest
virtual bool CanAutoRevive
TraitSet GetTraitSet(Type t)
virtual bool IsFor(Zone z)
static bool CanTagSale(Card t, bool insideContainer=false)
static Thing MakeSeed(SourceObj.Row obj, PlantData plant=null)
static void LevelSeed(Thing t, SourceObj.Row obj, int num)
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
virtual ShopType ShopType
string GetParam(int i, string def=null)
static void Reserve(string idStep, Action onBeforePlay=null)
FilterResult IsFilterPass(string text)
void GenerateMap(Zone zone)
EloMap.TileInfo[,] surrounding
List< ZonePreEnterEvent > listPreEnter
virtual void OnGenerateMap()
virtual bool ShowEnemyOnMinimap
static ZoneProfile Load(string id)
void SetBGM(int id=-1, bool refresh=true)
virtual string GetNewZoneID(int level)
void OnChildNumChange(Card c)
virtual bool CanDigUnderground
virtual int BaseElectricity
virtual string IDPlayList
Dictionary< int, string > dictCitizen
void SetBGM(List< int > ids, bool refresh=true)
override string ToString()
List< Chara > ListMinions(Chara c)
void RefreshElectricity()
ZoneExportData Import(string path)
virtual string IDBaseLandFeat
virtual string GetDungenID()
virtual bool BlockBorderExit
static string forceSubset
virtual float PrespawnRate
FortuneRollData GetOrCreateFortuneRollData(bool refresh=true)
virtual bool RegenerateOnEnter
virtual void OnAfterSimulate()
void OnSimulateDay(VirtualDate date)
Playlist CreatePlaylist(ref List< int > list, Playlist mold=null)
static bool IsImportValid(string path)
virtual string IDGenerator
int CountMinions(Chara c)
virtual bool MakeTownProperties
Thing TryGetThingFromSharedContainer(Func< Thing, bool > func)
void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
virtual void OnRegenerate()
virtual bool CountDeepestLevel
virtual ZoneScaleType ScaleType
virtual string pathExport
virtual void OnBeforeDeactivate()
virtual ZoneTransition.EnterState RegionEnterState
virtual bool ShouldAutoRevive
HashSet< int > completedQuests
virtual bool DisableRooms
Chara TryGenerateEvolved(bool force=false, Point p=null)
void ImportDialog(string dir=null)
void ClaimZone(bool debug=false, Point pos=null)
Chara AddChara(string id, int x, int z)
Card AddThing(string id, int x, int z)
virtual bool ShouldScaleImportedChara(Chara c)
ElementContainerZone elements
virtual bool IsReturnLocation
Chara AddRandomVisitor(bool guest=false)
void ExportDialog(string dir=null)
virtual void OnBeforeSimulate()
int GetElectricity(bool cost=false)
virtual FlockController.SpawnType FlockType
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
virtual bool CanUnlockExit
int GetDeepestLv(ref int max)
virtual int RespawnPerHour
virtual float RespawnRate
void ApplyBackerPet(bool draw)
bool CanEnterBuildModeAnywhere
Card AddCardSplinkle(Card t, Point center, int radius=4)
override string NameSuffix
virtual string TextWidgetDate
void AddGlobalCharasOnActivate()
void OnSimulateMonth(VirtualDate date)
virtual float ChanceSpawnNeutral
virtual string IDSceneTemplate
virtual bool CanBeDeliverDestination
void ClearZones(Zone current=null)
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
virtual void OnDeactivate()
virtual ActionMode DefaultActionMode
virtual void OnActivate()
Card AddCard(Card t, int x, int z)
void OnSimulateHour(VirtualDate date)
override void _OnBeforeSave()
override void OnAfterCreate()
static List< Thing > Suckers
Card AddThing(string id, Point p)
virtual string IDAmbience
virtual string IDPlaylistOverwrite
Point GetSpawnPos(SpawnPosition type, int tries=100)
bool TryAddThing(Thing target, Point p, bool destroyIfFail=false)
void GrowPlants(VirtualDate date)
Chara FindChara(string id)
virtual bool ShouldMakeExit
virtual bool AllowCriminal
virtual bool AlwaysLowblock
virtual bool AllowNewZone
virtual bool RestrictBuild
virtual void OnGenerateRooms(BaseMapGen gen)
Point GetRandomVisitPos(Chara c)
virtual void OnGenerateMap()
List< Element > ListLandFeats()
static bool forceRegenerate
virtual bool MakeEnemiesNeutral
virtual bool IsUnderwater
virtual void OnCreateBP()
void Export(string path, PartialMap partial=null, bool usermap=false)
virtual bool ShouldRegenerate
virtual float BigDaddyChance
void TryGenerateBigDaddy()
virtual float EvolvedChance
static bool ignoreSpawnAnime
virtual void OnAdvanceHour()
FortuneRollData fortuneRoll
void ModDevelopment(int a)
virtual bool WillAutoSave
virtual bool IsExplorable
void UpdateQuests(bool force=false)
virtual bool KeepAllyDistance
virtual bool HiddenInRegionMap
bool IsCrime(Chara c, Act act)
void RefreshListCitizen()
Zone GetZoneAt(int _x, int _y)
Card AddCard(Card t, Point point)
string TextLevel(int _lv)
virtual ZoneFeatureType FeatureType
virtual float ShrineChance
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
virtual void OnVisitNewMapOrRegenerate()