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 +
"/";
276 public virtual int MaxLv => 99999999;
278 public virtual int MinLv => -99999999;
310 public virtual int MaxSpawn => map.bounds.Width * map.bounds.Height / 175 + 2;
356 return base.source.tag.Contains(
"return");
368 return base.lv <
MaxLv;
388 public virtual bool UseFog => base.lv < 0;
400 return base.source.tag.Contains(
"light");
412 public virtual FlockController.SpawnType
FlockType => FlockController.SpawnType.Default;
422 return "conquered".lang();
546 return base.source.id;
560 return " " +
"zoneLevelB".lang((_lv * -1).
ToString() ??
"");
562 return " " +
"zoneLevel".lang((_lv + 1).
ToString() ??
"");
596 EClass.game.config.reverseSnow =
false;
603 EClass.pc.global.transition.uidLastZone = 0;
611 EClass.game.activeZone =
this;
613 Debug.Log(
NameWithLevel +
"/" +
id +
"/" + base.uid +
"/" + base.isGenerated +
"/" +
IsLoaded +
"/" + File.Exists(base.pathSave +
"map"));
614 if (base.isGenerated && !
IsLoaded && !File.Exists(base.pathSave +
"map"))
616 Debug.Log(
"(Bug) File does not exist:" +
destryoed +
"/" + base.pathSave);
617 base.isGenerated =
false;
622 if (flag2 &&
map !=
null)
629 Debug.Log(
"generating random map");
652 Debug.Log(
"zone is already loaded");
666 Debug.Log(base.isGenerated +
"/" + flag3 +
"/" + flag2 +
"/" +
IDSubset);
667 if (!base.isGenerated || flag3 || flag2)
674 IO.DeleteDirectory(
pathTemp +
"Texture Replace");
680 base.isGenerated =
true;
684 zoneExportData.orgMap =
GameIO.LoadFile<
Map>(base.pathSave +
"map");
687 catch (Exception message)
691 base.isGenerated =
true;
696 Debug.Log(
"loading map: imported? " +
isImported +
" regenerate? " + flag3);
700 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");
718 if (zoneExportData.
orgMap !=
null)
722 map.charas = orgMap.
charas;
732 map.
cells[i, j].
isSeen = array[i * EClass._map.Size + j].GetBit(1);
738 Debug.Log(
"Importing New Chara:" +
item.id +
"/" +
item.Name +
"/" +
item.orgPos);
745 foreach (Thing thing in orgMap.things)
747 if (t.id == thing.id && t.pos.Equals(thing.pos))
749 if (t.trait is TraitNewZone)
752 map.things.Insert(0, thing);
753 thing.stackOrder = 0;
757 t.ChangeMaterial(thing.material);
767 foreach (Thing thing2 in orgMap.things)
769 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
772 map.things.Add(thing2);
778 if (t.id ==
"medal" || t.id ==
"856")
780 foreach (Thing thing3 in orgMap.things)
782 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
811 thing4.isSubsetCard =
false;
831 if (isImported && IsTown)
833 RefreshListCitizen();
836 AddGlobalCharasOnActivate();
840 foreach (
Card item3
in map.
Cards.ToList())
850 idCurrentSubset = forceSubset ?? IDSubset;
851 if (idCurrentSubset !=
null)
859 if (MakeTownProperties)
870 thing7.isNPCProperty =
false;
874 if (instance !=
null)
879 if (isImported && !flag3 && !RevealRoom)
889 point2.cell.isSeen =
false;
898 PathManager.Instance._pathfinder.PunishChangeDirection =
false;
902 EClass._map.config.idSceneProfile =
"indoor_water";
905 if (flag && IsTown && base.lv == 0)
909 if (base.visitCount == 0)
917 map.effectManager.GetOrCreate(c.GetSharedPoint());
936 Map.isDirtySunMap =
true;
952 chara.dirtySpeed =
true;
957 if (
card.IsUnique && !
card.IsPCFaction && !
card.IsPCParty)
967 int @
int =
card.GetInt(55);
972 if (chara2.
uid == @
int)
976 chara.enemy = chara2;
978 chara.calmCheckTurn = 20 +
EClass.
rnd(30);
986 if (
card.c_uidMaster != 0 && chara.
master ==
null)
999 else if (
card.IsInstalled &&
card.trait is
TraitDoor traitDoor &&
card.pos.HasChara && !traitDoor.IsOpen())
1001 traitDoor.ToggleDoor(sound:
false, refresh:
false);
1005 forceRegenerate =
false;
1017 OnVisitNewMapOrRegenerate();
1022 EClass.player.uidLastTown = 0;
1024 else if (IsTown && base.lv == 0)
1026 EClass.player.uidLastTown = base.uid;
1030 RefreshElectricity();
1062 List<Chara> list =
new List<Chara>();
1086 isSimulating =
true;
1088 isSimulating =
false;
1105 if (ShouldAutoRevive)
1125 Point point = GetSpawnPos(value);
1172 if (
Boss !=
null && IsNefia)
1178 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1189 chara2.mana.value = 0;
1193 chara2.stamina.value = 0;
1198 chara2.resistCon =
null;
1202 Msg.ignoreAll =
true;
1204 chara2.
HealHP(Mathf.Max(1, chara2.
MaxHP) * Mathf.Min(num, 20) / 20);
1205 chara2.
mana.
Mod(Mathf.Max(1, chara2.
mana.
max) * Mathf.Min(num, 20) / 20);
1207 Msg.ignoreAll =
false;
1211 Debug.Log(
"Last Active:" + base.lastActive);
1212 if (base.lastActive == 0 || HourSinceLastActive <= 1 || IsRegion)
1216 Debug.Log(Name +
" Simulate:" + HourSinceLastActive +
" hours");
1219 int num2 = HourSinceLastActive / 24;
1225 if (!
item.IsPCParty)
1227 item.OnSleep(200, num2);
1228 if (
item.conSleep !=
null)
1230 item.conSleep.Kill();
1236 if (
item.things.Count > 20)
1243 VirtualDate.current = virtualDate;
1244 for (
int i = 0; i < HourSinceLastActive; i++)
1256 VirtualDate.current =
null;
1262 foreach (
Chara item2
in list)
1270 if (item2.
id ==
"bee")
1274 if (num2 > 0 && item2.
IsGuest())
1284 item2.
SetAI(goalWork);
1287 (goalWork as
GoalWork).FindWork(item2);
1291 item2.
SetAI(goalWork);
1294 (goalWork as
GoalWork).FindWork(item2);
1304 List<Thing> list2 =
new List<Thing>();
1312 if (num4 >= list2.Count)
1316 for (
int j = num4; j < list2.Count; j++)
1318 if (
EClass.
rnd(200) <= HourSinceLastActive)
1321 AddCard(chara, list2.RandomItem().
pos);
1323 chara.c_originalHostility = c_originalHostility;
1333 bool flag = zone ==
null || zone.lv > base.
lv;
1339 if (GetZoneAt(topZone.
x, topZone.
y) !=
null)
1351 enterState = RegionEnterState;
1357 float rate = zoneTransition?.
ratePos ?? (-1f);
1366 if (nearestPoint !=
null && nearestPoint.
IsValid)
1368 return nearestPoint;
1378 return new Point(zoneTransition.
x, zoneTransition.
z);
1386 if (traitTeleporter !=
null)
1390 if (traitTeleporter !=
null && !zoneTransition.
idTele.IsEmpty() && zoneTransition.
idTele == traitTeleporter.
id.IsEmpty(traitTeleporter.
GetParam(3)))
1404 if (randomThing2 !=
null)
1424 if (randomThing !=
null)
1444 flag = base.lv <= 0;
1470 return new Point(zoneTransition.
x, zoneTransition.
z);
1472 return GetRandomVisitPos(c);
1486 if (thing5.
trait is
TraitNewZone { zone: not null } traitNewZone && zone !=
null && traitNewZone.
zone.
uid == zone.uid)
1488 if (c !=
null && enterState != 0)
1490 c.SetDir(traitNewZone.owner.dir);
1492 return traitNewZone.GetExitPos();
1497 if (thing6.
trait is
TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1499 if (c !=
null && enterState != 0)
1501 c.SetDir(traitNewZone2.owner.dir);
1503 return traitNewZone2.GetExitPos();
1506 return GetRandomVisitPos(c);
1514 point = map.
rooms.
listRoom.RandomItem().points.RandomItem();
1516 if (point ==
null &&
EClass.
rnd(4) != 0)
1533 Point spawnPosPC =
null;
1536 spawnPosPC = GetSpawnPos(
EClass.
pc);
1538 if (spawnPosPC ==
null)
1566 c.isRestrained =
false;
1570 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true) : GetSpawnPos(c)));
1575 pos.
Set(spawnPosPC);
1580 if (!spawnPosPC.ForeachNearestPoint(delegate(
Point p)
1588 }, allowBlock:
false, EClass.pc.party.members.Count >= 12, allowInstalled:
true, ignoreCenter:
true, EClass._zone.IsRegion ? 2 : 6))
1590 pos.
Set(spawnPosPC);
1595 c.global.transition =
null;
1603 Point nearestPoint = spawnPosPC.
GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true);
1605 item.pos.Set(nearestPoint);
1614 if (!IsUserZone && !IsPCFaction && map !=
null)
1616 List<Thing> list =
new List<Thing>();
1628 if (
item.IsContainer)
1646 Msg.
Say(
"pick_valuable");
1647 foreach (
Thing item2
in list)
1649 Msg.
Say(
"pick_valuable2", item2);
1654 base.isPeace =
false;
1655 OnBeforeDeactivate();
1667 EClass.game.activeZone =
null;
1671 base.isGenerated =
false;
1673 if (forceRegenerate)
1702 Debug.Log(
"Unloaded Map:" +
this);
1716 base.dateExpire = 0;
1721 thing.isNPCProperty =
false;
1727 for (
int i = 0; i < 7; i++)
1771 SetMainFaction(
null);
1807 Zone topZone = GetTopZone();
1814 if (!base.isRandomSite && !(
this is
Zone_Field) && (topZone ==
null || topZone ==
this || topZone.
FindDeepestZone() ==
this))
1826 if (zone !=
null && zone.
GetTopZone() ==
this)
1838 Debug.Log(
"Deleting Zone:" +
this);
1844 else if (map !=
null)
1846 Debug.Log(
"Saving Zone:" +
this);
1847 map.
Save(base.pathSave);
1848 if (!base.isMapSaved)
1850 base.isMapSaved =
true;
1851 IO.DeleteDirectory(base.pathSave +
"Texture Replace");
1852 IO.CopyDir(pathTemp +
"Texture Replace", base.pathSave +
"/Texture Replace");
1872 children.ForeachReverse(delegate(
Spatial z)
1880 if (parent !=
null && parent.IsRegion && instance ==
null)
1886 base.isGenerated =
false;
1895 base.isGenerated =
false;
1896 Zone topZone = GetTopZone();
1897 if (topZone !=
this)
1902 children.ForeachReverse(delegate(
Spatial c)
1922 if (parent ==
null || parent.IsRegion)
1926 return parent as
Zone;
1932 for (
int i = 0; i < 1000; i++)
1938 return AddCard(t, point);
1941 return AddCard(t, center);
1956 return AddThing(
id, p.
x, p.
z);
1961 return AddCard(t, point.
x, point.
z);
1966 return AddCard(t, 0, 0);
1979 chara.currentZone =
this;
1989 ignoreSpawnAnime =
false;
1994 chara.hasSpawned =
true;
2008 t.Chara.currentZone =
null;
2020 public T GetRandomSpot<T>() where T :
Trait
2025 public bool TryAddThingInSpot<T>(
Thing t,
bool useContainer =
true) where T :
Trait
2028 if (randomThing ==
null)
2035 List<Thing> list =
new List<Thing>();
2038 foreach (
Card item2
in item.ListCards())
2042 list.Add(item2.
Thing);
2046 if (TryAddThingInSharedContainer(t, list, add:
true, msg:
false,
null, sharedOnly:
false))
2055 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func =
null) where T :
TraitSpot
2057 List<T> list =
new List<T>();
2058 List<Thing> list2 =
new List<Thing>();
2063 list.Add(thing.
trait as T);
2066 foreach (T
item in list)
2068 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2076 if (thing2.
things.Count == 0)
2078 if (IsValid(thing2))
2092 bool IsValid(
Thing t)
2094 if (func !=
null && !func(t))
2111 if (containers ==
null)
2115 if (SearchDest() !=
null)
2134 foreach (
Thing container
in containers)
2136 Thing thing = container;
2144 if (windowSaveData !=
null)
2164 foreach (
int cat
in windowSaveData.
cats)
2177 else if (windowSaveData.
flag.HasFlag(flag))
2182 priority = windowSaveData.
priority;
2216 if (num == 0 || !destroyIfFail)
2243 List<T> list =
new List<T>();
2248 list.Add(thing2.
trait as T);
2251 foreach (T
item in list)
2253 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2261 if (thing3.
things.Count == 0)
2263 if (IsValid(thing3, insideContainer:
false))
2278 bool IsValid(
Thing t,
bool insideContainer)
2290 string text = IdProfile;
2296 text = ((base.lv < 0) ?
"Underground" :
"Sky");
2298 else if (region !=
null)
2304 name =
Lang.
GetList(
"zone_" + text.Split(
'/')[1]).RandomItem();
2306 for (
int i = 0; i < 3; i++)
2308 for (
int j = 0; j < 3; j++)
2313 if (text ==
"Random/R_Shore")
2315 base.isBeach =
true;
2332 bp.genSetting.seed = base.Seed;
2342 base.isGenerated =
true;
2353 if (IdBiome ==
"Sand" || IdBiome ==
"Water" || IsUnderwater)
2355 int num = 1 +
EClass.
rnd((IdBiome ==
"Water") ? 3 : 2);
2356 for (
int i = 0; i < num; i++)
2361 Thing t =
ThingGen.
Create(
"pearl_oyster",
new string[3] {
"wood_birch",
"poplar",
"coralwood" }.RandomItem(), ContentLv);
2366 for (
int j = 0; j < num; j++)
2377 for (
int k = 0; k < 30 +
EClass.
rnd(30); k++)
2400 foreach (
Point point
in r.points)
2404 map.
SetObj(point.
x, point.
z, num6);
2418 foreach (
Point point2
in r.points)
2430 foreach (
Point point3
in r.points)
2437 if (zone_Field !=
null)
2442 for (
int l = 0; l < num4; l++)
2486 for (
int i = 0; i < 3 +
EClass.
rnd(4); i++)
2499 if (r.points.Count <= 4)
2504 List<Point> points = r.points;
2506 "altarPoint".lang(randomReligion.NameDomain.lang());
2511 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2516 if (points[0].Installed ==
null)
2522 if (
item.x % 3 == 0 &&
item.z % 2 == 0 &&
item != points[0] && !
item.Equals(points[0].Front) &&
item.Installed ==
null)
2524 thing = ThingGen.Create(
"pillar1");
2525 EClass._zone.AddCard(thing, item).Install();
2528 item.SetFloor(3, 6);
2536 if (MakeEnemiesNeutral)
2543 chara.hostility = hostility2;
2547 if (PrespawnRate != 0f && !IsSkyLevel)
2549 for (
int i = 0; i < (int)((
float)MaxSpawn * PrespawnRate); i++)
2555 TryGenerateBigDaddy();
2556 TryGenerateEvolved();
2557 TryGenerateShrine();
2562 if (OreChance <= 0f)
2569 string group =
"ore";
2570 if (EClass.rnd(5) == 0)
2576 foreach (
Point point in r.points)
2578 if (point.sourceBlock.ContainsTag(
"ore"))
2580 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2595 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2611 int num = DangerLv * 125 / 100;
2629 Msg.
Say(
"sign_bigdaddy");
2636 for (
int i = 0; i < 3; i++)
2644 if (randomSpace ==
null)
2676 chara.c_originalHostility = (
Hostility)0;
2693 for (
int i = 0; i < tries; i++)
2725 if (setting ==
null)
2731 pos = GetSpawnPos(setting.position, setting.tries);
2742 if (IsUnderwater &&
EClass.
rnd(15) != 0)
2751 if (s.hostility !=
"")
2755 return s.biome == biome.name || s.biome.IsEmpty();
2758 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
2762 idEle = setting.idEle
2764 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
2767 num2 = ((num - 1) % 50 + 5) * 150 / 100;
2768 if (num2 >= 20 &&
EClass.
rnd(100) < num2)
2779 long num3 = ((setting.fixedLv == -1) ? cardRow.
LV : setting.fixedLv);
2782 num3 = (50L + (long)cardRow.
LV) * Mathf.Max(1, (num - 1) / 50);
2784 num3 += DangerLvBoost;
2785 if (setting.rarity ==
Rarity.Random && cardRow.
quality == 0)
2789 cardBlueprint.rarity =
Rarity.Legendary;
2790 num3 = num3 * 125 / 100;
2795 cardBlueprint.rarity = setting.rarity;
2799 num3 = num3 * 150 / 100;
2801 if (setting.isEvolved)
2803 num3 = num3 * 2 + 20;
2805 if (num3 != cardRow.
LV)
2807 cardBlueprint.lv = (int)Mathf.Min(num3, 100000000f);
2811 AddCard(chara, pos);
2812 if (setting.forcedHostility.HasValue)
2814 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
2815 chara.c_originalHostility = c_originalHostility;
2840 if (setting.isEvolved)
2842 chara.c_bossType =
BossType.Evolved;
2849 dirtyElectricity =
false;
2850 bool flag = GetSoilCost() > MaxSoil;
2851 base.electricity = elements.
Value(2201) * 10 + BaseElectricity;
2865 base.electricity += 20;
2880 bool flag = GetSoilCost() > MaxSoil;
2902 sum += elements.
Value(2201) * 10 + BaseElectricity;
2917 public void SetBGM(List<int> ids,
bool refresh =
true,
float fadeDuration = 0f)
2922 foreach (
int id in ids)
2930 UnityEngine.Object.DestroyImmediate(map.
plDay);
2937 if (fadeDuration > 0f)
2939 EClass.
Sound.StopBGM(fadeDuration, playLastBGM:
false, delegate
2954 public void SetBGM(
int id = -1,
bool refresh =
true,
float fadeDuration = 0f)
2956 SetBGM(
new List<int> {
id }, refresh, fadeDuration);
2961 if (map.
plDay ==
null)
2963 map.plDay = CreatePlaylist(ref map.
_plDay,
EClass.
Sound.GetPlaylist(IDPlayList));
2970 UnityEngine.Object.DestroyImmediate(map.
plDay);
2982 Playlist playlist = map.
plDay;
2985 if (
item.playlist !=
null)
2987 playlist =
item.playlist;
2990 if (IDPlaylistOverwrite !=
null)
2992 playlist =
EClass.
Sound.GetPlaylist(IDPlaylistOverwrite);
2997 if (room !=
null && room.
lot !=
null && room.
lot.
idBGM != 0)
3000 if (playlist.list[0].data?.id != room.
lot.
idBGM)
3017 Playlist playlist =
EClass.
Sound.plBlank.Instantiate();
3018 if (list.Count == 0 && (
bool)mold)
3020 list = mold.ToInts();
3021 playlist.shuffle = mold.shuffle;
3022 playlist.minSwitchTime = mold.minSwitchTime;
3023 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
3024 playlist.ignoreLoop = mold.ignoreLoop;
3025 playlist.keepBGMifSamePlaylist = mold.keepBGMifSamePlaylist;
3026 playlist.name = mold.name;
3028 foreach (
int item in list)
3030 playlist.list.Add(
new Playlist.Item
3032 data = EClass.core.refs.dictBGM.TryGetValue(item, 1)
3051 return GetDeepestLv(ref max);
3056 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
3060 foreach (
Spatial child
in children)
3062 (child as
Zone).GetDeepestLv(ref max);
3069 if (landFeats ==
null)
3071 landFeats =
new List<int>();
3073 string[] listBase = IDBaseLandFeat.Split(
',');
3074 string[] array = listBase;
3075 foreach (
string text
in array)
3077 if (!text.IsEmpty())
3082 if (listBase.Length == 1)
3086 if (e.category !=
"landfeat" || e.chance == 0)
3091 string[] tag = e.tag;
3092 foreach (
string text2 in tag)
3094 if (text2.StartsWith(
"bf"))
3097 if (listBase[0] == text2)
3104 return flag ? true :
false;
3107 landFeats.Add(row.
id);
3110 landFeats.Add(row.
id);
3114 List<Element> list2 =
new List<Element>();
3115 foreach (
int landFeat
in landFeats)
3124 ZipFile zipFile = ZipFile.Read(path);
3125 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3126 zipFile.ExtractAll(pathTemp);
3145 IO.CreateTempDirectory();
3150 map.
Save(IO.TempPath +
"/", zoneExportData, partial);
3151 map.
ExportMetaData(IO.TempPath +
"/", Path.GetFileNameWithoutExtension(path), partial);
3152 if (partial ==
null)
3154 IO.CopyDir(base.pathSave +
"Texture Replace", IO.TempPath +
"/Texture Replace");
3156 IO.SaveFile(IO.TempPath +
"/export", zoneExportData, compress:
true);
3157 using (ZipFile zipFile =
new ZipFile())
3159 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3160 zipFile.AddDirectory(IO.TempPath);
3164 IO.DeleteTempDirectory();
3166 catch (Exception ex)
3168 EClass.
ui.Say(ex.Message +
":" + path);
3177 if (!
string.IsNullOrEmpty(text))
3190 if (array.Length != 0)
3192 Zone_User zone_User = SpatialGen.Create(
"user", EClass.world.region, register: true) as Zone_User;
3193 zone_User.path = array[0];
3194 Thing thing = ThingGen.Create(
"teleporter");
3195 thing.c_uidZone = zone_User.uid;
3196 EClass._zone.AddCard(thing, EClass.pc.pos);
3207 catch (Exception ex)
3217 string text = pathExport;
3220 Msg.
Say(
"Exported Map:" + text);
3235 return -10000000 + base.uid;
3239 return -8000000 + base.uid;
3243 return -9000000 + base.uid;
3247 return -7000000 + base.uid;
3251 return 1000000 + base.uid;
3271 AddCard(chara, point);
3272 Msg.
Say(
"guestArrive", chara);
3279 AddCard(chara, point);
3287 if (base.IsPlayerFaction)
3307 foreach (
Thing sucker
in Suckers)
3312 if (RespawnRate != 0f)
3322 if (num < MaxRespawn)
3324 for (
int i = 0; i < RespawnPerHour; i++)
3330 if (!date.IsRealTime &&
EClass.
rnd(24) == 0)
3342 if (base.IsPlayerFaction)
3350 if (base.IsPlayerFaction)
3389 HashSet<int> hashSet =
new HashSet<int>();
3396 foreach (
Point item in traitSpotFarm.ListPoints(
null, onlyPassable:
false))
3398 hashSet.Add(
item.index);
3402 EClass.player.isAutoFarming =
false;
3409 void Perform(HashSet<int> farmMap)
3414 if (farmMap !=
null)
3418 if (!farmMap.Contains(c.index))
3423 else if (farmMap.Contains(c.
index))
3437 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3442 if (!flag && (plantData ==
null || plantData.fert >= 0))
3448 if (date.sunMap == null)
3458 else if (c.
detail !=
null)
3460 c.Things.ForeachReverse(delegate(Thing t)
3462 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3464 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3477 c.isWatered =
false;
3486 foreach (
Spatial child
in children)
3488 if (!(child is
Zone_Field) && _x == child.
x && _y == child.
y)
3490 return child as
Zone;
3494 foreach (
Spatial child2
in children)
3496 if (_x == child2.
x && _y == child2.
y)
3498 return child2 as
Zone;
3515 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3521 chara.hostility = hostility;
3536 dictCitizen.Clear();
3539 if (
item.trait.IsCitizen && !
item.IsGlobal && !
item.isSubsetCard)
3548 base.isAlarmSet = enable;
3574 base.influence += a;
3577 Msg.
Say(
"gainInfluence", Name, a.ToString() ??
"");
3584 base.development += a;
3587 Msg.
Say(
"gainDevelopment", Name, a.ToString() ??
"");
3593 if (!IsPCFaction && (!(
this is
Zone_Town) || base.lv != 0))
3597 Debug.Log(
"Updating Quest:" + force);
3604 if (
item.quest.IsExpired || completedQuests.Contains(
item.quest.uid) || force)
3622 maxQuest = 4 + EClass.rnd(4);
3624 completedQuests.Clear();
3626 List<Tuple<string, int>> listTag =
new List<Tuple<string, int>>();
3630 array =
new string[9] {
"supply/8",
"deliver/7",
"food/8",
"escort/4",
"deliver/4",
"monster/0",
"war/0",
"farm/0",
"music/0" };
3632 string[] array2 = array;
3633 for (
int i = 0; i < array2.Length; i++)
3635 string[] array3 = array2[i].Split(
'/');
3636 listTag.Add(
new Tuple<string, int>(array3[0], array3[1].ToInt()));
3638 for (
int j = 0; j < map.charas.Count * 2; j++)
3656 foreach (Tuple<string, int> item2
in listTag)
3658 if (a.tags.Contains(item2.Item1))
3668 return a.chance * num2;
3680 List<Chara> list =
new List<Chara>();
3716 for (
int i = 0; i < 2 +
EClass.
rnd(4); i++)
3718 Point point = GetPos();
3726 thing.isLostProperty =
true;
3728 int num2 = (thing.c_lockLv =
EClass.
rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3745 static Point GetPos()
3747 for (
int j = 0; j < 10; j++)
3761 bool flag =
this is
Zone_Yowyn && base.lv == -1;
3768 if (EClass.player.doneBackers.Contains(a.id))
3786 if (chara.
id !=
"follower")
3797 if (
item.chara == chara.
id)
3809 if (fortuneRoll ==
null)
3814 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=null)
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
bool HasElement(int ele, int req=1)
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)
Chara SetHostility(Hostility h)
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 void LevelSeed(Thing t, SourceObj.Row obj, int num)
static Thing MakeSeed(string id, PlantData plant=null)
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)
virtual string GetNewZoneID(int level)
void OnChildNumChange(Card c)
virtual bool CanDigUnderground
virtual int BaseElectricity
virtual string IDPlayList
Dictionary< int, string > dictCitizen
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 bool SetAlarmOnBreakLaw
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)
void SetBGM(List< int > ids, bool refresh=true, float fadeDuration=0f)
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)
void SetBGM(int id=-1, bool refresh=true, float fadeDuration=0f)
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 SetAlarm(bool enable)
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()