2using System.Collections.Generic;
52 public Dictionary<int, string>
dictCitizen =
new Dictionary<int, string>();
83 public static List<Thing>
Suckers =
new List<Thing>();
93 base.uidBoss = value?.
uid ?? 0;
143 public virtual string IDPlayList => base.source.idPlaylist.IsEmpty((base.lv != 0) ?
"Underground" :
null);
147 public virtual string IDHat =>
null;
155 if (base.source.idFile.Length != 0)
157 return base.source.idFile[
fileVariation] + ((base.lv == 0) ?
"" : (
"_F" + base.lv));
163 public string pathTemp => GameIO.pathTemp + base.uid +
"/";
281 public virtual int MaxLv => 99999999;
283 public virtual int MinLv => -99999999;
315 public virtual int MaxSpawn => map.bounds.Width * map.bounds.Height / 175 + 2;
361 return base.source.tag.Contains(
"return");
373 return base.lv <
MaxLv;
393 public virtual bool UseFog => base.lv < 0;
405 return base.source.tag.Contains(
"light");
417 public virtual FlockController.SpawnType
FlockType => FlockController.SpawnType.Default;
427 return "conquered".lang();
551 return base.source.id;
565 return " " +
"zoneLevelB".lang((_lv * -1).
ToString() ??
"");
567 return " " +
"zoneLevel".lang((_lv + 1).
ToString() ??
"");
601 EClass.game.config.reverseSnow =
false;
608 EClass.pc.global.transition.uidLastZone = 0;
616 EClass.game.activeZone =
this;
618 Debug.Log(
NameWithLevel +
"/" +
id +
"/" + base.uid +
"/" + base.isGenerated +
"/" +
IsLoaded +
"/" + File.Exists(base.pathSave +
"map"));
619 if (base.isGenerated && !
IsLoaded && !File.Exists(base.pathSave +
"map"))
621 Debug.Log(
"(Bug) File does not exist:" +
destryoed +
"/" + base.pathSave);
622 base.isGenerated =
false;
627 if (flag2 &&
map !=
null)
634 Debug.Log(
"generating random map");
657 Debug.Log(
"zone is already loaded");
671 Debug.Log(base.isGenerated +
"/" + flag3 +
"/" + flag2 +
"/" +
IDSubset);
672 if (!base.isGenerated || flag3 || flag2)
679 IO.DeleteDirectory(
pathTemp +
"Texture Replace");
685 base.isGenerated =
true;
689 zoneExportData.orgMap =
GameIO.LoadFile<
Map>(base.pathSave +
"map");
692 catch (Exception message)
696 base.isGenerated =
true;
701 Debug.Log(
"loading map: imported? " +
isImported +
" regenerate? " + flag3);
705 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");
723 if (zoneExportData.
orgMap !=
null)
727 map.charas = orgMap.
charas;
737 map.
cells[i, j].
isSeen = array[i * EClass._map.Size + j].GetBit(1);
743 Debug.Log(
"Importing New Chara:" +
item.id +
"/" +
item.Name +
"/" +
item.orgPos);
750 foreach (Thing thing in orgMap.things)
752 if (t.id == thing.id && t.pos.Equals(thing.pos))
754 if (t.trait is TraitNewZone)
757 map.things.Insert(0, thing);
758 thing.stackOrder = 0;
762 t.ChangeMaterial(thing.material);
772 foreach (Thing thing2 in orgMap.things)
774 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
777 map.things.Add(thing2);
783 if (t.id ==
"medal" || t.id ==
"856")
785 foreach (Thing thing3 in orgMap.things)
787 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
816 thing4.isSubsetCard =
false;
836 if (isImported && IsTown)
838 RefreshListCitizen();
841 AddGlobalCharasOnActivate();
845 foreach (
Card item3
in map.
Cards.ToList())
855 idCurrentSubset = forceSubset ?? IDSubset;
856 if (idCurrentSubset !=
null)
864 if (MakeTownProperties)
875 thing7.isNPCProperty =
false;
879 if (instance !=
null)
884 if (isImported && !flag3 && !RevealRoom)
894 point2.cell.isSeen =
false;
903 PathManager.Instance._pathfinder.PunishChangeDirection =
false;
907 EClass._map.config.idSceneProfile =
"indoor_water";
910 if (flag && IsTown && base.lv == 0)
914 if (base.visitCount == 0)
922 map.effectManager.GetOrCreate(c.GetSharedPoint());
941 Map.isDirtySunMap =
true;
957 chara.dirtySpeed =
true;
962 if (
card.IsUnique && !
card.IsPCFaction && !
card.IsPCParty)
972 int @
int =
card.GetInt(55);
977 if (chara2.
uid == @
int)
981 chara.enemy = chara2;
983 chara.calmCheckTurn = 20 +
EClass.
rnd(30);
991 if (
card.c_uidMaster != 0 && chara.
master ==
null)
1004 else if (
card.IsInstalled &&
card.trait is
TraitDoor traitDoor &&
card.pos.HasChara && !traitDoor.IsOpen())
1006 traitDoor.ToggleDoor(sound:
false, refresh:
false);
1010 forceRegenerate =
false;
1022 OnVisitNewMapOrRegenerate();
1027 EClass.player.uidLastTown = 0;
1029 else if (IsTown && base.lv == 0)
1031 EClass.player.uidLastTown = base.uid;
1035 RefreshElectricity();
1067 List<Chara> list =
new List<Chara>();
1087 RefreshDeathSentense();
1095 isSimulating =
true;
1097 isSimulating =
false;
1109 if (fieldElements.
dict.Count() > 0)
1129 if (ShouldAutoRevive)
1149 Point point = GetSpawnPos(value);
1166 if (!(
id ==
"startVillage2"))
1172 SetBGM(121, refresh:
false);
1184 Msg.
Say(
"num_silvercat", num.ToString() ??
"");
1216 if (
Boss !=
null && IsNefia)
1222 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1233 chara2.mana.value = 0;
1237 chara2.stamina.value = 0;
1242 chara2.resistCon =
null;
1246 Msg.ignoreAll =
true;
1248 chara2.
HealHP((
int)((
long)Mathf.Max(1, chara2.
MaxHP) * (
long)Mathf.Min(num, 20) / 20));
1249 chara2.
mana.
Mod(Mathf.Max(1, chara2.
mana.
max) * Mathf.Min(num, 20) / 20);
1251 Msg.ignoreAll =
false;
1255 Debug.Log(
"Last Active:" + base.lastActive);
1256 if (base.lastActive == 0 || HourSinceLastActive <= 1 || IsRegion)
1260 Debug.Log(Name +
" Simulate:" + HourSinceLastActive +
" hours");
1263 int num2 = HourSinceLastActive / 24;
1269 if (!
item.IsPCParty)
1271 item.OnSleep(200, num2);
1272 if (
item.conSleep !=
null)
1274 item.conSleep.Kill();
1280 if (
item.things.Count > 20)
1287 VirtualDate.current = virtualDate;
1288 for (
int i = 0; i < HourSinceLastActive; i++)
1300 VirtualDate.current =
null;
1306 foreach (
Chara item2
in list)
1314 if (item2.
id ==
"bee")
1318 if (num2 > 0 && item2.
IsGuest())
1328 item2.
SetAI(goalWork);
1331 (goalWork as
GoalWork).FindWork(item2);
1335 item2.
SetAI(goalWork);
1338 (goalWork as
GoalWork).FindWork(item2);
1348 List<Thing> list2 =
new List<Thing>();
1356 if (num4 >= list2.Count)
1360 for (
int j = num4; j < list2.Count; j++)
1362 if (
EClass.
rnd(200) <= HourSinceLastActive)
1365 AddCard(chara, list2.RandomItem().
pos);
1367 chara.c_originalHostility = c_originalHostility;
1377 bool flag = zone ==
null || zone.lv > base.
lv;
1383 if (GetZoneAt(topZone.
x, topZone.
y) !=
null)
1395 enterState = RegionEnterState;
1401 float rate = zoneTransition?.
ratePos ?? (-1f);
1410 if (nearestPoint !=
null && nearestPoint.
IsValid)
1412 return nearestPoint;
1422 return new Point(zoneTransition.
x, zoneTransition.
z);
1430 if (traitTeleporter !=
null)
1434 if (traitTeleporter !=
null && !zoneTransition.
idTele.IsEmpty() && zoneTransition.
idTele == traitTeleporter.
id.IsEmpty(traitTeleporter.
GetParam(3)))
1448 if (randomThing2 !=
null)
1468 if (randomThing !=
null)
1488 flag = base.lv <= 0;
1514 return new Point(zoneTransition.
x, zoneTransition.
z);
1516 return GetRandomVisitPos(c);
1530 if (thing5.
trait is
TraitNewZone { zone: not null } traitNewZone && zone !=
null && traitNewZone.
zone.
uid == zone.uid)
1532 if (c !=
null && enterState != 0)
1534 c.SetDir(traitNewZone.owner.dir);
1536 return traitNewZone.GetExitPos();
1541 if (thing6.
trait is
TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1543 if (c !=
null && enterState != 0)
1545 c.SetDir(traitNewZone2.owner.dir);
1547 return traitNewZone2.GetExitPos();
1550 return GetRandomVisitPos(c);
1558 point = map.
rooms.
listRoom.RandomItem().points.RandomItem();
1560 if (point ==
null &&
EClass.
rnd(4) != 0)
1577 Point spawnPosPC =
null;
1580 spawnPosPC = GetSpawnPos(
EClass.
pc);
1582 if (spawnPosPC ==
null)
1610 c.isRestrained =
false;
1614 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true) : GetSpawnPos(c)));
1619 pos.
Set(spawnPosPC);
1624 if (!spawnPosPC.ForeachNearestPoint(delegate(
Point p)
1632 }, allowBlock:
false, EClass.pc.party.members.Count >= 12, allowInstalled:
true, ignoreCenter:
true, EClass._zone.IsRegion ? 2 : 6))
1634 pos.
Set(spawnPosPC);
1639 c.global.transition =
null;
1647 Point nearestPoint = spawnPosPC.
GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true);
1649 item.pos.Set(nearestPoint);
1658 if (!IsUserZone && !IsPCFaction && map !=
null)
1660 List<Thing> list =
new List<Thing>();
1672 if (
item.IsContainer)
1690 Msg.
Say(
"pick_valuable");
1691 foreach (
Thing item2
in list)
1693 Msg.
Say(
"pick_valuable2", item2);
1700 base.isPeace =
false;
1702 OnBeforeDeactivate();
1714 EClass.game.activeZone =
null;
1718 base.isGenerated =
false;
1720 if (forceRegenerate)
1749 Debug.Log(
"Unloaded Map:" +
this);
1763 base.dateExpire = 0;
1768 thing.isNPCProperty =
false;
1774 for (
int i = 0; i < 7; i++)
1818 SetMainFaction(
null);
1860 Zone topZone = GetTopZone();
1867 if (!base.isRandomSite && !(
this is
Zone_Field) && (topZone ==
null || topZone ==
this || topZone.
FindDeepestZone() ==
this))
1879 if (zone !=
null && zone.
GetTopZone() ==
this)
1891 Debug.Log(
"Deleting Zone:" +
this);
1897 else if (map !=
null)
1899 Debug.Log(
"Saving Zone:" +
this);
1900 map.
Save(base.pathSave);
1901 if (!base.isMapSaved)
1903 base.isMapSaved =
true;
1904 IO.DeleteDirectory(base.pathSave +
"Texture Replace");
1905 IO.CopyDir(pathTemp +
"Texture Replace", base.pathSave +
"/Texture Replace");
1925 children.ForeachReverse(delegate(
Spatial z)
1933 if (parent !=
null && parent.IsRegion && instance ==
null)
1939 base.isGenerated =
false;
1948 base.isGenerated =
false;
1949 Zone topZone = GetTopZone();
1950 if (topZone !=
this)
1955 children.ForeachReverse(delegate(
Spatial c)
1975 if (parent ==
null || parent.IsRegion)
1979 return parent as
Zone;
1985 for (
int i = 0; i < 1000; i++)
1991 return AddCard(t, point);
1994 return AddCard(t, center);
2004 return AddChara(
id, p.
x, p.
z);
2014 return AddThing(
id, p.
x, p.
z);
2019 return AddCard(t, point.
x, point.
z);
2024 return AddCard(t, 0, 0);
2037 chara.currentZone =
this;
2047 ignoreSpawnAnime =
false;
2052 chara.hasSpawned =
true;
2066 t.Chara.currentZone =
null;
2078 public T GetRandomSpot<T>() where T :
Trait
2083 public bool TryAddThingInSpot<T>(
Thing t,
bool useContainer =
true) where T :
Trait
2086 if (randomThing ==
null)
2093 List<Thing> list =
new List<Thing>();
2096 foreach (
Card item2
in item.ListCards())
2100 list.Add(item2.
Thing);
2104 if (TryAddThingInSharedContainer(t, list, add:
true, msg:
false,
null, sharedOnly:
false))
2113 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func =
null) where T :
TraitSpot
2115 List<T> list =
new List<T>();
2116 List<Thing> list2 =
new List<Thing>();
2121 list.Add(thing.
trait as T);
2124 foreach (T
item in list)
2126 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2134 if (thing2.
things.Count == 0)
2136 if (IsValid(thing2))
2150 bool IsValid(
Thing t)
2152 if (func !=
null && !func(t))
2169 if (containers ==
null)
2173 if (SearchDest() !=
null)
2192 foreach (
Thing container
in containers)
2194 Thing thing = container;
2202 if (windowSaveData !=
null)
2222 foreach (
int cat
in windowSaveData.
cats)
2235 else if (windowSaveData.
flag.HasFlag(flag))
2240 priority = windowSaveData.
priority;
2274 if (num == 0 || !destroyIfFail)
2301 List<T> list =
new List<T>();
2306 list.Add(thing2.
trait as T);
2309 foreach (T
item in list)
2311 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2319 if (thing3.
things.Count == 0)
2321 if (IsValid(thing3, insideContainer:
false))
2336 bool IsValid(
Thing t,
bool insideContainer)
2348 string text = IdProfile;
2354 text = ((base.lv < 0) ?
"Underground" :
"Sky");
2356 else if (region !=
null)
2362 name =
Lang.
GetList(
"zone_" + text.Split(
'/')[1]).RandomItem();
2364 for (
int i = 0; i < 3; i++)
2366 for (
int j = 0; j < 3; j++)
2371 if (text ==
"Random/R_Shore")
2373 base.isBeach =
true;
2390 bp.genSetting.seed = base.Seed;
2400 base.isGenerated =
true;
2411 bool flag = IdBiome ==
"Sand" || IdBiome ==
"Water" || IsUnderwater;
2414 int num = 1 +
EClass.
rnd((IdBiome ==
"Water") ? 3 : 2);
2415 for (
int i = 0; i < num; i++)
2420 Thing t =
ThingGen.
Create(
"pearl_oyster",
new string[3] {
"wood_birch",
"poplar",
"coralwood" }.RandomItem(), ContentLv);
2425 for (
int j = 0; j < num; j++)
2436 if (!randomSurface3.
HasObj)
2444 for (
int l = 0; l < 30 +
EClass.
rnd(30); l++)
2467 foreach (
Point point
in r.points)
2471 map.
SetObj(point.
x, point.
z, num6);
2485 foreach (
Point point2
in r.points)
2497 foreach (
Point point3
in r.points)
2504 if (zone_Field !=
null)
2509 for (
int m = 0; m < num4; m++)
2532 if (base.Tile.isRoad)
2568 for (
int i = 0; i < 3 +
EClass.
rnd(4); i++)
2581 if (r.points.Count <= 4)
2586 List<Point> points = r.points;
2588 "altarPoint".lang(randomReligion.NameDomain.lang());
2593 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2604 if (
item.x % 3 == 0 &&
item.z % 2 == 0 &&
item != points[0] && !
item.Equals(points[0].Front) &&
item.Installed ==
null)
2606 thing = ThingGen.Create(
"pillar1");
2607 EClass._zone.AddCard(thing, item).Install();
2610 item.SetFloor(3, 6);
2618 if (MakeEnemiesNeutral)
2625 chara.hostility = hostility2;
2629 if (PrespawnRate != 0f && !IsSkyLevel)
2631 for (
int i = 0; i < (int)((
float)MaxSpawn * PrespawnRate); i++)
2637 TryGenerateBigDaddy();
2638 TryGenerateEvolved();
2639 TryGenerateShrine();
2644 if (OreChance <= 0f)
2651 string group =
"ore";
2652 if (EClass.rnd(5) == 0)
2658 foreach (
Point point in r.points)
2660 if (point.sourceBlock.ContainsTag(
"ore"))
2662 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2677 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2693 int num = (int)((
long)DangerLv * 125L / 100);
2711 Msg.
Say(
"sign_bigdaddy");
2718 for (
int i = 0; i < 3; i++)
2726 if (randomSpace ==
null)
2758 chara.c_originalHostility = (
Hostility)0;
2775 for (
int i = 0; i < tries; i++)
2815 if (setting ==
null)
2821 pos = GetSpawnPos(setting.position, setting.tries);
2832 if (IsUnderwater &&
EClass.
rnd(15) != 0)
2841 if (s.hostility !=
"")
2845 return s.biome == biome.name || s.biome.IsEmpty();
2848 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
2852 idEle = setting.idEle
2854 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
2857 num2 = ((num - 1) % 50 + 5) * 150 / 100;
2858 if (num2 >= 20 &&
EClass.
rnd(100) < num2)
2869 long num3 = ((setting.fixedLv == -1) ? cardRow.
LV : setting.fixedLv);
2870 bool flag = setting.fixedLv != -1 || DangerLvBoost > 0;
2871 num3 += setting.addLv;
2874 num3 = (50L + (long)cardRow.
LV) * Mathf.Max(1, (num - 1) / 50);
2877 num3 += DangerLvBoost;
2878 if (setting.rarity ==
Rarity.Random && cardRow.
quality == 0)
2882 cardBlueprint.rarity =
Rarity.Legendary;
2883 num3 = num3 * 125 / 100;
2888 cardBlueprint.rarity = setting.rarity;
2892 num3 = num3 * 150 / 100;
2894 if (setting.isEvolved)
2896 num3 = num3 * 2 + 20;
2898 if (num3 != cardRow.
LV)
2900 cardBlueprint.lv = (int)Mathf.Min(num3, 100000000f);
2906 chara.isScaled =
false;
2908 AddCard(chara, pos);
2909 if (setting.forcedHostility.HasValue)
2911 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
2912 chara.c_originalHostility = c_originalHostility;
2943 if (setting.isEvolved)
2945 chara.c_bossType =
BossType.Evolved;
2947 if (DangerLv >= 20 && !IsPCFaction && !IsTown &&
EClass.
rnd(200) == 0)
2956 return fieldElements.
Has(idEle);
2961 fieldElements.
SetBase(idEle, a);
2966 dirtyElectricity =
false;
2967 bool flag = GetSoilCost() > MaxSoil;
2968 base.electricity = elements.
Value(2201) * 10 + BaseElectricity;
2982 base.electricity += 20;
2997 bool flag = GetSoilCost() > MaxSoil;
3019 sum += elements.
Value(2201) * 10 + BaseElectricity;
3034 public void SetBGM(List<int> ids,
bool refresh =
true,
float fadeDuration = 0f)
3039 foreach (
int id in ids)
3047 UnityEngine.Object.DestroyImmediate(map.
plDay);
3054 if (fadeDuration > 0f)
3056 EClass.
Sound.StopBGM(fadeDuration, playLastBGM:
false, delegate
3071 public void SetBGM(
int id = -1,
bool refresh =
true,
float fadeDuration = 0f)
3073 SetBGM(
new List<int> {
id }, refresh, fadeDuration);
3078 if (map.
plDay ==
null)
3080 map.plDay = CreatePlaylist(ref map.
_plDay,
EClass.
Sound.GetPlaylist(IDPlayList));
3087 UnityEngine.Object.DestroyImmediate(map.
plDay);
3099 Playlist playlist = map.
plDay;
3102 if (
item.playlist !=
null)
3104 playlist =
item.playlist;
3107 if (IDPlaylistOverwrite !=
null)
3109 playlist =
EClass.
Sound.GetPlaylist(IDPlaylistOverwrite);
3114 if (room !=
null && room.
lot !=
null && room.
lot.
idBGM != 0)
3117 if (playlist.list[0].data?.id != room.
lot.
idBGM)
3134 Playlist playlist =
EClass.
Sound.plBlank.Instantiate();
3135 if (list.Count == 0 && (
bool)mold)
3137 list = mold.ToInts();
3138 playlist.shuffle = mold.shuffle;
3139 playlist.minSwitchTime = mold.minSwitchTime;
3140 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
3141 playlist.ignoreLoop = mold.ignoreLoop;
3142 playlist.keepBGMifSamePlaylist = mold.keepBGMifSamePlaylist;
3143 playlist.name = mold.name;
3145 foreach (
int item in list)
3147 playlist.list.Add(
new Playlist.Item
3149 data = EClass.core.refs.dictBGM.TryGetValue(item, 1)
3168 return GetDeepestLv(ref max);
3173 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
3177 foreach (
Spatial child
in children)
3179 (child as
Zone).GetDeepestLv(ref max);
3186 if (landFeats ==
null)
3188 landFeats =
new List<int>();
3190 string[] listBase = IDBaseLandFeat.Split(
',');
3191 string[] array = listBase;
3192 foreach (
string text
in array)
3194 if (!text.IsEmpty())
3199 if (listBase.Length == 1)
3203 if (e.category !=
"landfeat" || e.chance == 0)
3208 string[] tag = e.tag;
3209 foreach (
string text2 in tag)
3211 if (text2.StartsWith(
"bf"))
3214 if (listBase[0] == text2)
3221 return flag ? true :
false;
3224 landFeats.Add(row.
id);
3227 landFeats.Add(row.
id);
3231 List<Element> list2 =
new List<Element>();
3232 foreach (
int landFeat
in landFeats)
3241 ZipFile zipFile = ZipFile.Read(path);
3242 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3243 zipFile.ExtractAll(pathTemp);
3262 IO.CreateTempDirectory();
3267 map.
Save(IO.TempPath +
"/", zoneExportData, partial);
3268 map.
ExportMetaData(IO.TempPath +
"/", Path.GetFileNameWithoutExtension(path), partial);
3269 if (partial ==
null)
3271 IO.CopyDir(base.pathSave +
"Texture Replace", IO.TempPath +
"/Texture Replace");
3273 IO.SaveFile(IO.TempPath +
"/export", zoneExportData, compress:
true);
3274 using (ZipFile zipFile =
new ZipFile())
3276 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3277 zipFile.AddDirectory(IO.TempPath);
3281 IO.DeleteTempDirectory();
3283 catch (Exception ex)
3285 EClass.
ui.Say(ex.Message +
":" + path);
3294 if (!
string.IsNullOrEmpty(text))
3307 if (array.Length != 0)
3309 Zone_User zone_User = SpatialGen.Create(
"user", EClass.world.region, register: true) as Zone_User;
3310 zone_User.path = array[0];
3311 Thing thing = ThingGen.Create(
"teleporter");
3312 thing.c_uidZone = zone_User.uid;
3313 EClass._zone.AddCard(thing, EClass.pc.pos);
3324 catch (Exception ex)
3334 string text = pathExport;
3337 Msg.
Say(
"Exported Map:" + text);
3352 return -10000000 + base.uid;
3356 return -8000000 + base.uid;
3360 return -9000000 + base.uid;
3364 return -7000000 + base.uid;
3368 return 1000000 + base.uid;
3388 AddCard(chara, point);
3389 Msg.
Say(
"guestArrive", chara);
3396 AddCard(chara, point);
3404 if (base.IsPlayerFaction)
3424 foreach (
Thing sucker
in Suckers)
3429 if (RespawnRate != 0f)
3439 if (num < MaxRespawn)
3441 for (
int i = 0; i < RespawnPerHour; i++)
3447 if (!date.IsRealTime &&
EClass.
rnd(24) == 0)
3459 if (base.IsPlayerFaction)
3467 if (base.IsPlayerFaction)
3506 HashSet<int> hashSet =
new HashSet<int>();
3513 foreach (
Point item in traitSpotFarm.ListPoints(
null, onlyPassable:
false))
3515 hashSet.Add(
item.index);
3519 EClass.player.isAutoFarming =
false;
3526 void Perform(HashSet<int> farmMap)
3531 if (farmMap !=
null)
3535 if (!farmMap.Contains(c.index))
3540 else if (farmMap.Contains(c.
index))
3554 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3559 if (!flag && (plantData ==
null || plantData.fert >= 0))
3565 if (date.sunMap == null)
3575 else if (c.
detail !=
null)
3577 c.Things.ForeachReverse(delegate(Thing t)
3579 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3581 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3594 c.isWatered =
false;
3603 foreach (
Spatial child
in children)
3605 if (!(child is
Zone_Field) && _x == child.
x && _y == child.
y)
3607 return child as
Zone;
3611 foreach (
Spatial child2
in children)
3613 if (_x == child2.
x && _y == child2.
y)
3615 return child2 as
Zone;
3632 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3638 chara.hostility = hostility;
3653 dictCitizen.Clear();
3656 if (
item.trait.IsCitizen && !
item.IsGlobal && !
item.isSubsetCard)
3665 base.isAlarmSet = enable;
3691 base.influence += a;
3694 Msg.
Say(
"gainInfluence", Name, a.ToString() ??
"");
3701 base.development += a;
3704 Msg.
Say(
"gainDevelopment", Name, a.ToString() ??
"");
3710 if (!IsPCFaction && (!(
this is
Zone_Town) || base.lv != 0))
3714 Debug.Log(
"Updating Quest:" + force);
3721 if (
item.quest.IsExpired || completedQuests.Contains(
item.quest.uid) || force)
3739 maxQuest = 4 + EClass.rnd(4);
3741 completedQuests.Clear();
3743 List<Tuple<string, int>> listTag =
new List<Tuple<string, int>>();
3747 array =
new string[9] {
"supply/8",
"deliver/7",
"food/8",
"escort/4",
"deliver/4",
"monster/0",
"war/0",
"farm/0",
"music/0" };
3749 string[] array2 = array;
3750 for (
int i = 0; i < array2.Length; i++)
3752 string[] array3 = array2[i].Split(
'/');
3753 listTag.Add(
new Tuple<string, int>(array3[0], array3[1].ToInt()));
3755 for (
int j = 0; j < map.charas.Count * 2; j++)
3773 foreach (Tuple<string, int> item2
in listTag)
3775 if (a.tags.Contains(item2.Item1))
3785 return a.chance * num2;
3797 List<Chara> list =
new List<Chara>();
3833 for (
int i = 0; i < 2 +
EClass.
rnd(4); i++)
3835 Point point = GetPos();
3843 thing.isLostProperty =
true;
3845 int num2 = (thing.c_lockLv =
EClass.
rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3862 static Point GetPos()
3864 for (
int j = 0; j < 10; j++)
3878 bool flag =
this is
Zone_Yowyn && base.lv == -1;
3885 if (EClass.player.doneBackers.Contains(a.id))
3903 if (chara.
id !=
"follower")
3914 if (
item.chara == chara.
id)
3926 if (fortuneRoll ==
null)
3931 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
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
bool HasElement(int ele, bool includeNagative=false)
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
Condition AddCondition(string id, int p=100, bool force=false)
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(long _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)
Dictionary< int, Element > dict
Element SetBase(string alias, int v, int potential=0)
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)
List< Chara > listCarryoverMap
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 GetRandomPointInRadius(int minRadius, int maxRadius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=2000)
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, bool assignQuest=true)
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 HomeGuest(int lv)
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
void RefreshDeathSentense()
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)
ElementContainerField fieldElements
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 int SightRadiusBonus
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
Chara SpawnMob(string id, Point pos=null)
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 SetFieldEffect(int idEle, int a)
void RefreshListCitizen()
Zone GetZoneAt(int _x, int _y)
Card AddCard(Card t, Point point)
string TextLevel(int _lv)
Chara AddChara(string id, Point p)
virtual ZoneFeatureType FeatureType
virtual float ShrineChance
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)
virtual void OnVisitNewMapOrRegenerate()
bool IsBelow(int _major, int _minor, int _batch)