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 +
"/";
306 public virtual int MaxSpawn => map.bounds.Width * map.bounds.Height / 175 + 2;
352 return base.source.tag.Contains(
"return");
364 return base.lv <
MaxLv;
384 public virtual bool UseFog => base.lv < 0;
396 return base.source.tag.Contains(
"light");
408 public virtual FlockController.SpawnType
FlockType => FlockController.SpawnType.Default;
418 return "conquered".lang();
535 return base.source.id;
549 return " " +
"zoneLevelB".lang((_lv * -1).
ToString() ??
"");
551 return " " +
"zoneLevel".lang((_lv + 1).
ToString() ??
"");
585 EClass.game.config.reverseSnow =
false;
592 EClass.pc.global.transition.uidLastZone = 0;
600 EClass.game.activeZone =
this;
602 Debug.Log(
NameWithLevel +
"/" +
id +
"/" + base.uid +
"/" + base.isGenerated +
"/" +
IsLoaded +
"/" + File.Exists(base.pathSave +
"map"));
603 if (base.isGenerated && !
IsLoaded && !File.Exists(base.pathSave +
"map"))
605 Debug.Log(
"(Bug) File does not exist:" +
destryoed +
"/" + base.pathSave);
606 base.isGenerated =
false;
611 if (flag2 &&
map !=
null)
618 Debug.Log(
"generating random map");
641 Debug.Log(
"zone is already loaded");
655 Debug.Log(base.isGenerated +
"/" + flag3 +
"/" + flag2 +
"/" +
IDSubset);
656 if (!base.isGenerated || flag3 || flag2)
663 IO.DeleteDirectory(
pathTemp +
"Texture Replace");
667 base.isGenerated =
true;
671 zoneExportData.orgMap =
GameIO.LoadFile<
Map>(base.pathSave +
"map");
675 Debug.Log(
"loading map: imported? " +
isImported +
" regenerate? " + flag3);
679 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");
697 if (zoneExportData.
orgMap !=
null)
701 map.charas = orgMap.
charas;
711 map.
cells[i, j].
isSeen = array[i * EClass._map.Size + j].GetBit(1);
717 Debug.Log(
"Importing New Chara:" +
item.id +
"/" +
item.Name +
"/" +
item.orgPos);
724 foreach (Thing thing in orgMap.things)
726 if (t.id == thing.id && t.pos.Equals(thing.pos))
729 map.things.Insert(0, thing);
730 thing.stackOrder = 0;
738 foreach (Thing thing2 in orgMap.things)
740 if (thing2.trait is TraitNewZone && t.pos.Equals(thing2.pos))
743 map.things.Add(thing2);
749 if (t.id ==
"medal" || t.id ==
"856")
751 foreach (Thing thing3 in orgMap.things)
753 if (t.id == thing3.id && t.pos.Equals(thing3.pos))
782 thing4.isSubsetCard =
false;
802 if (isImported && IsTown)
804 RefreshListCitizen();
807 AddGlobalCharasOnActivate();
811 foreach (
Card item3
in map.
Cards.ToList())
821 idCurrentSubset = forceSubset ?? IDSubset;
822 if (idCurrentSubset !=
null)
830 if (MakeTownProperties)
841 thing7.isNPCProperty =
false;
845 if (instance !=
null)
850 if (isImported && !flag3 && !RevealRoom)
860 point2.cell.isSeen =
false;
869 PathManager.Instance._pathfinder.PunishChangeDirection =
false;
871 if (flag && IsTown && base.lv == 0)
875 if (base.visitCount == 0)
883 map.effectManager.GetOrCreate(c.GetSharedPoint());
902 Map.isDirtySunMap =
true;
922 if (
card.IsUnique && !
card.IsPCFaction && !
card.IsPCParty)
932 int @
int =
card.GetInt(55);
937 if (chara2.
uid == @
int)
941 chara.enemy = chara2;
943 chara.calmCheckTurn = 20 +
EClass.
rnd(30);
951 if (
card.c_uidMaster != 0 && chara.
master ==
null)
964 else if (
card.IsInstalled &&
card.trait is
TraitDoor traitDoor &&
card.pos.HasChara && !traitDoor.IsOpen())
966 traitDoor.ToggleDoor(sound:
false, refresh:
false);
970 forceRegenerate =
false;
982 OnVisitNewMapOrRegenerate();
987 EClass.player.uidLastTown = 0;
989 else if (IsTown && base.lv == 0)
991 EClass.player.uidLastTown = base.uid;
995 RefreshElectricity();
1025 EClass.player.stats.deepest = DangerLv;
1046 isSimulating =
true;
1048 isSimulating =
false;
1065 if (ShouldAutoRevive)
1085 Point point = GetSpawnPos(value);
1132 if (
Boss !=
null && IsNefia)
1138 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1149 chara2.mana.value = 0;
1153 chara2.stamina.value = 0;
1158 chara2.resistCon =
null;
1162 Msg.ignoreAll =
true;
1164 chara2.
HealHP(Mathf.Max(1, chara2.
MaxHP) * Mathf.Min(num, 20) / 20);
1165 chara2.
mana.
Mod(Mathf.Max(1, chara2.
mana.
max) * Mathf.Min(num, 20) / 20);
1167 Msg.ignoreAll =
false;
1171 if (HourSinceLastActive <= 1)
1175 Debug.Log(Name +
" Simulate:" + HourSinceLastActive +
" hours");
1178 int num2 = HourSinceLastActive / 24;
1183 if (!
item.IsPCParty)
1185 item.OnSleep(200, num2);
1186 if (
item.conSleep !=
null)
1188 item.conSleep.Kill();
1194 if (
item.things.Count > 20)
1205 VirtualDate.current = virtualDate;
1206 for (
int i = 0; i < HourSinceLastActive; i++)
1210 VirtualDate.current =
null;
1216 foreach (
Chara item2
in list)
1224 if (item2.
id ==
"bee")
1228 if (num2 > 0 && item2.
IsGuest())
1238 item2.
SetAI(goalWork);
1241 (goalWork as
GoalWork).FindWork(item2);
1245 item2.
SetAI(goalWork);
1248 (goalWork as
GoalWork).FindWork(item2);
1258 List<Thing> list2 =
new List<Thing>();
1266 if (num3 >= list2.Count)
1270 for (
int j = num3; j < list2.Count; j++)
1272 if (
EClass.
rnd(200) <= HourSinceLastActive)
1275 AddCard(chara, list2.RandomItem().
pos);
1277 chara.c_originalHostility = c_originalHostility;
1287 bool flag = zone ==
null || zone.lv > base.
lv;
1293 if (GetZoneAt(topZone.
x, topZone.
y) !=
null)
1305 enterState = RegionEnterState;
1311 float rate = zoneTransition?.
ratePos ?? (-1f);
1320 if (nearestPoint !=
null && nearestPoint.
IsValid)
1322 return nearestPoint;
1332 return new Point(zoneTransition.
x, zoneTransition.
z);
1340 if (traitTeleporter !=
null)
1344 if (traitTeleporter !=
null && !zoneTransition.
idTele.IsEmpty() && zoneTransition.
idTele == traitTeleporter.
id.IsEmpty(traitTeleporter.
GetParam(3)))
1358 if (randomThing2 !=
null)
1378 if (randomThing !=
null)
1398 flag = base.lv <= 0;
1424 return new Point(zoneTransition.
x, zoneTransition.
z);
1426 return GetRandomVisitPos(c);
1440 if (thing5.
trait is
TraitNewZone { zone: not null } traitNewZone && zone !=
null && traitNewZone.
zone.
uid == zone.uid)
1442 if (c !=
null && enterState != 0)
1444 c.SetDir(traitNewZone.owner.dir);
1446 return traitNewZone.GetExitPos();
1451 if (thing6.
trait is
TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1453 if (c !=
null && enterState != 0)
1455 c.SetDir(traitNewZone2.owner.dir);
1457 return traitNewZone2.GetExitPos();
1460 return GetRandomVisitPos(c);
1468 point = map.
rooms.
listRoom.RandomItem().points.RandomItem();
1470 if (point ==
null &&
EClass.
rnd(4) != 0)
1487 Point spawnPosPC =
null;
1490 spawnPosPC = GetSpawnPos(
EClass.
pc);
1492 if (spawnPosPC ==
null)
1520 c.isRestrained =
false;
1524 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true) : GetSpawnPos(c)));
1529 pos.
Set(spawnPosPC);
1534 if (!spawnPosPC.ForeachNearestPoint(delegate(
Point p)
1542 }, allowBlock:
false, EClass.pc.party.members.Count >= 12, allowInstalled:
true, ignoreCenter:
true, EClass._zone.IsRegion ? 2 : 6))
1544 pos.
Set(spawnPosPC);
1549 c.global.transition =
null;
1557 Point nearestPoint = spawnPosPC.
GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true);
1559 item.pos.Set(nearestPoint);
1568 if (!IsUserZone && !IsPCFaction && map !=
null)
1570 List<Thing> list =
new List<Thing>();
1582 if (
item.IsContainer)
1600 Msg.
Say(
"pick_valuable");
1601 foreach (
Thing item2
in list)
1603 Msg.
Say(
"pick_valuable2", item2);
1608 base.isPeace =
false;
1609 OnBeforeDeactivate();
1621 EClass.game.activeZone =
null;
1625 base.isGenerated =
false;
1627 if (forceRegenerate)
1656 Debug.Log(
"Unloaded Map:" +
this);
1670 base.dateExpire = 0;
1675 thing.isNPCProperty =
false;
1681 for (
int i = 0; i < 7; i++)
1722 SetMainFaction(
null);
1741 Zone topZone = GetTopZone();
1748 if (!base.isRandomSite && !(
this is
Zone_Field) && (topZone ==
null || topZone ==
this || topZone.
FindDeepestZone() ==
this))
1760 if (zone !=
null && zone.
GetTopZone() ==
this)
1772 Debug.Log(
"Deleting Zone:" +
this);
1778 else if (map !=
null)
1780 Debug.Log(
"Saving Zone:" +
this);
1781 map.
Save(base.pathSave);
1782 if (!base.isMapSaved)
1784 base.isMapSaved =
true;
1785 IO.DeleteDirectory(base.pathSave +
"Texture Replace");
1786 IO.CopyDir(pathTemp +
"Texture Replace", base.pathSave +
"/Texture Replace");
1806 children.ForeachReverse(delegate(
Spatial z)
1814 if (parent !=
null && parent.IsRegion && instance ==
null)
1820 base.isGenerated =
false;
1829 base.isGenerated =
false;
1830 Zone topZone = GetTopZone();
1831 if (topZone !=
this)
1836 children.ForeachReverse(delegate(
Spatial c)
1856 if (parent ==
null || parent.IsRegion)
1860 return parent as
Zone;
1866 for (
int i = 0; i < 1000; i++)
1872 return AddCard(t, point);
1875 return AddCard(t, center);
1890 return AddThing(
id, p.
x, p.
z);
1895 return AddCard(t, point.
x, point.
z);
1900 return AddCard(t, 0, 0);
1913 chara.currentZone =
this;
1923 ignoreSpawnAnime =
false;
1928 chara.hasSpawned =
true;
1942 t.Chara.currentZone =
null;
1954 public T GetRandomSpot<T>() where T :
Trait
1959 public bool TryAddThingInSpot<T>(
Thing t,
bool useContainer =
true) where T :
Trait
1962 if (randomThing ==
null)
1969 List<Thing> list =
new List<Thing>();
1972 foreach (
Card item2
in item.ListCards())
1976 list.Add(item2.
Thing);
1980 if (TryAddThingInSharedContainer(t, list, add:
true, msg:
false,
null, sharedOnly:
false))
1989 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func =
null) where T :
TraitSpot
1991 List<T> list =
new List<T>();
1992 List<Thing> list2 =
new List<Thing>();
1997 list.Add(thing.
trait as T);
2000 foreach (T
item in list)
2002 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2010 if (thing2.
things.Count == 0)
2012 if (IsValid(thing2))
2026 bool IsValid(
Thing t)
2028 if (func !=
null && !func(t))
2045 if (containers ==
null)
2049 if (SearchDest() !=
null)
2068 foreach (
Thing container
in containers)
2070 Thing thing = container;
2078 if (windowSaveData !=
null)
2098 foreach (
int cat
in windowSaveData.
cats)
2111 else if (windowSaveData.
flag.HasFlag(flag))
2116 priority = windowSaveData.
priority;
2150 if (num == 0 || !destroyIfFail)
2177 List<T> list =
new List<T>();
2182 list.Add(thing2.
trait as T);
2185 foreach (T
item in list)
2187 foreach (
Point item2
in item.ListPoints(
null, onlyPassable:
false))
2195 if (thing3.
things.Count == 0)
2197 if (IsValid(thing3, insideContainer:
false))
2212 bool IsValid(
Thing t,
bool insideContainer)
2224 string text = IdProfile;
2230 text = ((base.lv < 0) ?
"Underground" :
"Sky");
2232 else if (region !=
null)
2238 name =
Lang.
GetList(
"zone_" + text.Split(
'/')[1]).RandomItem();
2240 for (
int i = 0; i < 3; i++)
2242 for (
int j = 0; j < 3; j++)
2247 if (text ==
"Random/R_Shore")
2249 base.isBeach =
true;
2266 bp.genSetting.seed = base.Seed;
2276 base.isGenerated =
true;
2291 for (
int i = 0; i < num; i++)
2294 if (!randomSurface.
HasObj)
2301 if (zone_Field.IdBiome ==
"Sand" || zone_Field.IdBiome ==
"Water")
2303 int num2 = 1 +
EClass.
rnd((zone_Field.IdBiome ==
"water") ? 4 : 2);
2304 for (
int j = 0; j < num2; j++)
2307 if (!randomSurface2.
HasObj)
2309 Thing t2 =
ThingGen.
Create(
"pearl_oyster",
new string[3] {
"wood_birch",
"poplar",
"coralwood" }.RandomItem());
2314 for (
int k = 0; k < num2; k++)
2357 for (
int i = 0; i < 3 +
EClass.
rnd(4); i++)
2370 if (r.points.Count <= 4)
2375 List<Point> points = r.points;
2377 "altarPoint".lang(randomReligion.NameDomain.lang());
2382 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2387 if (points[0].Installed ==
null)
2393 if (
item.x % 3 == 0 &&
item.z % 2 == 0 &&
item != points[0] && !
item.Equals(points[0].Front) &&
item.Installed ==
null)
2395 thing = ThingGen.Create(
"pillar1");
2396 EClass._zone.AddCard(thing, item).Install();
2399 item.SetFloor(3, 6);
2407 if (MakeEnemiesNeutral)
2414 chara.hostility = hostility2;
2418 if (PrespawnRate != 0f && !IsSkyLevel)
2420 for (
int i = 0; i < (int)((
float)MaxSpawn * PrespawnRate); i++)
2426 TryGenerateBigDaddy();
2427 TryGenerateEvolved();
2428 TryGenerateShrine();
2433 if (OreChance <= 0f)
2440 string group =
"ore";
2441 if (EClass.rnd(5) == 0)
2447 foreach (
Point point in r.points)
2449 if (point.sourceBlock.ContainsTag(
"ore"))
2451 map.SetObj(point.x, point.z, randomMaterial.id, b, 1, 0);
2460 if (!force && EvolvedChance <=
EClass.
rndf(1f))
2465 for (
int i = 0; i < 2 +
EClass.
rnd(2); i++)
2481 int num = DangerLv * 125 / 100;
2491 Msg.
Say(
"sign_bigdaddy");
2497 for (
int i = 0; i < 3; i++)
2505 if (randomSpace ==
null)
2537 chara.c_originalHostility = (
Hostility)0;
2554 for (
int i = 0; i < tries; i++)
2567 if (setting ==
null)
2573 pos = GetSpawnPos(setting.position, setting.tries);
2589 if (s.hostility !=
"")
2593 return s.biome == biome.name || s.biome.IsEmpty();
2596 int dangerLv = DangerLv;
2600 idEle = setting.idEle
2602 int num = ((setting.filterLv == -1) ? dangerLv : setting.filterLv);
2603 if (ScaleMonsterLevel)
2605 num = ((dangerLv - 1) % 50 + 5) * 150 / 100;
2608 int num2 = ((setting.fixedLv == -1) ? cardRow.
LV : setting.fixedLv);
2609 if (ScaleMonsterLevel)
2611 num2 = (50 + cardRow.
LV) * Mathf.Max(1, (dangerLv - 1) / 50);
2613 if (setting.rarity ==
Rarity.Random)
2617 cardBlueprint.rarity =
Rarity.Legendary;
2618 num2 = num2 * 125 / 100;
2623 cardBlueprint.rarity = setting.rarity;
2627 num2 = num2 * 150 / 100;
2629 if (setting.isEvolved)
2631 num2 = num2 * 2 + 20;
2633 if (num2 != cardRow.
LV)
2635 cardBlueprint.lv = num2;
2639 AddCard(chara, pos);
2640 if (setting.forcedHostility.HasValue)
2642 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
2643 chara.c_originalHostility = c_originalHostility;
2649 if (setting.isEvolved)
2651 chara.c_bossType =
BossType.Evolved;
2658 dirtyElectricity =
false;
2659 bool flag = GetSoilCost() > MaxSoil;
2660 base.electricity = elements.
Value(2201) * 10 + BaseElectricity;
2674 base.electricity += 20;
2689 bool flag = GetSoilCost() > MaxSoil;
2711 sum += elements.
Value(2201) * 10 + BaseElectricity;
2726 public void SetBGM(List<int> ids,
bool refresh =
true)
2731 foreach (
int id in ids)
2739 UnityEngine.Object.DestroyImmediate(map.
plDay);
2749 public void SetBGM(
int id = -1,
bool refresh =
true)
2751 SetBGM(
new List<int> {
id }, refresh);
2756 if (map.
plDay ==
null)
2758 map.plDay = CreatePlaylist(ref map.
_plDay,
EClass.
Sound.GetPlaylist(IDPlayList));
2769 Playlist playlist = map.
plDay;
2772 if (
item.playlist !=
null)
2774 playlist =
item.playlist;
2777 if (IDPlaylistOverwrite !=
null)
2779 playlist =
EClass.
Sound.GetPlaylist(IDPlaylistOverwrite);
2784 if (room !=
null && room.
lot !=
null && room.
lot.
idBGM != 0)
2787 if (playlist.list[0].data?.id != room.
lot.
idBGM)
2804 Playlist playlist =
EClass.
Sound.plBlank.Instantiate();
2805 if (list.Count == 0 && (
bool)mold)
2807 list = mold.ToInts();
2808 playlist.shuffle = mold.shuffle;
2809 playlist.minSwitchTime = mold.minSwitchTime;
2810 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
2811 playlist.ignoreLoop = mold.ignoreLoop;
2812 playlist.keepBGMifSamePlaylist = mold.keepBGMifSamePlaylist;
2813 playlist.name = mold.name;
2815 foreach (
int item in list)
2817 playlist.list.Add(
new Playlist.Item
2819 data = EClass.core.refs.dictBGM[item]
2838 return GetDeepestLv(ref max);
2843 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
2847 foreach (
Spatial child
in children)
2849 (child as
Zone).GetDeepestLv(ref max);
2856 if (landFeats ==
null)
2858 landFeats =
new List<int>();
2860 string[] listBase = IDBaseLandFeat.Split(
',');
2861 string[] array = listBase;
2862 foreach (
string text
in array)
2864 if (!text.IsEmpty())
2869 if (listBase.Length == 1)
2873 if (e.category !=
"landfeat" || e.chance == 0)
2878 string[] tag = e.tag;
2879 foreach (
string text2 in tag)
2881 if (text2.StartsWith(
"bf"))
2884 if (listBase[0] == text2)
2891 return flag ? true :
false;
2894 landFeats.Add(row.
id);
2897 landFeats.Add(row.
id);
2901 List<Element> list2 =
new List<Element>();
2902 foreach (
int landFeat
in landFeats)
2911 ZipFile zipFile = ZipFile.Read(path);
2912 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
2913 zipFile.ExtractAll(pathTemp);
2932 IO.CreateTempDirectory();
2937 map.
Save(IO.TempPath +
"/", zoneExportData, partial);
2938 map.
ExportMetaData(IO.TempPath +
"/", Path.GetFileNameWithoutExtension(path), partial);
2939 if (partial ==
null)
2941 IO.CopyDir(base.pathSave +
"Texture Replace", IO.TempPath +
"/Texture Replace");
2943 IO.SaveFile(IO.TempPath +
"/export", zoneExportData, compress:
true);
2944 using (ZipFile zipFile =
new ZipFile())
2946 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
2947 zipFile.AddDirectory(IO.TempPath);
2951 IO.DeleteTempDirectory();
2953 catch (Exception ex)
2955 EClass.
ui.Say(ex.Message +
":" + path);
2964 if (!
string.IsNullOrEmpty(text))
2977 if (array.Length != 0)
2979 Zone_User zone_User = SpatialGen.Create(
"user", EClass.world.region, register: true) as Zone_User;
2980 zone_User.path = array[0];
2981 Thing thing = ThingGen.Create(
"teleporter");
2982 thing.c_uidZone = zone_User.uid;
2983 EClass._zone.AddCard(thing, EClass.pc.pos);
2994 catch (Exception ex)
3004 string text = pathExport;
3007 Msg.
Say(
"Exported Map:" + text);
3022 return -100000 + base.uid;
3026 return -90000 + base.uid;
3046 AddCard(chara, point);
3047 Msg.
Say(
"guestArrive", chara);
3054 AddCard(chara, point);
3062 if (base.IsPlayerFaction)
3082 foreach (
Thing sucker
in Suckers)
3087 if (RespawnRate != 0f)
3097 if (num < MaxRespawn)
3099 for (
int i = 0; i < RespawnPerHour; i++)
3105 if (!date.IsRealTime &&
EClass.
rnd(24) == 0)
3117 if (base.IsPlayerFaction)
3125 if (base.IsPlayerFaction)
3164 HashSet<int> hashSet =
new HashSet<int>();
3171 foreach (
Point item in traitSpotFarm.ListPoints(
null, onlyPassable:
false))
3173 hashSet.Add(
item.index);
3177 EClass.player.isAutoFarming =
false;
3184 void Perform(HashSet<int> farmMap)
3189 if (farmMap !=
null)
3193 if (!farmMap.Contains(c.index))
3198 else if (farmMap.Contains(c.
index))
3212 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3217 if (!flag && (plantData ==
null || plantData.fert >= 0))
3223 if (date.sunMap == null)
3233 else if (c.
detail !=
null)
3235 c.Things.ForeachReverse(delegate(Thing t)
3237 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3239 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3252 c.isWatered =
false;
3261 foreach (
Spatial child
in children)
3263 if (!(child is
Zone_Field) && _x == child.
x && _y == child.
y)
3265 return child as
Zone;
3269 foreach (
Spatial child2
in children)
3271 if (_x == child2.
x && _y == child2.
y)
3273 return child2 as
Zone;
3290 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3296 chara.hostility = hostility;
3311 dictCitizen.Clear();
3314 if (
item.trait.IsCitizen && !
item.IsGlobal && !
item.isSubsetCard)
3323 base.influence += a;
3326 Msg.
Say(
"gainInfluence", Name, a.ToString() ??
"");
3333 base.development += a;
3336 Msg.
Say(
"gainDevelopment", Name, a.ToString() ??
"");
3342 if (!IsPCFaction && (!(
this is
Zone_Town) || base.lv != 0))
3346 Debug.Log(
"Updating Quest:" + force);
3353 if (
item.quest.IsExpired || completedQuests.Contains(
item.quest.uid) || force)
3371 maxQuest = 4 + EClass.rnd(4);
3373 completedQuests.Clear();
3375 List<Tuple<string, int>> listTag =
new List<Tuple<string, int>>();
3379 array =
new string[9] {
"supply/8",
"deliver/7",
"food/8",
"escort/4",
"deliver/4",
"monster/0",
"war/0",
"farm/0",
"music/0" };
3381 string[] array2 = array;
3382 for (
int i = 0; i < array2.Length; i++)
3384 string[] array3 = array2[i].Split(
'/');
3385 listTag.Add(
new Tuple<string, int>(array3[0], array3[1].ToInt()));
3387 for (
int j = 0; j < map.charas.Count * 2; j++)
3405 foreach (Tuple<string, int> item2
in listTag)
3407 if (a.tags.Contains(item2.Item1))
3417 return a.chance * num2;
3429 List<Chara> list =
new List<Chara>();
3465 for (
int i = 0; i < 2 +
EClass.
rnd(4); i++)
3467 Point point = GetPos();
3475 thing.isLostProperty =
true;
3477 int num2 = (thing.c_lockLv =
EClass.
rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
3494 static Point GetPos()
3496 for (
int j = 0; j < 10; j++)
3510 bool flag =
this is
Zone_Yowyn && base.lv == -1;
3517 if (EClass.player.doneBackers.Contains(a.id))
3535 if (chara.
id !=
"follower")
3540 if ((flag && chara.
race.id !=
"cat") ||
EClass.
rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0)
3546 if (
item.chara == chara.
id)
3558 if (fortuneRoll ==
null)
3563 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
void WaitForEndOfFrame(Action action)
string GetRandomCharaId()
void Populate(Point point, bool interior=false)
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 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
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
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 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)
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)
bool Equals(int _x, int _z)
Point Clamp(bool useBounds=false)
Thing FindThing(Func< Thing, bool > func)
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
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)
void RemoveActorEx(Card c)
Dictionary< string, CardRow > map
SourceZoneAffix zoneAffixes
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 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)
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
Card AddChara(string id, int x, int z)
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 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)
Card AddThing(string id, int x, int z)
void ClaimZone(bool debug=false)
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 void OnCreateBP()
virtual bool ScaleMonsterLevel
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()