Elin Decompiled Documentation EA 23.357 Nightly
Loading...
Searching...
No Matches
Zone.cs File Reference

Go to the source code of this file.

Classes

class  Zone
 
class  Zone.PortalReturnData
 

Functions

 [instance initializer]
 

Variables

$ Can tloadmap
 

Function Documentation

◆ [instance initializer]()

RefreshHat.[instance initializer]

Variable Documentation

◆ tloadmap

$ Can tloadmap

Definition at line 1137 of file Zone.cs.

1138{
1139 if (idHat != null && EClass.world.date.IsExpired(base.dateHat))
1140 {
1141 idHat = null;
1142 base.dateHat = 0;
1143 }
1144 sourceHat = ((idHat != null) ? EClass.sources.cards.map[idHat] : ((IDHat != null) ? EClass.sources.cards.map[IDHat] : null));
1145 }
1146
1147 public void OnVisit()
1148 {
1149 if (EClass.world.date.IsExpired(base.dateRevive))
1150 {
1151 ResetHostility();
1152 Revive();
1153 List<Chara> list = new List<Chara>();
1154 foreach (Chara chara in EClass._map.charas)
1155 {
1156 chara.TryRestock(onCreate: false);
1157 if (!chara.IsPCFaction)
1158 {
1159 chara.c_fur = 0;
1160 }
1161 if (chara.IsMinion && chara.master != null && !chara.master.IsPCParty)
1162 {
1163 list.Add(chara);
1164 }
1165 }
1166 foreach (Chara item in list)
1167 {
1168 item.Destroy();
1169 }
1170 }
1171 if (!EClass.game.isLoading)
1172 {
1173 RefreshDeathSentense();
1174 }
1175 RefreshCriminal();
1177 events.OnVisit();
1178 OnActivate();
1179 UpdateQuests();
1180 OnBeforeSimulate();
1181 isSimulating = true;
1182 try
1183 {
1184 Simulate();
1185 }
1186 catch (Exception exception)
1187 {
1188 Debug.LogException(exception);
1189 }
1190 finally
1191 {
1192 isSimulating = false;
1193 }
1194 OnAfterSimulate();
1196 base.lastActive = EClass.world.date.GetRaw();
1197 if (!EClass.game.isLoading)
1198 {
1199 base.visitCount++;
1200 }
1201 base.version = EClass.core.version.GetInt();
1202 if (HasField(10000))
1203 {
1204 Tutorial.Reserve("field");
1205 }
1206 }
1207
1208 public void RefreshDeathSentense()
1209 {
1210 foreach (Chara chara in EClass._map.charas)
1211 {
1212 if (chara.HasCondition<ConDeathSentense>())
1213 {
1214 chara.GetCondition<ConDeathSentense>().TryRemove();
1215 }
1216 }
1217 }
1218
1219 public void Revive()
1220 {
1221 base.dateRevive = EClass.world.date.GetRaw() + 1440 * EClass.setting.balance.dateRevive;
1222 if (ShouldAutoRevive)
1223 {
1224 foreach (Chara deadChara in map.deadCharas)
1225 {
1226 if (deadChara.trait.CanAutoRevive && deadChara.CanRevive())
1227 {
1228 deadChara.Revive();
1230 {
1231 deadChara.RemoveBacker();
1232 }
1233 EClass._zone.AddCard(deadChara, (deadChara.orgPos != null && deadChara.orgPos.IsInBounds) ? deadChara.orgPos : deadChara.pos);
1234 }
1235 }
1236 }
1237 foreach (Chara value in EClass.game.cards.globalCharas.Values)
1238 {
1239 if (value.isDead && value.CanRevive() && value.homeZone == this)
1240 {
1241 value.Revive();
1242 Point point = GetSpawnPos(value);
1243 if (value.orgPos != null && value.orgPos.IsInBounds)
1244 {
1245 point = value.orgPos.GetNearestPoint() ?? point;
1246 }
1247 EClass._zone.AddCard(value, point);
1248 }
1249 }
1250 map.deadCharas.Clear();
1251 }
1252
1253 public virtual void OnRegenerate()
1254 {
1255 }
1256
1257 public virtual void OnActivate()
1258 {
1259 if (!(id == "startVillage2"))
1260 {
1261 return;
1262 }
1263 if (EClass._map.version.IsBelow(0, 23, 226))
1264 {
1265 SetBGM(121, refresh: false);
1266 }
1267 int num = 0;
1268 foreach (Chara chara in EClass._map.charas)
1269 {
1270 if (chara.id == "cat_silver" && !chara.IsPCFaction)
1271 {
1272 num++;
1273 }
1274 }
1275 if (num > 0)
1276 {
1277 Msg.Say("num_silvercat", num.ToString() ?? "");
1278 }
1279 }
1280
1281 public virtual void OnBeforeDeactivate()
1282 {
1283 }
1284
1285 public virtual void OnDeactivate()
1286 {
1287 }
1288
1289 public virtual void OnBeforeSimulate()
1290 {
1291 }
1292
1293 public virtual void OnVisitNewMapOrRegenerate()
1294 {
1295 }
1296
1297 public virtual void OnAfterSimulate()
1298 {
1299 }
1300
1301 public virtual void OnAdvanceHour()
1302 {
1303 }
1304
1305 public void Simulate()
1306 {
1307 if (!EClass.game.isLoading && base.visitCount > 0)
1308 {
1309 if (Boss != null && IsNefia)
1310 {
1311 Msg.Say("bossLeave", Boss.Name.ToTitleCase(), EClass._zone.Name);
1314 }
1315 int num = Mathf.Clamp(MinsSinceLastActive, 1, 10000);
1316 foreach (Chara chara2 in EClass._map.charas)
1317 {
1318 if (chara2.hp < 0)
1319 {
1320 chara2.hp = 0;
1321 }
1322 if (!chara2.IsPCParty)
1323 {
1324 if (chara2.mana.value < 0)
1325 {
1326 chara2.mana.value = 0;
1327 }
1328 if (chara2.stamina.value < 0)
1329 {
1330 chara2.stamina.value = 0;
1331 }
1332 }
1333 if (num > 60)
1334 {
1335 chara2.resistCon = null;
1336 }
1337 if (chara2.rarity >= Rarity.Legendary && !chara2.IsPCFaction && num > 0)
1338 {
1339 Msg.ignoreAll = true;
1340 chara2.Cure(CureType.Boss, 20 + num * 10);
1341 chara2.HealHP((int)((long)Mathf.Max(1, chara2.MaxHP) * (long)Mathf.Min(num, 20) / 20));
1342 chara2.mana.Mod(Mathf.Max(1, chara2.mana.max) * Mathf.Min(num, 20) / 20);
1343 chara2.stamina.Mod(Mathf.Max(1, chara2.stamina.max) * Mathf.Min(num, 20) / 20);
1344 Msg.ignoreAll = false;
1345 }
1346 }
1347 }
1348 Debug.Log("Last Active:" + base.lastActive);
1349 if (base.lastActive == 0 || IsRegion)
1350 {
1351 return;
1352 }
1353 if (pendingSimHours < 0)
1354 {
1355 pendingSimHours = 0;
1356 }
1357 int num2 = GetInt(3);
1358 if (num2 == 0)
1359 {
1361 }
1362 int maxSleepSimHours = EClass.core.config.test.maxSleepSimHours;
1363 int hourSinceLastActive = HourSinceLastActive;
1364 if (hourSinceLastActive <= 1 && pendingSimHours == 0)
1365 {
1366 return;
1367 }
1368 int num3 = hourSinceLastActive + pendingSimHours;
1369 int num4 = ((num2 > 0 && num3 > num2) ? (num3 - num2) : 0);
1370 num3 -= num4;
1371 int num5 = ((EClass.player.simulatingZone && num3 > maxSleepSimHours) ? maxSleepSimHours : num3);
1372 pendingSimHours = num3 - num5;
1373 Debug.Log($"{Name} Simulate/{num5}/{pendingSimHours}/skipped {num4}");
1374 try
1375 {
1376 VirtualDate virtualDate = new VirtualDate(num3);
1377 List<Chara> list = EClass._map.charas.ToList();
1378 int passed = num5 + num4;
1379 int num6 = passed / 24;
1380 if (num6 > 0)
1381 {
1382 foreach (Chara item in list)
1383 {
1384 if (!item.IsPCParty)
1385 {
1386 item.OnSleep(200, num6);
1387 if (item.conSleep != null)
1388 {
1389 item.conSleep.Kill();
1390 }
1391 if (EClass.rnd(EClass.world.date.IsNight ? 20 : 200) == 0 && !item.IsPCFaction && !item.IsGuest())
1392 {
1393 item.AddCondition<ConSleep>(1000 + EClass.rnd(1000), force: true);
1394 }
1395 if (item.things.Count > 20)
1396 {
1397 item.ClearInventory(ClearInventoryType.Purge);
1398 }
1399 }
1400 }
1401 }
1402 VirtualDate.current = virtualDate;
1403 int num7 = 0;
1404 for (int i = 0; i < num5; i++)
1405 {
1406 try
1407 {
1408 virtualDate.SimulateHour();
1409 }
1410 catch (Exception exception)
1411 {
1412 if (num7++ == 0)
1413 {
1414 Debug.LogException(exception);
1415 }
1416 }
1417 }
1418 EClass._map.things.ForeachReverse(delegate(Thing t)
1419 {
1420 t.DecayNatural(passed);
1421 });
1422 VirtualDate.current = null;
1423 if (!IsPCFaction)
1424 {
1425 return;
1426 }
1427 int num8 = 0;
1428 foreach (Chara item2 in list)
1429 {
1430 if (item2.IsPCParty)
1431 {
1432 continue;
1433 }
1434 if (!item2.IsHomeMember())
1435 {
1436 if (item2.id == "bee")
1437 {
1438 num8++;
1439 }
1440 if (num6 > 0 && item2.IsGuest())
1441 {
1442 item2.ChooseNewGoal();
1443 item2.ai.SimulateZone(num6);
1444 item2.ai.OnSimulatePosition();
1445 }
1446 continue;
1447 }
1448 if (num6 > 0)
1449 {
1450 Goal goalWork = item2.GetGoalWork();
1451 item2.SetAI(goalWork);
1452 if (goalWork is GoalWork)
1453 {
1454 (goalWork as GoalWork).FindWork(item2);
1455 }
1456 item2.ai.SimulateZone(num6);
1457 goalWork = item2.GetGoalHobby();
1458 item2.SetAI(goalWork);
1459 if (goalWork is GoalWork)
1460 {
1461 (goalWork as GoalWork).FindWork(item2);
1462 }
1463 item2.ai.SimulateZone(num6);
1464 }
1465 item2.ChooseNewGoal();
1466 if (item2.conSuspend == null)
1467 {
1468 item2.ai.OnSimulatePosition();
1469 }
1470 }
1471 List<Thing> list2 = new List<Thing>();
1472 foreach (Thing thing in map.things)
1473 {
1474 if (thing.IsInstalled && thing.trait is TraitBeekeep)
1475 {
1476 list2.Add(thing);
1477 }
1478 }
1479 if (num8 >= list2.Count)
1480 {
1481 return;
1482 }
1483 for (int num9 = num8; num9 < list2.Count; num9++)
1484 {
1485 if (EClass.rnd(200) <= passed)
1486 {
1487 Chara chara = CharaGen.Create("bee");
1488 AddCard(chara, list2.RandomItem().pos);
1489 Hostility c_originalHostility = (chara.hostility = Hostility.Neutral);
1490 chara.c_originalHostility = c_originalHostility;
1491 }
1492 }
1493 }
1494 finally
1495 {
1496 VirtualDate.current = null;
1497 }
1498 }
1499
1500 public Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState = ZoneTransition.EnterState.Auto)
1501 {
1502 ZoneTransition zoneTransition = c.global?.transition;
1503 Zone zone = zoneTransition?.lastZone;
1504 ZoneTransition.EnterState enterState = zoneTransition?.state ?? destState;
1505 bool flag = zone == null || zone.lv > base.lv;
1506 if (IsRegion)
1507 {
1508 if (zone != null && !EClass.player.simulatingZone)
1509 {
1510 Zone topZone = zone.GetTopZone();
1511 if (GetZoneAt(topZone.x, topZone.y) != null)
1512 {
1513 return new Point(topZone.mapX, topZone.mapY);
1514 }
1515 }
1516 }
1517 else if (c.IsPC && EClass.player.lastZonePos != null && zone != null && zone.IsRegion && (enterState == ZoneTransition.EnterState.Left || enterState == ZoneTransition.EnterState.Right || enterState == ZoneTransition.EnterState.Top || enterState == ZoneTransition.EnterState.Bottom))
1518 {
1519 return EClass.player.lastZonePos;
1520 }
1521 if (enterState == ZoneTransition.EnterState.Region)
1522 {
1523 enterState = RegionEnterState;
1524 }
1525 if (this is Zone_Kapul && enterState == ZoneTransition.EnterState.Left)
1526 {
1527 enterState = ZoneTransition.EnterState.Right;
1528 }
1529 float rate = zoneTransition?.ratePos ?? (-1f);
1530 if (IsPCFaction)
1531 {
1532 if ((uint)(enterState - 3) <= 4u || enterState == ZoneTransition.EnterState.Return)
1533 {
1535 if (spot != null)
1536 {
1537 Point nearestPoint = (spot.trait as TraitSpotGuidePC).GetRandomPoint((Point p) => !p.IsBlocked && !p.Equals(spot.pos)).GetNearestPoint();
1538 if (nearestPoint != null && nearestPoint.IsValid)
1539 {
1540 return nearestPoint;
1541 }
1542 }
1543 }
1544 }
1545 while (true)
1546 {
1547 switch (enterState)
1548 {
1549 case ZoneTransition.EnterState.UndergroundOrSky:
1550 return new Point(zoneTransition.x, zoneTransition.z);
1551 case ZoneTransition.EnterState.Teleport:
1552 {
1553 foreach (Thing thing2 in map.things)
1554 {
1555 if (thing2.IsInstalled)
1556 {
1557 TraitTeleporter traitTeleporter = thing2.trait as TraitTeleporter;
1558 if (traitTeleporter != null)
1559 {
1560 Debug.Log(zoneTransition.idTele + "/" + traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)) + "/" + traitTeleporter.GetParam(3));
1561 }
1562 if (traitTeleporter != null && !zoneTransition.idTele.IsEmpty() && zoneTransition.idTele == traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3)))
1563 {
1564 return thing2.pos.GetNearestPoint();
1565 }
1566 }
1567 }
1568 foreach (Thing thing3 in map.things)
1569 {
1570 if (thing3.IsInstalled && thing3.trait is TraitTeleporter traitTeleporter2 && traitTeleporter2.IsFor(zoneTransition.lastZone))
1571 {
1572 return thing3.pos.GetNearestPoint();
1573 }
1574 }
1575 Thing randomThing2 = EClass._map.props.installed.traits.GetRandomThing<TraitTeleporter>();
1576 if (randomThing2 != null)
1577 {
1578 return randomThing2.pos.GetNearestPoint();
1579 }
1580 goto case ZoneTransition.EnterState.Return;
1581 }
1582 case ZoneTransition.EnterState.Return:
1583 case ZoneTransition.EnterState.Elevator:
1584 case ZoneTransition.EnterState.Moongate:
1585 {
1586 if (enterState == ZoneTransition.EnterState.Elevator)
1587 {
1588 foreach (Thing thing4 in map.things)
1589 {
1590 if (thing4.IsInstalled && thing4.trait is TraitElevator traitElevator && traitElevator.IsFor(zoneTransition.lastZone))
1591 {
1592 return thing4.pos.GetNearestPoint();
1593 }
1594 }
1595 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<TraitElevator>();
1596 if (randomThing != null)
1597 {
1598 return randomThing.pos.GetNearestPoint();
1599 }
1600 }
1601 Thing thing = null;
1602 if (enterState == ZoneTransition.EnterState.Return && EClass.game.IsSurvival)
1603 {
1604 thing = map.props.installed.traits.GetRandomThing<TraitLandingPortal>();
1605 if (thing != null)
1606 {
1607 return thing.pos;
1608 }
1609 }
1610 thing = map.props.installed.traits.GetRandomThing<TraitWaystone>();
1611 if (thing != null)
1612 {
1613 return thing.pos.GetNearestPoint();
1614 }
1615 thing = map.props.installed.traits.GetRandomThing<TraitCoreZone>();
1616 if (thing != null)
1617 {
1618 return thing.pos.GetNearestPoint();
1619 }
1620 if (base.lv == 0)
1621 {
1622 goto IL_04da;
1623 }
1624 flag = base.lv <= 0;
1625 break;
1626 }
1627 case ZoneTransition.EnterState.Center:
1628 case ZoneTransition.EnterState.Encounter:
1629 if (map.config.embarkX != 0)
1630 {
1631 return new Point(map.config.embarkX, map.config.embarkY);
1632 }
1633 return map.GetCenterPos().GetNearestPoint(allowBlock: false, allowChara: false);
1634 case ZoneTransition.EnterState.Top:
1635 return map.bounds.GetTopPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1636 case ZoneTransition.EnterState.Right:
1637 return map.bounds.GetRightPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1638 case ZoneTransition.EnterState.Bottom:
1639 return map.bounds.GetBottomPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1640 case ZoneTransition.EnterState.Left:
1641 return map.bounds.GetLeftPos(rate).GetNearestPoint(allowBlock: false, allowChara: false);
1642 case ZoneTransition.EnterState.Dead:
1643 case ZoneTransition.EnterState.Exact:
1644 case ZoneTransition.EnterState.PortalReturn:
1645 case ZoneTransition.EnterState.Fall:
1646 if (zoneTransition.x == 0 && EClass._map.bounds.x != 0)
1647 {
1648 return new Point(map.config.embarkX, map.config.embarkY);
1649 }
1650 return new Point(zoneTransition.x, zoneTransition.z);
1651 case ZoneTransition.EnterState.RandomVisit:
1652 return GetRandomVisitPos(c);
1653 case ZoneTransition.EnterState.Down:
1654 flag = true;
1655 break;
1656 case ZoneTransition.EnterState.Up:
1657 flag = false;
1658 break;
1659 }
1660 break;
1661 IL_04da:
1662 enterState = ZoneTransition.EnterState.Center;
1663 }
1664 foreach (Thing thing5 in map.things)
1665 {
1666 if (thing5.trait is TraitNewZone { zone: not null } traitNewZone && zone != null && traitNewZone.zone.uid == zone.uid)
1667 {
1668 if (c != null && enterState != ZoneTransition.EnterState.Auto)
1669 {
1670 c.SetDir(traitNewZone.owner.dir);
1671 }
1672 return traitNewZone.GetExitPos();
1673 }
1674 }
1675 foreach (Thing thing6 in map.things)
1676 {
1677 if (thing6.trait is TraitNewZone traitNewZone2 && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
1678 {
1679 if (c != null && enterState != ZoneTransition.EnterState.Auto)
1680 {
1681 c.SetDir(traitNewZone2.owner.dir);
1682 }
1683 return traitNewZone2.GetExitPos();
1684 }
1685 }
1686 return GetRandomVisitPos(c);
1687 }
1688
1689 public Point GetRandomVisitPos(Chara c)
1690 {
1691 Point point = null;
1692 if (EClass.rnd(3) == 0 && map.rooms.listRoom.Count > 0)
1693 {
1694 point = map.rooms.listRoom.RandomItem().points.RandomItem();
1695 }
1696 if (point == null && EClass.rnd(4) != 0)
1697 {
1698 IEnumerable<Chara> ie = map.charas.Where((Chara t) => t.trait.ShopType != ShopType.None && t.pos != null && t.pos.IsValid);
1699 if (ie.Count() > 0)
1700 {
1701 point = ie.RandomItem().pos.GetRandomPoint(3);
1702 }
1703 }
1704 if (point == null)
1705 {
1706 point = map.bounds.GetRandomSurface(centered: false, walkable: true, !IsPCFaction && !(this is Zone_Civilized)) ?? map.bounds.GetRandomPoint();
1707 }
1708 return point.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false) ?? EClass._map.GetCenterPos().GetNearestPoint();
1709 }
1710
1711 public void AddGlobalCharasOnActivate()
1712 {
1713 Point spawnPosPC = null;
1714 if (EClass.pc.currentZone == this)
1715 {
1716 spawnPosPC = GetSpawnPos(EClass.pc);
1717 }
1718 if (spawnPosPC == null)
1719 {
1720 spawnPosPC = map.GetCenterPos();
1721 }
1722 if (spawnPosPC.IsValid && EClass.pc.global.transition != null && spawnPosPC.HasBlock)
1723 {
1724 spawnPosPC = spawnPosPC.GetNearestPoint();
1725 }
1726 spawnPosPC = spawnPosPC.Clamp(useBounds: true).GetNearestPoint();
1727 foreach (Chara c in EClass.game.cards.globalCharas.Values)
1728 {
1729 if (c.currentZone != this)
1730 {
1731 continue;
1732 }
1733 if (c.parent is Chara)
1734 {
1735 Chara chara = c.parent as Chara;
1736 c.currentZone = chara.currentZone;
1737 }
1738 else
1739 {
1740 if (c.isDead)
1741 {
1742 continue;
1743 }
1744 if (c.isRestrained && c.currentZone == EClass.pc.currentZone && (!c.pos.IsValid || c.pos.FindThing<TraitShackle>() == null))
1745 {
1746 c.isRestrained = false;
1747 }
1748 if (c.global.transition != null)
1749 {
1750 Point pos = (c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true) : GetSpawnPos(c)));
1751 if (c.IsPCParty && !c.IsPC)
1752 {
1753 if (c.host == EClass.pc)
1754 {
1755 pos.Set(spawnPosPC);
1756 }
1757 else if (pos.Equals(spawnPosPC) || !PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
1758 {
1759 c.pos.Set(spawnPosPC);
1760 if (!spawnPosPC.ForeachNearestPoint(delegate(Point p)
1761 {
1762 if (PathManager.Instance.IsPathClear(spawnPosPC, p, c, 10) && !p.Equals(spawnPosPC))
1763 {
1764 pos.Set(p);
1765 return true;
1766 }
1767 return false;
1768 }, allowBlock: false, EClass.pc.party.members.Count >= 12, allowInstalled: true, ignoreCenter: true, EClass._zone.IsRegion ? 2 : 6))
1769 {
1770 pos.Set(spawnPosPC);
1771 }
1772 }
1773 }
1774 c.pos.Set(pos);
1775 c.global.transition = null;
1776 }
1777 map.charas.Add(c);
1778 map.AddCardOnActivate(c);
1779 }
1780 }
1782 {
1783 Point nearestPoint = spawnPosPC.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: true, ignoreCenter: true);
1784 item.enemy = null;
1785 item.pos.Set(nearestPoint);
1786 map.charas.Add(item);
1787 map.AddCardOnActivate(item);
1788 }
1790 }
1791
1792 public void Deactivate()
1793 {
1794 if (!IsUserZone && !IsPCFaction && map != null)
1795 {
1796 List<Thing> list = new List<Thing>();
1797 foreach (Thing thing in map.things)
1798 {
1799 if (thing.rarity >= Rarity.Artifact && thing.HasTag(CTAG.godArtifact))
1800 {
1801 list.Add(thing);
1802 }
1803 }
1804 if (this is Zone_Tent)
1805 {
1806 foreach (Thing item in map.props.stocked.Things.Concat(map.props.roaming.Things))
1807 {
1808 if (item.IsContainer)
1809 {
1810 foreach (Thing thing2 in item.things)
1811 {
1812 if (thing2.trait is TraitTent)
1813 {
1814 list.Add(thing2);
1815 }
1816 }
1817 }
1818 if (item.trait is TraitTent)
1819 {
1820 list.Add(item);
1821 }
1822 }
1823 }
1824 if (list.Count > 0)
1825 {
1826 Msg.Say("pick_valuable");
1827 foreach (Thing item2 in list)
1828 {
1829 Msg.Say("pick_valuable2", item2);
1830 EClass.pc.AddCard(item2);
1831 }
1832 }
1833 }
1835 {
1836 base.isPeace = false;
1837 }
1838 OnBeforeDeactivate();
1839 if (IsPCFaction)
1840 {
1841 foreach (Chara member in branch.members)
1842 {
1843 member.ValidateWorks();
1844 }
1845 }
1846 EClass.game.lastActiveZone = EClass.game.activeZone;
1847 base.lastActive = EClass.world.date.GetRaw();
1848 map.OnDeactivate();
1849 EClass.scene.Clear();
1850 EClass.game.activeZone = null;
1851 if (IsInstance)
1852 {
1853 UnloadMap();
1854 base.isGenerated = false;
1855 }
1856 if (forceRegenerate)
1857 {
1858 UnloadMap();
1859 }
1860 OnDeactivate();
1861 }
1862
1863 public void OnKillGame()
1864 {
1865 foreach (Thing thing in map.things)
1866 {
1867 if (thing.renderer.hasActor)
1868 {
1869 thing.renderer.KillActor();
1870 }
1871 }
1872 }
1873
1874 public void UnloadMap()
1875 {
1876 map = null;
1877 if (bp != null)
1878 {
1879 bp.map = null;
1880 }
1881 if (branch != null)
1882 {
1883 branch.OnUnloadMap();
1884 }
1885 Debug.Log("Unloaded Map:" + this);
1886 }
1887
1888 public void ClaimZone(bool debug = false, Point pos = null)
1889 {
1891 SetMainFaction(EClass.pc.faction);
1892 branch = new FactionBranch();
1893 branch.OnCreate(this);
1894 if (base.icon == 0)
1895 {
1896 base.icon = 332;
1897 }
1898 instance = null;
1899 base.dateExpire = 0;
1900 SetInt(2, EClass.world.date.GetRaw());
1901 Register();
1902 foreach (Thing thing in map.things)
1903 {
1904 thing.isNPCProperty = false;
1905 }
1908 if (debug)
1909 {
1910 for (int i = 0; i < 7; i++)
1911 {
1912 Chara chara = CharaGen.CreateFromFilter("c_neutral");
1913 EClass._zone.AddCard(chara, EClass._map.bounds.GetRandomPoint().GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false));
1914 branch.AddMemeber(chara);
1915 }
1916 }
1917 else
1918 {
1919 Msg.Say("claimedZone");
1920 EClass.Branch.Log("claimedZone");
1921 EClass.Sound.Play("jingle_embark");
1922 EClass.pc.PlaySound("build");
1923 if (pos == null)
1924 {
1925 pos = EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: true, allowInstalled: false);
1926 }
1927 Effect.Get("aura_heaven").Play(pos);
1928 EClass._zone.AddCard(ThingGen.Create("core_zone"), pos).SetPlaceState(PlaceState.installed);
1929 }
1930 base.idPrefix = 0;
1932 {
1933 EClass.player.spawnZone = EClass._zone;
1934 }
1936 {
1937 EClass._zone.SetBGM(new List<int> { 41, 90, 44, 43 });
1939 }
1940 }
1941
1942 public void AbandonZone()
1943 {
1944 FactionBranch destBranch = ((EClass.pc.homeBranch == branch) ? EClass.game.StartZone.branch : EClass.pc.homeBranch);
1945 branch.members.ForeachReverse(delegate(Chara m)
1946 {
1947 destBranch.AddMemeber(m);
1948 if (!m.IsPCParty)
1949 {
1950 m.MoveZone(destBranch.owner);
1951 }
1952 });
1954 SetMainFaction(null);
1955 base.dateExpire = EClass.world.date.GetRaw() + 10080;
1956 }
1957
1958 public bool CanDestroy()
1959 {
1960 if (IsActiveZone || IsPCFaction || EClass.player.simulatingZone)
1961 {
1962 return false;
1963 }
1964 if (IsInstance)
1965 {
1966 return true;
1967 }
1968 bool flag = false;
1969 switch (id)
1970 {
1971 case "cave_dragon":
1972 if (!(this is Zone_DungeonDragon))
1973 {
1974 flag = true;
1975 }
1976 break;
1977 case "cave_yeek":
1978 if (!(this is Zone_DungeonYeek))
1979 {
1980 flag = true;
1981 }
1982 break;
1983 case "cave_mino":
1984 if (!(this is Zone_DungeonMino))
1985 {
1986 flag = true;
1987 }
1988 break;
1989 case "cave_dead":
1990 if (!(this is Zone_DungeonDead))
1991 {
1992 flag = true;
1993 }
1994 break;
1995 case "oldkeep":
1996 if (!(this is Zone_OldKeep))
1997 {
1998 flag = true;
1999 }
2000 break;
2001 }
2002 Zone topZone = GetTopZone();
2003 if (!flag)
2004 {
2005 if (base.dateExpire == 0 || !EClass.world.date.IsExpired(base.dateExpire))
2006 {
2007 return false;
2008 }
2009 if (!base.isRandomSite && !(this is Zone_Field) && (topZone == null || topZone == this || topZone.FindDeepestZone() == this))
2010 {
2011 return false;
2012 }
2013 }
2014 if (EClass.pc.currentZone == null || EClass.pc.currentZone is Zone_Tent || topZone == EClass.pc.currentZone.GetTopZone() || (EClass.player.nextZone != null && topZone == EClass.player.nextZone.GetTopZone()))
2015 {
2016 return false;
2017 }
2019 {
2021 if (zone != null && zone.GetTopZone() == this)
2022 {
2023 return false;
2024 }
2025 }
2026 return true;
2027 }
2028
2029 public override void _OnBeforeSave()
2030 {
2031 if (CanDestroy())
2032 {
2033 Debug.Log("Deleting Zone:" + this);
2034 if (!destryoed)
2035 {
2036 Destroy();
2037 }
2038 }
2039 else if (map != null)
2040 {
2041 Debug.Log("Saving Zone:" + this);
2042 map.Save(base.pathSave);
2043 if (!base.isMapSaved)
2044 {
2045 base.isMapSaved = true;
2046 IO.DeleteDirectory(base.pathSave + "Texture Replace");
2047 IO.CopyDir(pathTemp + "Texture Replace", base.pathSave + "/Texture Replace");
2048 }
2049 if (!IsActiveZone)
2050 {
2051 UnloadMap();
2052 }
2053 }
2054 }
2055
2056 public override void OnLoad()
2057 {
2058 if (branch != null)
2059 {
2060 branch.SetOwner(this);
2061 }
2062 events.OnLoad(this);
2063 }
2064
2065 public override void Destroy()
2066 {
2067 children.ForeachReverse(delegate(Spatial z)
2068 {
2069 z.Destroy();
2070 });
2071 if (map != null)
2072 {
2073 UnloadMap();
2074 }
2075 if (parent != null && parent.IsRegion && instance == null)
2076 {
2077 EClass.scene.elomap.SetZone(base.x, base.y, null, updateMesh: true);
2078 }
2079 EClass.game.spatials.Remove(this);
2080 destryoed = true;
2081 base.isGenerated = false;
2082 }
2083
2084 public void ClearZones(Zone current = null)
2085 {
2086 if (map != null)
2087 {
2088 UnloadMap();
2089 }
2090 base.isGenerated = false;
2091 Zone topZone = GetTopZone();
2092 if (topZone != this)
2093 {
2094 topZone.ClearZones(this);
2095 return;
2096 }
2097 children.ForeachReverse(delegate(Spatial c)
2098 {
2099 if (c != current)
2100 {
2101 c.Destroy();
2102 }
2103 });
2104 }
2105
2106 public void OnChildNumChange(Card c)
2107 {
2108 }
2109
2110 public ICardParent GetRoot()
2111 {
2112 return this;
2113 }
2114
2115 public Zone GetTopZone()
2116 {
2117 if (parent == null || parent.IsRegion)
2118 {
2119 return this;
2120 }
2121 return parent as Zone;
2122 }
2123
2124 public Card AddCardSplinkle(Card t, Point center, int radius = 4)
2125 {
2126 Point point = new Point(center);
2127 for (int i = 0; i < 1000; i++)
2128 {
2129 point.x = center.x + EClass.rnd(radius) - EClass.rnd(radius);
2130 point.z = center.z + EClass.rnd(radius) - EClass.rnd(radius);
2131 if (point.IsValid && !point.IsBlocked && !point.HasChara)
2132 {
2133 return AddCard(t, point);
2134 }
2135 }
2136 return AddCard(t, center);
2137 }
2138
2139 public Chara AddChara(string id, int x, int z)
2140 {
2141 return AddCard(CharaGen.Create(id), x, z) as Chara;
2142 }
2143
2144 public Chara AddChara(string id, Point p)
2145 {
2146 return AddChara(id, p.x, p.z);
2147 }
2148
2149 public Card AddThing(string id, int x, int z)
2150 {
2151 return AddCard(ThingGen.Create(id), x, z);
2152 }
2153
2154 public Card AddThing(string id, Point p)
2155 {
2156 return AddThing(id, p.x, p.z);
2157 }
2158
2159 public Card AddCard(Card t, Point point)
2160 {
2161 return AddCard(t, point.x, point.z);
2162 }
2163
2164 public Card AddCard(Card t)
2165 {
2166 return AddCard(t, 0, 0);
2167 }
2168
2169 public Card AddCard(Card t, int x, int z)
2170 {
2171 if (t.parent != null)
2172 {
2173 t.parent.RemoveCard(t);
2174 }
2175 t.parent = this;
2176 Chara chara = t.Chara;
2177 if (chara != null)
2178 {
2179 chara.currentZone = this;
2180 chara.SetAI(new NoGoal());
2181 }
2182 if (IsActiveZone)
2183 {
2184 map.OnCardAddedToZone(t, x, z);
2185 if (isStarted && t.isThing && t.placeState == PlaceState.roaming && !ignoreSpawnAnime)
2186 {
2187 t.PlayAnimeLoot();
2188 }
2189 ignoreSpawnAnime = false;
2190 }
2191 if (chara != null && EClass.player != null && !chara.hasSpawned)
2192 {
2193 EClass.player.codex.AddSpawn(chara.id);
2194 chara.hasSpawned = true;
2195 }
2196 return t;
2197 }
2198
2199 public void RemoveCard(Card t)
2200 {
2201 if (IsActiveZone)
2202 {
2203 map.OnCardRemovedFromZone(t);
2204 }
2205 t.parent = null;
2206 if (t.isChara)
2207 {
2208 t.Chara.currentZone = null;
2209 }
2210 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
2211 {
2213 }
2214 if (t.renderer.hasActor)
2215 {
2217 }
2218 }
2219
2220 public T GetRandomSpot<T>() where T : Trait
2221 {
2222 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
2223 }
2224
2225 public bool TryAddThingInSpot<T>(Thing t, bool useContainer = true) where T : Trait
2226 {
2227 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<T>();
2228 if (randomThing == null)
2229 {
2231 {
2232 TryAddThing(t, EClass._map.bounds.GetRandomSurface());
2233 }
2234 else
2235 {
2236 AddCard(t, EClass._map.bounds.GetRandomSurface());
2237 }
2238 return false;
2239 }
2240 if (useContainer && (!t.IsContainer || t.things.Count == 0))
2241 {
2242 List<Thing> list = new List<Thing>();
2243 foreach (Point item in randomThing.trait.ListPoints(null, onlyPassable: false))
2244 {
2245 foreach (Card item2 in item.ListCards())
2246 {
2247 if (item2.IsContainer && !(item2.trait is TraitDeliveryChest))
2248 {
2249 list.Add(item2.Thing);
2250 }
2251 }
2252 }
2253 if (TryAddThingInSharedContainer(t, list, add: true, msg: false, null, sharedOnly: false))
2254 {
2255 return true;
2256 }
2257 }
2259 {
2260 TryAddThing(t, randomThing.trait.GetRandomPoint());
2261 }
2262 else
2263 {
2264 AddCard(t, randomThing.trait.GetRandomPoint());
2265 }
2266 return true;
2267 }
2268
2269 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func = null) where T : TraitSpot
2270 {
2271 List<T> list = new List<T>();
2272 List<Thing> list2 = new List<Thing>();
2273 foreach (Thing thing in EClass._map.things)
2274 {
2275 if (thing.IsInstalled && thing.trait is T)
2276 {
2277 list.Add(thing.trait as T);
2278 }
2279 }
2280 foreach (T item in list)
2281 {
2282 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2283 {
2284 foreach (Thing thing2 in item2.Things)
2285 {
2286 if (!thing2.IsInstalled)
2287 {
2288 continue;
2289 }
2290 if (thing2.things.Count == 0)
2291 {
2292 if (IsValid(thing2))
2293 {
2294 list2.Add(thing2);
2295 }
2296 continue;
2297 }
2298 foreach (Thing item3 in thing2.things.List((Thing _t) => IsValid(_t)))
2299 {
2300 list2.Add(item3);
2301 }
2302 }
2303 }
2304 }
2305 return list2;
2306 bool IsValid(Thing t)
2307 {
2308 if (func != null && !func(t))
2309 {
2310 return false;
2311 }
2312 return true;
2313 }
2314 }
2315
2316 public bool TryAddThingInSharedContainer(Thing t, List<Thing> containers = null, bool add = true, bool msg = false, Chara chara = null, bool sharedOnly = true)
2317 {
2318 Thing thing = FindSharedContainer(t, containers, sharedOnly);
2319 if (thing == null)
2320 {
2321 return false;
2322 }
2323 if (add)
2324 {
2325 if (msg)
2326 {
2327 chara?.Say("putSharedItem", chara, t, thing.GetName(NameStyle.Full));
2328 }
2329 thing.AddThing(t);
2330 }
2331 return true;
2332 }
2333
2334 public Thing FindSharedContainer(Thing t, List<Thing> containers = null, bool sharedOnly = true)
2335 {
2336 Thing dest = null;
2337 int priority = -1;
2338 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
2339 if (flag == ContainerFlag.none)
2340 {
2341 flag = ContainerFlag.other;
2342 }
2343 if (containers == null)
2344 {
2345 containers = EClass._map.props.installed.containers;
2346 }
2347 SearchDest();
2348 return dest;
2349 Thing SearchDest()
2350 {
2351 foreach (Thing container in containers)
2352 {
2353 Thing thing = container;
2354 if (thing.trait is TraitShippingChest)
2355 {
2357 }
2358 if ((!sharedOnly || thing.IsSharedContainer) && thing.c_lockLv <= 0 && (thing.things.Count < thing.things.MaxCapacity || thing.things.CanStack(t) != t))
2359 {
2360 Window.SaveData windowSaveData = thing.GetWindowSaveData();
2361 if (windowSaveData != null)
2362 {
2363 if (windowSaveData.priority <= priority || (windowSaveData.noRotten && t.IsDecayed) || (windowSaveData.onlyRottable && t.trait.Decay == 0))
2364 {
2365 continue;
2366 }
2368 if (windowSaveData.userFilter)
2369 {
2370 filterResult = windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1));
2371 if (filterResult == Window.SaveData.FilterResult.Block)
2372 {
2373 continue;
2374 }
2375 }
2376 if (filterResult != Window.SaveData.FilterResult.PassWithoutFurtherTest)
2377 {
2378 if (windowSaveData.advDistribution)
2379 {
2380 bool flag2 = false;
2381 foreach (int cat in windowSaveData.cats)
2382 {
2383 if (t.category.uid == cat)
2384 {
2385 flag2 = true;
2386 break;
2387 }
2388 }
2389 if (!flag2)
2390 {
2391 continue;
2392 }
2393 }
2394 else if (windowSaveData.flag.HasFlag(flag))
2395 {
2396 continue;
2397 }
2398 }
2399 priority = windowSaveData.priority;
2400 }
2401 else
2402 {
2403 if (priority != -1)
2404 {
2405 continue;
2406 }
2407 priority = 0;
2408 }
2409 dest = thing;
2410 }
2411 }
2412 return null;
2413 }
2414 }
2415
2416 public bool TryAddThing(Thing target, Point p, bool destroyIfFail = false)
2417 {
2418 int num = 0;
2419 if (p.cell.detail != null)
2420 {
2421 foreach (Thing thing in p.cell.detail.things)
2422 {
2423 if (thing.placeState == PlaceState.roaming)
2424 {
2425 if (target.TryStackTo(thing))
2426 {
2427 return true;
2428 }
2429 num++;
2430 }
2431 }
2432 }
2433 if (num == 0 || !destroyIfFail)
2434 {
2435 EClass._zone.AddCard(target, p);
2436 return true;
2437 }
2438 target.Destroy();
2439 return false;
2440 }
2441
2442 public Thing TryGetThingFromSharedContainer(Func<Thing, bool> func)
2443 {
2444 foreach (Thing container in EClass._map.props.installed.containers)
2445 {
2446 if (container.IsSharedContainer)
2447 {
2448 Thing thing = container.things.Find(func);
2449 if (thing != null)
2450 {
2451 return thing;
2452 }
2453 }
2454 }
2455 return null;
2456 }
2457
2458 public Thing TryGetRestock<T>(string idCat) where T : TraitSpot
2459 {
2460 List<T> list = new List<T>();
2461 foreach (Thing thing2 in EClass._map.things)
2462 {
2463 if (thing2.IsInstalled && thing2.trait is T)
2464 {
2465 list.Add(thing2.trait as T);
2466 }
2467 }
2468 foreach (T item in list)
2469 {
2470 foreach (Point item2 in item.ListPoints(null, onlyPassable: false))
2471 {
2472 foreach (Thing thing3 in item2.Things)
2473 {
2474 if (!thing3.IsInstalled || thing3.isSale)
2475 {
2476 continue;
2477 }
2478 if (thing3.things.Count == 0)
2479 {
2480 if (IsValid(thing3, insideContainer: false))
2481 {
2482 return thing3;
2483 }
2484 continue;
2485 }
2486 Thing thing = thing3.things.Find((Thing _t) => IsValid(_t, insideContainer: true));
2487 if (thing != null)
2488 {
2489 return thing;
2490 }
2491 }
2492 }
2493 }
2494 return null;
2495 bool IsValid(Thing t, bool insideContainer)
2496 {
2497 if (t.category.id != idCat || !TraitSalesTag.CanTagSale(t, insideContainer))
2498 {
2499 return false;
2500 }
2501 return true;
2502 }
2503 }
2504
2505 public ZoneProfile GetProfile()
2506 {
2507 string text = IdProfile;
2508 if (text.IsEmpty())
2509 {
2510 Region region = parent as Region;
2511 if (base.lv != 0)
2512 {
2513 text = ((base.lv < 0) ? "Underground" : "Sky");
2514 }
2515 else if (region != null)
2516 {
2518 text = EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2519 if (bp != null)
2520 {
2521 name = Lang.GetList("zone_" + text.Split('/')[1]).RandomItem();
2522 bp.surrounding = new EloMap.TileInfo[3, 3];
2523 for (int i = 0; i < 3; i++)
2524 {
2525 for (int j = 0; j < 3; j++)
2526 {
2527 bp.surrounding[j, i] = EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2528 }
2529 }
2530 if (text == "Random/R_Shore")
2531 {
2532 base.isBeach = true;
2533 }
2534 }
2535 }
2536 else
2537 {
2538 text = "Random";
2539 }
2540 idProfile = text;
2541 }
2542 return ZoneProfile.Load(text);
2543 }
2544
2545 public void CreateBP()
2546 {
2547 bp = new ZoneBlueprint();
2548 bp.Create();
2549 bp.genSetting.seed = base.Seed;
2550 OnCreateBP();
2551 }
2552
2553 public virtual void OnCreateBP()
2554 {
2555 }
2556
2557 public void Generate()
2558 {
2559 base.isGenerated = true;
2560 if (bp == null)
2561 {
2562 CreateBP();
2563 }
2564 if (bp.map == null)
2565 {
2566 bp.GenerateMap(this);
2567 }
2568 map.SetZone(this);
2569 Zone_Field zone_Field = this as Zone_Field;
2570 bool flag = IdBiome == "Sand" || IdBiome == "Water" || IsUnderwater;
2571 if (flag)
2572 {
2573 int num = 1 + EClass.rnd((IdBiome == "Water") ? 3 : 2);
2574 for (int i = 0; i < num; i++)
2575 {
2576 Point randomSurface = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2577 if (!randomSurface.HasObj && !randomSurface.HasThing)
2578 {
2579 Thing t = ThingGen.Create("pearl_oyster", new string[3] { "wood_birch", "poplar", "coralwood" }.RandomItem(), ContentLv);
2580 EClass._zone.AddCard(t, randomSurface).Install();
2581 }
2582 }
2583 num = 4 + EClass.rnd(5);
2584 for (int j = 0; j < num; j++)
2585 {
2586 Point randomSurface2 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2587 if (!randomSurface2.HasObj && !randomSurface2.HasThing && (IsUnderwater || randomSurface2.cell.IsTopWaterAndNoSnow || EClass.rnd(6) == 0))
2588 {
2589 EClass._zone.AddCard(ThingGen.Create("70", -1, ContentLv), randomSurface2);
2590 }
2591 }
2592 for (int k = 0; k < EClass.rnd(EClass.rnd(base.isBeach ? 5 : 3) + 1); k++)
2593 {
2594 Point randomSurface3 = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2595 if (!randomSurface3.HasObj)
2596 {
2597 EClass._zone.AddCard(ThingGen.Create("bottle_message"), randomSurface3);
2598 }
2599 }
2600 }
2601 if (IsUnderwater)
2602 {
2603 for (int l = 0; l < 30 + EClass.rnd(30); l++)
2604 {
2605 SpawnMob(null, SpawnSetting.Fish());
2606 }
2607 Crawler crawler = Crawler.Create("pasture");
2608 int num2 = (EClass.debug.enable ? 3 : EClass.rnd(EClass.rnd(EClass.rnd(EClass.rnd(5) + 1) + 1) + 1));
2609 bool flag2 = this is Zone_Field;
2610 Thing seed = null;
2611 if (IsNefia)
2612 {
2613 int num3 = Mathf.Min(EClass._zone.DangerLv, EClass.pc.Evalue(286) * 2 / 3);
2614 if (num3 > 0)
2615 {
2617 Rand.SetSeed(EClass._zone.uid * 10 + num3);
2618 TraitSeed.LevelSeed(seed, (seed.trait as TraitSeed).row, num3);
2619 Rand.SetSeed();
2620 seed.elements.SetBase(2, EClass.curve(seed.encLV, 50, 10, 80));
2621 }
2622 }
2623 crawler.CrawlUntil(EClass._map, () => EClass._map.GetRandomPoint(), num2 + (flag2 ? 4 : 0), delegate(Crawler.Result r)
2624 {
2625 int num7 = 137;
2626 foreach (Point point in r.points)
2627 {
2628 if (!point.cell.isModified && !point.HasThing && !point.HasBlock && !point.HasObj)
2629 {
2630 map.SetObj(point.x, point.z, num7);
2631 int idx = 3 + ((EClass.rnd(3) == 0) ? 1 : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0) + ((EClass.rnd(3) == 0) ? (-1) : 0);
2632 point.growth.SetStage(idx);
2633 if (seed != null)
2634 {
2635 EClass._map.AddPlant(point, seed);
2636 }
2637 }
2638 }
2639 return false;
2640 });
2641 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(5) + 1) + 1 + (flag2 ? 20 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2642 {
2643 int num7 = 136;
2644 foreach (Point point2 in r.points)
2645 {
2646 if (!point2.cell.isModified && !point2.HasThing && !point2.HasBlock && !point2.HasObj)
2647 {
2648 map.SetObj(point2.x, point2.z, num7, 1, EClass.rnd(4));
2649 }
2650 }
2651 return false;
2652 });
2653 crawler.CrawlUntil(tries: EClass.rnd(EClass.rnd(10) + 1) + 3 + (flag2 ? 40 : 0), map: EClass._map, onStart: () => EClass._map.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2654 {
2655 int idFloor = 121;
2656 foreach (Point point3 in r.points)
2657 {
2658 map.SetFloor(point3.x, point3.z, 97, idFloor, Mathf.Clamp(4 - r.startPos.Distance(point3) + EClass.rnd(3) - EClass.rnd(3), 0, 3));
2659 }
2660 return false;
2661 });
2662 }
2663 if (zone_Field != null)
2664 {
2665 if (EClass.rnd(3) == 0)
2666 {
2667 int num4 = EClass.rnd(2);
2668 for (int num5 = 0; num5 < num4; num5++)
2669 {
2670 Point randomSurface4 = EClass._map.bounds.GetRandomSurface();
2671 if (!randomSurface4.HasObj && !randomSurface4.HasThing)
2672 {
2673 Card t2 = ThingGen.Create("chest3").ChangeMaterial(biome.style.matDoor);
2674 EClass._zone.AddCard(t2, randomSurface4).Install();
2675 }
2676 }
2677 }
2678 if (EClass.rnd(8) == 0)
2679 {
2680 SpawnAltar();
2681 }
2682 TrySpawnFollower();
2683 if (!flag && EClass.rnd(EClass.debug.enable ? 1 : 10) == 0)
2684 {
2685 Point randomSurface5 = EClass._map.bounds.GetRandomSurface();
2686 if (randomSurface5.IsValid)
2687 {
2688 EClass._zone.AddCard(CharaGen.Create("priest"), randomSurface5);
2689 }
2690 }
2691 if (base.Tile.isRoad)
2692 {
2693 for (int num6 = 0; num6 < EClass.rnd(4); num6++)
2694 {
2695 EClass._zone.SpawnMob(map.GetCenterPos().GetRandomPointInRadius(2, 6, requireLos: false, allowChara: false), SpawnSetting.HomeGuest(EClass._zone.DangerLv));
2696 }
2697 }
2698 }
2699 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList) ?? EClass.Sound.GetPlaylist("Day"));
2700 }
2701
2702 public void TrySpawnFollower()
2703 {
2704 bool flag = EClass.pc.HasCondition<ConDrawBacker>();
2705 if (!EClass.debug.enable && EClass.rnd(flag ? 3 : 20) != 0)
2706 {
2707 return;
2708 }
2709 Point randomSurface = EClass._map.bounds.GetRandomSurface();
2710 if (!randomSurface.IsValid)
2711 {
2712 return;
2713 }
2714 Chara c = CharaGen.Create("follower");
2715 EClass._zone.AddCard(c, randomSurface);
2716 (EClass._zone.AddThing("gallows", randomSurface).Install().trait as TraitShackle).Restrain(c);
2717 c.c_rescueState = RescueState.WaitingForRescue;
2718 if (EClass.rnd(flag ? 1 : 2) == 0 || EClass.debug.enable)
2719 {
2721 if (row != null)
2722 {
2723 c.ApplyBacker(row.id);
2724 }
2725 }
2726 Religion faith = EClass.game.religions.dictAll.Values.Where((Religion a) => a != c.faith).RandomItem();
2727 for (int num = 0; num < 3 + EClass.rnd(4); num++)
2728 {
2729 Chara chara = CharaGen.Create("fanatic");
2730 chara.SetFaith(faith);
2731 Point point = randomSurface.GetRandomPoint(4) ?? randomSurface.GetNearestPoint();
2732 EClass._zone.AddCard(chara, point);
2733 }
2734 }
2735
2736 public void SpawnAltar()
2737 {
2738 EClass.core.refs.crawlers.start.CrawlUntil(map, () => map.poiMap.GetCenterCell().GetCenter(), 1, delegate(Crawler.Result r)
2739 {
2740 if (r.points.Count <= 4)
2741 {
2742 return false;
2743 }
2744 map.poiMap.OccyupyPOI(r.points[0]);
2745 List<Point> points = r.points;
2746 Religion randomReligion = EClass.game.religions.GetRandomReligion();
2747 "altarPoint".lang(randomReligion.NameDomain.lang());
2748 Thing thing = ThingGen.Create("altar");
2749 (thing.trait as TraitAltar).SetDeity(randomReligion.id);
2750 Chara t = CharaGen.Create("twintail");
2751 EClass._zone.AddCard(t, points.RandomItem());
2752 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2753 {
2754 Chara t2 = CharaGen.Create("twintail");
2755 EClass._zone.AddCard(t2, points.RandomItem());
2756 }
2757 if (points[0].Installed == null)
2758 {
2759 EClass._zone.AddCard(thing, points[0]).Install();
2760 }
2761 foreach (Point item in points)
2762 {
2763 if (item.x % 3 == 0 && item.z % 2 == 0 && item != points[0] && !item.Equals(points[0].Front) && item.Installed == null)
2764 {
2765 thing = ThingGen.Create("pillar1");
2766 EClass._zone.AddCard(thing, item).Install();
2767 }
2768 item.SetObj();
2769 item.SetFloor(3, 6);
2770 }
2771 return true;
2772 });
2773 }
2774
2775 public virtual void OnGenerateMap()
2776 {
2777 if (MakeEnemiesNeutral)
2778 {
2779 foreach (Chara chara in EClass._map.charas)
2780 {
2781 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral && chara.OriginalHostility < Hostility.Friend)
2782 {
2783 Hostility hostility = (chara.c_originalHostility = Hostility.Neutral);
2784 chara.hostility = hostility;
2785 }
2786 }
2787 }
2788 if (PrespawnRate != 0f && !IsSkyLevel)
2789 {
2790 for (int i = 0; i < (int)((float)MaxSpawn * PrespawnRate); i++)
2791 {
2792 SpawnMob();
2793 }
2794 }
2795 TryGenerateOre();
2796 TryGenerateBigDaddy();
2797 TryGenerateEvolved();
2798 TryGenerateShrine();
2799 }
2800
2801 public void TryGenerateOre()
2802 {
2803 if (OreChance <= 0f)
2804 {
2805 return;
2806 }
2807 Crawler.Create("ore").CrawlUntil(tries: EClass.rnd((int)((float)(map.bounds.Width * map.bounds.Height / 200 + 1) * OreChance + 2f)), map: EClass._map, onStart: () => EClass._map.bounds.GetRandomPoint(), canComplete: delegate(Crawler.Result r)
2808 {
2809 int num = 18;
2810 string text = "ore";
2811 if (EClass.rnd(5) == 0)
2812 {
2813 num++;
2814 text = "gem";
2815 }
2816 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(DangerLv, text);
2817 foreach (Point point in r.points)
2818 {
2819 if (point.sourceBlock.ContainsTag("ore"))
2820 {
2821 map.SetObj(point.x, point.z, randomMaterial.id, num, 1, 0);
2822 }
2823 }
2824 return false;
2825 });
2826 }
2827
2828 public Chara TryGenerateEvolved(bool force = false, Point p = null)
2829 {
2830 float num = EvolvedChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f);
2831 if (!force && num <= EClass.rndf(1f))
2832 {
2833 return null;
2834 }
2835 Chara chara = SpawnMob(p, SpawnSetting.Evolved());
2836 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2837 {
2838 chara.ability.AddRandom();
2839 }
2840 chara.AddThing(chara.MakeGene(DNA.Type.Default));
2841 if (EClass.rnd(2) == 0)
2842 {
2843 chara.AddThing(chara.MakeGene(DNA.Type.Superior));
2844 }
2845 return chara;
2846 }
2847
2848 public void TryGenerateBigDaddy()
2849 {
2850 if (!(BigDaddyChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f) <= EClass.rndf(1f)))
2851 {
2852 Point spawnPos = GetSpawnPos(SpawnPosition.Random, 10000);
2853 List<string> list = new List<string> { "big_daddy", "big_daddy2" };
2854 list.Shuffle();
2855 Spawn(list[0], spawnPos);
2856 if (EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
2857 {
2858 Spawn(list[1], spawnPos.GetNearestPoint(allowBlock: false, allowChara: false));
2859 }
2860 Msg.Say("sign_bigdaddy");
2861 }
2862 void Spawn(string id, Point pos)
2863 {
2864 int num = (int)((long)DangerLv * 125L / 100);
2865 if (num >= 30)
2866 {
2868 {
2869 lv = num
2870 });
2871 }
2872 Chara chara = CharaGen.Create(id);
2873 if (EClass.pc.HasElement(1270))
2874 {
2875 chara.SetHostility(Hostility.Friend);
2876 }
2877 else if (EClass.pc.HasElement(1271))
2878 {
2879 chara.SetHostility(Hostility.Enemy);
2880 }
2881 EClass._zone.AddCard(chara, pos);
2882 }
2883 }
2884
2885 public void TryGenerateShrine()
2886 {
2887 float num = ShrineChance * (EClass.pc.HasElement(1270) ? 1.1f : 1f);
2888 for (int i = 0; i < 3; i++)
2889 {
2890 Rand.SetSeed(base.uid + i);
2891 if (num <= EClass.rndf(1f))
2892 {
2893 continue;
2894 }
2895 Point randomSpace = EClass._map.GetRandomSpace(3, 3);
2896 if (randomSpace == null)
2897 {
2898 continue;
2899 }
2900 randomSpace.x++;
2901 randomSpace.z++;
2902 if (randomSpace.HasThing || randomSpace.HasChara)
2903 {
2904 continue;
2905 }
2906 randomSpace.SetObj();
2909 if (EClass.rnd(EClass.debug.test ? 2 : 15) == 0)
2910 {
2911 EClass._zone.AddCard(ThingGen.Create("pedestal_power"), randomSpace).Install();
2912 EClass._zone.AddCard(ThingGen.Create(EClass.gamedata.godStatues.RandomItemWeighted((GodStatueData a) => a.chance).idThing, -1, DangerLv), randomSpace).Install();
2913 }
2914 else
2915 {
2916 EClass._zone.AddCard(ThingGen.Create("statue_power", -1, DangerLv), randomSpace).Install().SetRandomDir();
2917 }
2918 }
2919 Rand.SetSeed();
2920 }
2921
2922 public void ResetHostility()
2923 {
2924 foreach (Chara chara in EClass._map.charas)
2925 {
2926 if (!chara.source.hostility.IsEmpty() && chara.source.hostility.ToEnum<Hostility>() >= Hostility.Friend && !chara.IsPCFactionOrMinion && !chara.isSummon && (EClass._zone is Zone_Civilized || EClass._zone.IsPCFactionOrTent))
2927 {
2928 chara.c_originalHostility = (Hostility)0;
2929 }
2930 chara.hostility = chara.OriginalHostility;
2931 if (chara.enemy != null && (chara.enemy.IsPCFaction || chara.IsPCFaction) && !chara.IsHostile(chara.enemy))
2932 {
2933 chara.SetEnemy();
2934 }
2935 }
2936 }
2937
2938 public virtual void OnGenerateRooms(BaseMapGen gen)
2939 {
2940 }
2941
2942 public Point GetSpawnPos(SpawnPosition type, int tries = 100)
2943 {
2944 Point point = new Point();
2945 for (int i = 0; i < tries; i++)
2946 {
2947 point = EClass._map.bounds.GetRandomSurface(centered: false, walkable: true, allowWater: true);
2948 if (!point.IsValid || point.cell.hasDoor || point.IsSync)
2949 {
2950 continue;
2951 }
2952 switch (type)
2953 {
2954 case SpawnPosition.Guest:
2955 {
2956 List<TraitSpotGuest> list = EClass._map.props.installed.traits.List<TraitSpotGuest>();
2957 if (list.Count > 0)
2958 {
2959 list.Shuffle();
2960 foreach (TraitSpotGuest item in list)
2961 {
2962 List<Point> list2 = item.ListPoints(null, onlyPassable: true, allowChara: false);
2963 if (list2.Count > 0)
2964 {
2965 return list2.RandomItem();
2966 }
2967 }
2968 }
2969 Room room = point.cell.room;
2970 if (room != null && room.data.accessType != BaseArea.AccessType.Public)
2971 {
2972 continue;
2973 }
2974 break;
2975 }
2976 case SpawnPosition.Outside:
2977 if (point.cell.HasRoof || point.cell.light > 0)
2978 {
2979 continue;
2980 }
2981 break;
2982 }
2983 return point;
2984 }
2985 return null;
2986 }
2987
2988 public Chara SpawnMob(string id, Point pos = null)
2989 {
2990 return SpawnMob(pos, new SpawnSetting
2991 {
2992 id = id
2993 });
2994 }
2995
2996 public Chara SpawnMob(Point pos = null, SpawnSetting setting = null)
2997 {
2998 if (setting == null)
2999 {
3000 setting = SpawnSetting.Default;
3001 }
3002 if (pos == null)
3003 {
3004 pos = GetSpawnPos(setting.position, setting.tries);
3005 if (pos == null)
3006 {
3007 pos = GetSpawnPos(SpawnPosition.Random, setting.tries);
3008 if (pos == null)
3009 {
3010 return null;
3011 }
3012 }
3013 }
3014 BiomeProfile biome = pos.cell.biome;
3015 if (IsUnderwater && EClass.rnd(15) != 0)
3016 {
3017 biome = ((EClass.rnd(4) != 0) ? EClass.core.refs.biomes.Water : EClass.core.refs.biomes.Sand);
3018 }
3019 SpawnList spawnList = null;
3020 if (setting.idSpawnList != null)
3021 {
3022 spawnList = SpawnList.Get(setting.idSpawnList);
3023 }
3024 else if (EClass._zone is Zone_DungeonYeek && EClass.rnd(5) != 0)
3025 {
3026 spawnList = SpawnListChara.Get("dungeon_yeek", (SourceChara.Row r) => r.race == "yeek" && r.quality == 0);
3027 }
3028 else if (EClass._zone is Zone_DungeonDragon && EClass.rnd(5) != 0)
3029 {
3030 spawnList = SpawnListChara.Get("dungeon_dragon", (SourceChara.Row r) => (r.race == "dragon" || r.race == "drake" || r.race == "wyvern" || r.race == "lizardman" || r.race == "dinosaur") && r.quality == 0);
3031 }
3032 else if (EClass._zone is Zone_DungeonMino && EClass.rnd(5) != 0)
3033 {
3034 spawnList = SpawnListChara.Get("dungeon_mino", (SourceChara.Row r) => r.race == "minotaur" && r.quality == 0);
3035 }
3036 else if (setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) < ChanceSpawnNeutral))
3037 {
3038 spawnList = SpawnList.Get(IsInstance ? "c_neutral_war" : "c_neutral");
3039 }
3040 else if (biome.spawn.chara.Count > 0)
3041 {
3042 string randomCharaId = biome.spawn.GetRandomCharaId();
3043 spawnList = ((!IsInstance) ? SpawnList.Get(randomCharaId) : SpawnList.Get("instance_" + randomCharaId, randomCharaId, new CharaFilter
3044 {
3045 ShouldPass = (SourceChara.Row s) => (!(s.hostility != "") || (!s.tag.Contains("cat") && !s.race_row.tag.Contains("cat"))) ? true : false
3046 }));
3047 }
3048 else
3049 {
3050 spawnList = SpawnList.Get(biome.name, "chara", new CharaFilter
3051 {
3052 ShouldPass = delegate(SourceChara.Row s)
3053 {
3054 if (s.hostility != "")
3055 {
3056 return false;
3057 }
3058 return s.biome == biome.name || s.biome.IsEmpty();
3059 }
3060 });
3061 }
3062 int num = ((setting.dangerLv == -1) ? DangerLv : setting.dangerLv);
3063 CardBlueprint cardBlueprint = new CardBlueprint
3064 {
3065 rarity = Rarity.Normal,
3066 idEle = setting.idEle
3067 };
3068 int num2 = ((setting.filterLv == -1) ? num : setting.filterLv);
3069 if (ScaleType == ZoneScaleType.Void)
3070 {
3071 num2 = ((num - 1) % 50 + 5) * 150 / 100;
3072 if (num2 >= 20 && EClass.rnd(100) < num2)
3073 {
3074 num2 = num;
3075 }
3076 }
3077 CardRow cardRow = (setting.id.IsEmpty() ? spawnList.Select(num2, setting.levelRange) : EClass.sources.cards.map[setting.id]);
3078 if (EClass.world.date.month == 12 && setting.rarity == Rarity.Random && EClass._zone.IsNefia && EClass._zone.isRandomSite && EClass.world.date.day >= 24 && EClass.world.date.day <= 26 && EClass.rnd(50 * (1 + EClass.player.flags.santa) * (1 + EClass.player.flags.santa)) == 0)
3079 {
3080 cardRow = EClass.sources.cards.map["santa"];
3082 }
3083 if (cardRow == null)
3084 {
3085 Debug.LogError("SpawnMob: no spawn row list/" + spawnList?.id + "/biome/" + biome.name + "/zone/" + Name);
3086 return null;
3087 }
3088 long num3 = ((setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv);
3089 bool flag = setting.fixedLv != -1 || setting.addLv > 0 || DangerLvBoost > 0;
3090 num3 += setting.addLv;
3091 if (ScaleType == ZoneScaleType.Void)
3092 {
3093 num3 = (50L + (long)cardRow.LV) * Mathf.Max(1, (num - 1) / 50);
3094 flag = true;
3095 }
3096 num3 += DangerLvBoost;
3097 if (flag && num3 <= Mathf.Max(50, cardRow.LV))
3098 {
3099 flag = false;
3100 }
3101 if (setting.rarity == Rarity.Random && cardRow.quality == 0)
3102 {
3103 if (EClass.rnd(EClass.pc.HasElement(1271) ? 80 : 100) == 0)
3104 {
3105 cardBlueprint.rarity = Rarity.Legendary;
3106 num3 = num3 * 125 / 100;
3107 }
3108 }
3109 else
3110 {
3111 cardBlueprint.rarity = setting.rarity;
3112 }
3113 if (setting.isBoss)
3114 {
3115 num3 = num3 * 150 / 100;
3116 }
3117 if (setting.isEvolved)
3118 {
3119 num3 = num3 * 2 + 20;
3120 }
3121 if (num3 != cardRow.LV)
3122 {
3123 cardBlueprint.lv = (int)Mathf.Min(num3, 100000000f);
3124 }
3125 CardBlueprint.Set(cardBlueprint);
3126 Chara chara = CharaGen.Create(cardRow.id, num2);
3127 if (!flag)
3128 {
3129 chara.isScaled = false;
3130 }
3131 AddCard(chara, pos);
3132 if (setting.forcedHostility.HasValue)
3133 {
3134 Hostility c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
3135 chara.c_originalHostility = c_originalHostility;
3136 }
3137 else
3138 {
3139 switch (chara.id)
3140 {
3141 case "unicorn":
3142 if (EClass.pc.HasElement(1216) && EClass.pc.Evalue(418) < 1)
3143 {
3144 chara.SetHostility(Hostility.Enemy);
3145 }
3146 break;
3147 case "santa":
3148 case "silverwolf":
3149 case "twintail":
3150 case "test17":
3151 if (EClass.pc.HasElement(1270))
3152 {
3153 chara.SetHostility(Hostility.Friend);
3154 }
3155 else if (EClass.pc.HasElement(1271))
3156 {
3157 chara.SetHostility(Hostility.Enemy);
3158 }
3159 break;
3160 }
3161 }
3162 if (setting.isBoss)
3163 {
3164 chara.c_bossType = BossType.Boss;
3165 }
3166 if (setting.isEvolved)
3167 {
3168 chara.c_bossType = BossType.Evolved;
3169 }
3170 if (DangerLv >= 20 && !IsPCFaction && !IsTown && EClass.rnd(200) == 0)
3171 {
3173 }
3174 return chara;
3175 }
3176
3177 public bool HasField(int idEle)
3178 {
3179 return fieldElements.Has(idEle);
3180 }
3181
3182 public void SetFieldEffect(int idEle, int a, int duration = 0)
3183 {
3184 fieldElements.SetBase(idEle, a, duration);
3185 }
3186
3187 public void RemoveFieldEffect(int idEle)
3188 {
3189 fieldElements.Remove(idEle);
3190 }
3191
3192 public void RefreshElectricity()
3193 {
3194 dirtyElectricity = false;
3195 bool flag = GetSoilCost() > MaxSoil;
3196 base.electricity = elements.Value(2201) * 10 + BaseElectricity;
3197 foreach (Thing thing in EClass._map.things)
3198 {
3199 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
3200 {
3201 base.electricity += thing.trait.Electricity;
3202 }
3203 }
3204 if (!flag)
3205 {
3206 EClass._map.bounds.ForeachCell(delegate(Cell c)
3207 {
3208 if (c.sourceObj.id == 118 && c.growth.IsMature)
3209 {
3210 base.electricity += 20;
3211 }
3212 });
3213 }
3214 foreach (Thing thing2 in EClass._map.things)
3215 {
3216 if (thing2.IsInstalled)
3217 {
3218 thing2.trait.TryToggle();
3219 }
3220 }
3221 }
3222
3223 public int GetElectricity(bool cost = false)
3224 {
3225 bool flag = GetSoilCost() > MaxSoil;
3226 int sum = 0;
3227 foreach (Thing thing in EClass._map.things)
3228 {
3229 if (!thing.IsInstalled || thing.trait.Electricity == 0)
3230 {
3231 continue;
3232 }
3233 if (cost)
3234 {
3235 if (thing.trait.Electricity < 0)
3236 {
3237 sum += -thing.trait.Electricity;
3238 }
3239 }
3240 else if (thing.trait.Electricity > 0)
3241 {
3242 sum += thing.trait.Electricity;
3243 }
3244 }
3245 if (!cost)
3246 {
3247 sum += elements.Value(2201) * 10 + BaseElectricity;
3248 if (!flag)
3249 {
3250 EClass._map.bounds.ForeachCell(delegate(Cell c)
3251 {
3252 if (c.sourceObj.id == 118 && c.growth.IsMature)
3253 {
3254 sum += 20;
3255 }
3256 });
3257 }
3258 }
3259 return sum;
3260 }
3261
3262 public void SetBGM(List<int> ids, bool refresh = true, float fadeDuration = 0f)
3263 {
3264 map._plDay.Clear();
3265 if (ids.Count > 0)
3266 {
3267 foreach (int id in ids)
3268 {
3269 if (id != -1)
3270 {
3271 map._plDay.Add(id);
3272 }
3273 }
3274 }
3275 UnityEngine.Object.DestroyImmediate(map.plDay);
3276 map.plDay = null;
3277 RefreshPlaylist();
3278 if (!refresh)
3279 {
3280 return;
3281 }
3282 if (fadeDuration > 0f)
3283 {
3284 EClass.Sound.StopBGM(fadeDuration, playLastBGM: false, delegate
3285 {
3287 {
3288 RefreshBGM();
3289 }
3290 });
3291 }
3292 else
3293 {
3294 EClass.Sound.StopBGM();
3295 RefreshBGM();
3296 }
3297 }
3298
3299 public void SetBGM(int id = -1, bool refresh = true, float fadeDuration = 0f)
3300 {
3301 SetBGM(new List<int> { id }, refresh, fadeDuration);
3302 }
3303
3304 public void RefreshPlaylist()
3305 {
3306 if (map.plDay == null)
3307 {
3308 map.plDay = CreatePlaylist(ref map._plDay, EClass.Sound.GetPlaylist(IDPlayList));
3309 }
3310 map.plDay.shuffle = EClass._map.config.shufflePL;
3311 }
3312
3313 public void ResetPlaylist()
3314 {
3315 map._plDay.Clear();
3316 UnityEngine.Object.DestroyImmediate(map.plDay);
3317 map.plDay = null;
3318 RefreshPlaylist();
3319 }
3320
3321 public void RefreshBGM()
3322 {
3324 {
3325 return;
3326 }
3327 RefreshPlaylist();
3328 Playlist playlist = map.plDay;
3329 foreach (ZoneEvent item in events.list)
3330 {
3331 if (item.playlist != null)
3332 {
3333 playlist = item.playlist;
3334 }
3335 }
3336 if (IDPlaylistOverwrite != null)
3337 {
3338 playlist = EClass.Sound.GetPlaylist(IDPlaylistOverwrite);
3339 }
3341 {
3342 Room room = EClass.pc.pos.cell.room;
3343 if (room != null && room.lot != null && room.lot.idBGM != 0)
3344 {
3345 playlist = EClass.Sound.plLot;
3346 if (playlist.list[0].data?.id != room.lot.idBGM)
3347 {
3348 playlist.list[0].data = EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM);
3349 playlist.Reset();
3350 if (!LayerDrama.keepBGM)
3351 {
3352 EClass.Sound.StopBGM(1f);
3353 }
3354 }
3355 }
3356 }
3358 EClass.Sound.SwitchPlaylist(playlist, !LayerDrama.keepBGM);
3359 }
3360
3361 public Playlist CreatePlaylist(ref List<int> list, Playlist mold = null)
3362 {
3363 return ModUtil.CreatePlaylist(ref list, mold);
3364 }
3365
3366 public Chara FindChara(string id)
3367 {
3368 return map.charas.Find((Chara c) => c.id == id);
3369 }
3370
3371 public Chara FindChara(int uid)
3372 {
3373 return map.charas.Find((Chara c) => c.uid == uid);
3374 }
3375
3376 public Chara FindDeadChara(string id)
3377 {
3378 return map.deadCharas.Find((Chara c) => c.id == id);
3379 }
3380
3381 public int GetDeepestLv()
3382 {
3383 int max = base.lv;
3384 return GetDeepestLv(ref max);
3385 }
3386
3387 public int GetDeepestLv(ref int max)
3388 {
3389 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
3390 {
3391 max = base.lv;
3392 }
3393 foreach (Spatial child in children)
3394 {
3395 (child as Zone).GetDeepestLv(ref max);
3396 }
3397 return max;
3398 }
3399
3400 public int GetCostSkyTravel()
3401 {
3402 if (base.source.costSkyTravel > 0)
3403 {
3404 return base.source.costSkyTravel;
3405 }
3407 {
3408 return Mathf.Clamp(10 + EClass.curve(DangerLv, 50, 10), 1, 200);
3409 }
3410 return 0;
3411 }
3412
3413 public List<Element> ListLandFeats()
3414 {
3415 if (landFeats == null)
3416 {
3417 landFeats = new List<int>();
3419 string[] listBase = IDBaseLandFeat.Split(',');
3420 string[] array = listBase;
3421 foreach (string text in array)
3422 {
3423 if (!text.IsEmpty())
3424 {
3425 landFeats.Add(EClass.sources.elements.alias[text].id);
3426 }
3427 }
3428 if (listBase.Length == 1)
3429 {
3430 List<SourceElement.Row> list = EClass.sources.elements.rows.Where(delegate(SourceElement.Row e)
3431 {
3432 if (e.category != "landfeat" || e.chance == 0)
3433 {
3434 return false;
3435 }
3436 bool flag = true;
3437 string[] tag = e.tag;
3438 foreach (string text2 in tag)
3439 {
3440 if (text2.StartsWith("bf"))
3441 {
3442 flag = false;
3443 if (listBase[0] == text2)
3444 {
3445 flag = true;
3446 break;
3447 }
3448 }
3449 }
3450 return flag ? true : false;
3451 }).ToList();
3452 SourceElement.Row row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3453 landFeats.Add(row.id);
3454 list.Remove(row);
3455 row = list.RandomItemWeighted((SourceElement.Row e) => e.chance);
3456 landFeats.Add(row.id);
3457 }
3458 Rand.SetSeed();
3459 }
3460 List<Element> list2 = new List<Element>();
3461 foreach (int landFeat in landFeats)
3462 {
3463 list2.Add(Element.Create(landFeat, 1));
3464 }
3465 return list2;
3466 }
3467
3468 public ZoneExportData Import(string path)
3469 {
3470 ZipFile zipFile = ZipFile.Read(path);
3471 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3472 zipFile.ExtractAll(pathTemp);
3473 zipFile.Dispose();
3474 return IO.LoadFile<ZoneExportData>(pathTemp + "export") ?? new ZoneExportData();
3475 }
3476
3477 public void Export(string path, PartialMap partial = null, bool usermap = false)
3478 {
3479 if (subset != null)
3480 {
3481 SE.Beep();
3482 return;
3483 }
3484 try
3485 {
3486 ZoneExportData zoneExportData = new ZoneExportData
3487 {
3488 name = name,
3489 usermap = usermap
3490 };
3492 if (!map.config.retainDecal)
3493 {
3494 map.ClearRainAndDecal();
3495 }
3496 map.Save(IO.TempPath + "/", zoneExportData, partial);
3497 map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(path), partial);
3498 if (partial == null)
3499 {
3500 IO.CopyDir(base.pathSave + "Texture Replace", IO.TempPath + "/Texture Replace");
3501 }
3502 IO.SaveFile(IO.TempPath + "/export", zoneExportData, compress: true);
3503 using (ZipFile zipFile = new ZipFile())
3504 {
3505 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3506 zipFile.AddDirectory(IO.TempPath);
3507 zipFile.Save(path);
3508 zipFile.Dispose();
3509 }
3511 }
3512 catch (Exception ex)
3513 {
3514 EClass.ui.Say(ex.Message + ":" + path);
3515 }
3516 }
3517
3518 public void ExportDialog(string dir = null)
3519 {
3521 {
3522 string text = StandaloneFileBrowser.SaveFilePanel("Export Zone", dir ?? CorePath.ZoneSave, "new zone", "z");
3523 if (!string.IsNullOrEmpty(text))
3524 {
3525 Export(text);
3526 Msg.SayRaw("Exported Zone");
3527 }
3528 });
3529 }
3530
3531 public void ImportDialog(string dir = null)
3532 {
3534 {
3535 string[] array = StandaloneFileBrowser.OpenFilePanel("Import Zone", dir ?? CorePath.ZoneSave, "z", multiselect: false);
3536 if (array.Length != 0)
3537 {
3538 Zone_User zone_User = SpatialGen.Create("user", EClass.world.region, register: true) as Zone_User;
3539 zone_User.path = array[0];
3540 Thing thing = ThingGen.Create("teleporter");
3541 thing.c_uidZone = zone_User.uid;
3542 EClass._zone.AddCard(thing, EClass.pc.pos);
3543 }
3544 });
3545 }
3546
3547 public static bool IsImportValid(string path)
3548 {
3549 try
3550 {
3551 return Map.GetMetaData(path)?.IsValidVersion() ?? false;
3552 }
3553 catch (Exception ex)
3554 {
3555 EClass.ui.Say(ex.Message);
3556 return false;
3557 }
3558 }
3559
3560 public void Export()
3561 {
3563 string text = pathExport;
3564 IO.Copy(text, CorePath.ZoneSave + "Backup/");
3565 Export(text);
3566 Msg.Say("Exported Map:" + text);
3567 }
3568
3569 public void WriteNote(UINote n, Action<UINote> onWriteNote = null, IInspect.NoteMode mode = IInspect.NoteMode.Default, Recipe recipe = null)
3570 {
3571 }
3572
3573 public void OnInspect()
3574 {
3575 }
3576
3577 public int GetSortVal()
3578 {
3579 if (IsPCFaction)
3580 {
3581 return -10000000 + base.uid;
3582 }
3583 if (this is Zone_SubTown)
3584 {
3585 return -8000000 + base.uid;
3586 }
3587 if (this is Zone_Town)
3588 {
3589 return -9000000 + base.uid;
3590 }
3591 if (this is Zone_Civilized)
3592 {
3593 return -7000000 + base.uid;
3594 }
3595 if (this is Zone_RandomDungeon)
3596 {
3597 return 1000000 + base.uid;
3598 }
3599 return base.uid;
3600 }
3601
3602 public Chara AddRandomVisitor(bool guest = false)
3603 {
3604 Trait random = map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
3605 if (random == null)
3606 {
3607 return null;
3608 }
3609 Point point = random.GetPoint();
3610 Chara chara = null;
3611 if (guest)
3612 {
3613 Zone z = EClass.world.FindZone("wilds");
3614 chara = EClass.game.cards.ListGlobalChara(z).RandomItem();
3615 if (chara != null)
3616 {
3617 AddCard(chara, point);
3618 Msg.Say("guestArrive", chara);
3619 chara.visitorState = VisitorState.Arrived;
3620 }
3621 }
3622 else
3623 {
3624 chara = CharaGen.CreateFromFilter("c_wilds");
3625 AddCard(chara, point);
3626 chara.goalListType = GoalListType.Enemy;
3627 }
3628 return chara;
3629 }
3630
3631 public void OnSimulateHour(VirtualDate date)
3632 {
3633 if (base.IsPlayerFaction)
3634 {
3635 branch.OnSimulateHour(date);
3636 }
3637 events.OnSimulateHour();
3638 if (date.IsRealTime)
3639 {
3640 foreach (Thing thing in EClass._map.things)
3641 {
3642 if (thing.IsInstalled)
3643 {
3644 thing.trait.TryToggle();
3645 }
3646 }
3648 }
3649 EClass._map.things.ForeachReverse(delegate(Thing t)
3650 {
3651 t.OnSimulateHour(date);
3652 });
3653 foreach (Thing sucker in Suckers)
3654 {
3655 sucker.Destroy();
3656 }
3657 Suckers.Clear();
3658 if (RespawnRate != 0f)
3659 {
3660 int num = 0;
3661 foreach (Chara chara in map.charas)
3662 {
3663 if (!chara.IsGlobal)
3664 {
3665 num++;
3666 }
3667 }
3668 if (num < MaxRespawn)
3669 {
3670 for (int num2 = 0; num2 < RespawnPerHour; num2++)
3671 {
3672 SpawnMob();
3673 }
3674 }
3675 }
3676 if (!date.IsRealTime && EClass.rnd(24) == 0)
3677 {
3678 RainWater();
3679 }
3680 if (date.hour == 6)
3681 {
3682 GrowPlants(date);
3683 }
3684 }
3685
3686 public void OnSimulateDay(VirtualDate date)
3687 {
3688 if (base.IsPlayerFaction)
3689 {
3690 branch.OnSimulateDay(date);
3691 }
3692 }
3693
3694 public void OnSimulateMonth(VirtualDate date)
3695 {
3696 if (base.IsPlayerFaction)
3697 {
3698 branch.OnSimulateMonth(date);
3699 }
3700 if (date.IsRealTime)
3701 {
3703 }
3704 }
3705
3706 public void RainWater()
3707 {
3708 if (EClass._map.IsIndoor || !IsPCFaction)
3709 {
3710 return;
3711 }
3712 EClass._map.bounds.ForeachCell(delegate(Cell c)
3713 {
3714 if (c.IsFarmField && !c.HasRoof)
3715 {
3716 c.isWatered = true;
3717 }
3718 });
3719 }
3720
3721 public void GrowPlants(VirtualDate date)
3722 {
3723 bool num = (EClass.player.isAutoFarming = IsPCFaction && EClass.Branch.policies.IsActive(2707));
3724 int weedChance = 1;
3725 if (IsPCFaction && EClass.Branch.policies.IsActive(2703))
3726 {
3727 weedChance += (EClass.debug.enable ? 100000 : 20) + EClass.Branch.Evalue(2703) * 10;
3728 }
3729 if (date.sunMap == null)
3730 {
3731 date.BuildSunMap();
3732 }
3733 if (num)
3734 {
3735 HashSet<int> hashSet = new HashSet<int>();
3736 foreach (Thing thing in EClass._map.things)
3737 {
3738 if (!thing.IsInstalled || !(thing.trait is TraitSpotFarm traitSpotFarm))
3739 {
3740 continue;
3741 }
3742 foreach (Point item in traitSpotFarm.ListPoints(null, onlyPassable: false))
3743 {
3744 hashSet.Add(item.index);
3745 }
3746 }
3747 Perform(hashSet);
3748 EClass.player.isAutoFarming = false;
3749 Perform(hashSet);
3750 }
3751 else
3752 {
3753 Perform(null);
3754 }
3755 void Perform(HashSet<int> farmMap)
3756 {
3757 bool isWinter = date.IsWinter;
3758 EClass._map.bounds.ForeachCell(delegate(Cell c)
3759 {
3760 if (farmMap != null)
3761 {
3763 {
3764 if (!farmMap.Contains(c.index))
3765 {
3766 return;
3767 }
3768 }
3769 else if (farmMap.Contains(c.index))
3770 {
3771 return;
3772 }
3773 }
3774 if (c.decal != 0 && EClass.rnd(3) == 0)
3775 {
3776 c.decal = 0;
3777 }
3778 if (GrowPlant)
3779 {
3780 if (c.growth != null)
3781 {
3782 bool flag = false;
3783 if (!EClass.player.isAutoFarming && c.growth.HaltGrowth() && (c.IsFarmField || c.IsTopWater) && (!isWinter || !date.IsRealTime))
3784 {
3785 flag = true;
3786 }
3787 PlantData plantData = map.TryGetPlant(c);
3788 if (!flag && (plantData == null || plantData.fert >= 0))
3789 {
3790 c.TryGrow(date);
3791 }
3792 if (isWinter && plantData != null && c.growth != null && c.growth.NeedSunlight && plantData.fert >= 0 && (EClass.rnd(4) == 0 || c.growth.stage.idx == 0))
3793 {
3794 if (date.sunMap == null)
3795 {
3796 date.BuildSunMap();
3797 }
3798 if (!date.sunMap.Contains(c.index) && !c.growth.CanGrow(date))
3799 {
3800 c.growth.Perish();
3801 }
3802 }
3803 }
3804 else if (c.detail != null)
3805 {
3806 c.Things.ForeachReverse(delegate(Thing t)
3807 {
3808 if (t.IsInstalled && t.trait is TraitSeed && !t.isSale)
3809 {
3810 (t.trait as TraitSeed).TrySprout(force: false, sucker: false, date);
3811 }
3812 });
3813 }
3814 else if (EClass.rnd(20) == 0 && GrowWeed && c.CanGrowWeed && EClass.rnd(weedChance) == 0)
3815 {
3816 biome.Populate(c.GetPoint());
3817 if (c.growth != null)
3818 {
3819 c.growth.SetStage(0);
3820 }
3821 }
3822 }
3823 c.isWatered = false;
3824 });
3825 }
3826 }
3827
3828 public Zone GetZoneAt(int _x, int _y)
3829 {
3830 if (IsRegion)
3831 {
3832 foreach (Spatial child in children)
3833 {
3834 if (!(child is Zone_Field) && _x == child.x && _y == child.y)
3835 {
3836 return child as Zone;
3837 }
3838 }
3839 }
3840 foreach (Spatial child2 in children)
3841 {
3842 if (_x == child2.x && _y == child2.y)
3843 {
3844 return child2 as Zone;
3845 }
3846 }
3847 return null;
3848 }
3849
3850 public bool IsCrime(Chara c, Act act)
3851 {
3852 if (act.IsHostileAct && HasLaw && !IsPCFaction && c.IsPC)
3853 {
3854 return true;
3855 }
3856 return false;
3857 }
3858
3859 public void RefreshCriminal()
3860 {
3861 bool flag = EClass.player.IsCriminal && HasLaw && !AllowCriminal && !IsPCFaction;
3862 Hostility hostility = (flag ? Hostility.Neutral : Hostility.Friend);
3863 foreach (Chara chara in EClass._map.charas)
3864 {
3865 if (chara.trait is TraitGuard)
3866 {
3867 chara.hostility = hostility;
3868 if (!flag && chara.enemy != null && chara.enemy.IsPCParty)
3869 {
3870 chara.SetEnemy();
3871 }
3872 }
3873 }
3874 }
3875
3876 public void RefreshListCitizen()
3877 {
3878 if (base.lv != 0)
3879 {
3880 return;
3881 }
3882 dictCitizen.Clear();
3883 foreach (Chara item in map.charas.Concat(map.deadCharas))
3884 {
3885 if (item.trait.IsCitizen && !item.IsGlobal && !item.isSubsetCard)
3886 {
3887 dictCitizen[item.uid] = item.Name;
3888 }
3889 }
3890 }
3891
3892 public virtual void SetAlarm(bool enable)
3893 {
3894 base.isAlarmSet = enable;
3895 if (enable)
3896 {
3897 foreach (Chara chara in EClass._map.charas)
3898 {
3899 if (!chara.IsPCFactionOrMinion)
3900 {
3901 chara.SetHostility(Hostility.Enemy);
3902 }
3903 }
3904 Msg.Say("alarm");
3905 Msg.Say("alarm2");
3906 SE.Play("alarm");
3907 return;
3908 }
3909 foreach (Chara chara2 in EClass._map.charas)
3910 {
3911 if (!chara2.IsPCFactionOrMinion)
3912 {
3913 chara2.SetHostility(Hostility.Neutral);
3914 }
3915 }
3916 }
3917
3918 public void ModInfluence(int a)
3919 {
3920 base.influence += a;
3921 if (a > 0)
3922 {
3923 Msg.Say("gainInfluence", Name, a.ToString() ?? "");
3924 }
3925 Tutorial.Reserve("influence");
3926 }
3927
3928 public void ModDevelopment(int a)
3929 {
3930 base.development += a;
3931 if (a > 0)
3932 {
3933 Msg.Say("gainDevelopment", Name, a.ToString() ?? "");
3934 }
3935 }
3936
3937 public void UpdateQuests(bool force = false)
3938 {
3939 if (!IsPCFaction && (!(this is Zone_Town) || base.lv != 0))
3940 {
3941 return;
3942 }
3943 Debug.Log("Updating Quest:" + force);
3944 List<SourceQuest.Row> list = EClass.sources.quests.rows.Where((SourceQuest.Row a) => a.group == "random").ToList();
3945 int num = 0;
3946 foreach (Chara item in map.charas.Concat(map.deadCharas))
3947 {
3948 if (item.quest != null && !EClass.game.quests.list.Contains(item.quest))
3949 {
3950 if (item.quest.IsExpired || completedQuests.Contains(item.quest.uid) || force)
3951 {
3952 item.quest = null;
3953 }
3954 else
3955 {
3956 num++;
3957 }
3958 }
3959 }
3960 if (EClass._zone.dateQuest > EClass.world.date.GetRaw() && !force)
3961 {
3962 return;
3963 }
3964 EClass._zone.dateQuest = EClass.world.date.GetRaw() + 1440;
3965 int maxQuest = 3;
3966 Rand.UseSeed(base.uid + EClass.player.stats.days / 7 % 100, delegate
3967 {
3968 maxQuest = 4 + EClass.rnd(4);
3969 });
3970 completedQuests.Clear();
3971 List<Zone> list2 = Quest.ListDeliver();
3972 List<Tuple<string, int>> listTag = new List<Tuple<string, int>>();
3973 string[] array = EClass._zone.source.questTag;
3975 {
3976 array = new string[9] { "supply/8", "deliver/7", "food/8", "escort/4", "deliver/4", "monster/0", "war/0", "farm/0", "music/0" };
3977 }
3978 string[] array2 = array;
3979 for (int num2 = 0; num2 < array2.Length; num2++)
3980 {
3981 string[] array3 = array2[num2].Split('/');
3982 listTag.Add(new Tuple<string, int>(array3[0], array3[1].ToInt()));
3983 }
3984 for (int num3 = 0; num3 < map.charas.Count * 2; num3++)
3985 {
3986 if (num > maxQuest)
3987 {
3988 break;
3989 }
3990 if (num > 15)
3991 {
3992 break;
3993 }
3994 Chara chara = map.charas.RandomItem();
3995 if (!chara.trait.CanGiveRandomQuest || chara.isSubsetCard || chara.homeZone != EClass._zone || chara.IsGuest() || chara.memberType == FactionMemberType.Livestock || (chara.quest != null && !force))
3996 {
3997 continue;
3998 }
3999 SourceQuest.Row row = list.RandomItemWeighted(delegate(SourceQuest.Row a)
4000 {
4001 int num4 = 1;
4002 foreach (Tuple<string, int> item2 in listTag)
4003 {
4004 if (a.tags.Contains(item2.Item1))
4005 {
4006 num4 = item2.Item2;
4007 break;
4008 }
4009 }
4010 if (!EClass._zone.IsPCFaction && a.tags.Contains("bulk"))
4011 {
4012 num4 = 0;
4013 }
4014 return a.chance * num4;
4015 });
4016 if ((!row.tags.Contains("needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame < EClass.player.fame || EClass.debug.enable))
4017 {
4018 Quest.Create(row.id, null, chara);
4019 num++;
4020 }
4021 }
4022 }
4023
4024 public List<Chara> ListMinions(Chara c)
4025 {
4026 List<Chara> list = new List<Chara>();
4027 foreach (Chara chara in EClass._map.charas)
4028 {
4029 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
4030 {
4031 list.Add(chara);
4032 }
4033 }
4034 return list;
4035 }
4036
4037 public int CountMinions(Chara c)
4038 {
4039 int num = 0;
4040 foreach (Chara chara in EClass._map.charas)
4041 {
4042 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
4043 {
4044 num++;
4045 }
4046 }
4047 return num;
4048 }
4049
4050 public int GetSoilCost()
4051 {
4052 int n = 0;
4053 EClass._map.bounds.ForeachCell(delegate(Cell c)
4054 {
4055 n += c.sourceObj.costSoil;
4056 });
4057 return n / 10;
4058 }
4059
4060 public void SpawnLostItems()
4061 {
4062 for (int i = 0; i < 2 + EClass.rnd(4); i++)
4063 {
4064 Point point = GetPos();
4065 if (point == null)
4066 {
4067 continue;
4068 }
4069 if (EClass.rnd(30) == 0)
4070 {
4071 Thing thing = ThingGen.Create("purse");
4072 thing.isLostProperty = true;
4073 thing.things.DestroyAll();
4074 int num = (thing.c_lockLv = EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50)));
4075 thing.Add("money", EClass.rndHalf(num * 60 + 1000));
4076 if (EClass.rnd(2) == 0)
4077 {
4078 thing.Add("plat", EClass.rnd(4));
4079 }
4080 else
4081 {
4082 thing.Add("medal", EClass.rnd(2));
4083 }
4084 EClass._zone.AddCard(thing, point);
4085 }
4086 else
4087 {
4089 }
4090 }
4091 static Point GetPos()
4092 {
4093 for (int j = 0; j < 10; j++)
4094 {
4095 Point randomPoint = EClass._zone.bounds.GetRandomPoint();
4096 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
4097 {
4098 return randomPoint;
4099 }
4100 }
4101 return null;
4102 }
4103 }
4104
4105 public void ApplyBackerPet(bool draw)
4106 {
4107 bool flag = this is Zone_Yowyn && base.lv == -1;
4108 IList<SourceBacker.Row> list = EClass.sources.backers.listPet.Copy();
4109 list.Shuffle();
4111 {
4112 list.ForeachReverse(delegate(SourceBacker.Row a)
4113 {
4114 if (EClass.player.doneBackers.Contains(a.id))
4115 {
4116 list.Remove(a);
4117 }
4118 });
4119 }
4120 foreach (Chara chara in EClass._map.charas)
4121 {
4122 if (chara.IsGlobal || chara.IsMinion)
4123 {
4124 continue;
4125 }
4126 if (chara.isBackerContent)
4127 {
4128 if (chara.sourceBacker.isStatic != 0)
4129 {
4130 continue;
4131 }
4132 if (chara.id != "follower")
4133 {
4134 chara.RemoveBacker();
4135 }
4136 }
4137 if ((flag && chara.race.id != "cat") || (!EClass.debug.enable && EClass.rnd((!flag) ? (draw ? 3 : 10) : (draw ? 1 : 2)) != 0))
4138 {
4139 continue;
4140 }
4141 foreach (SourceBacker.Row item in list)
4142 {
4143 if (item.chara == chara.id)
4144 {
4145 chara.ApplyBacker(item.id);
4146 list.Remove(item);
4147 break;
4148 }
4149 }
4150 }
4151 }
4152
4153 public FortuneRollData GetOrCreateFortuneRollData(bool refresh = true)
4154 {
4155 if (fortuneRoll == null)
4156 {
4157 fortuneRoll = new FortuneRollData();
4158 fortuneRoll.seed = EClass._zone.uid * 100 + EClass.game.seed;
4159 }
4160 if (refresh || fortuneRoll.count == 0)
4161 {
4162 fortuneRoll.Refresh();
4163 }
4164 return fortuneRoll;
4165 }
4166}
BossType
Definition: BossType.cs:2
CTAG
Definition: CTAG.cs:2
@ seed
ClearInventoryType
ContainerFlag
Definition: ContainerFlag.cs:5
CureType
Definition: CureType.cs:2
if(!match.Success)
GoalListType
Definition: GoalListType.cs:2
Hostility
Definition: Hostility.cs:2
MinionType
Definition: MinionType.cs:2
mods...$ Installed
Definition: ModManager.cs:988
NameStyle
Definition: NameStyle.cs:2
PlaceState
Definition: PlaceState.cs:2
Rarity
Definition: Rarity.cs:2
RescueState
Definition: RescueState.cs:2
ShopType
Definition: ShopType.cs:2
SpawnHostility
SpawnPosition
Definition: SpawnPosition.cs:2
VisitorState
Definition: VisitorState.cs:2
ZoneScaleType
Definition: ZoneScaleType.cs:2
virtual void OnSimulatePosition()
Definition: AIAct.cs:604
void SimulateZone(int days)
Definition: AIAct.cs:592
Definition: ACT.cs:62
virtual bool IsHostileAct
Definition: ACT.cs:129
BaseArea.AccessType accessType
Definition: AreaData.cs:42
static int indexFollower
AccessType
Definition: BaseArea.cs:9
AreaData data
Definition: BaseArea.cs:29
void WaitForEndOfFrame(Action action)
Definition: BaseCore.cs:61
Version version
Definition: BaseCore.cs:17
List< SpawnListChara > chara
string GetRandomCharaId()
void Populate(Point point, bool interior=false, float mtpDensity=1f)
static void Set(CardBlueprint _bp=null)
Thing container_shipping
Definition: CardManager.cs:52
GlobalCharaList globalCharas
Definition: CardManager.cs:46
List< Chara > ListGlobalChara(Zone z)
Definition: CardManager.cs:103
override void OnLeaveScreen()
void KillActor()
int quality
Definition: CardRow.cs:19
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
MinionType c_minionType
Definition: Card.cs:1015
Props props
Definition: Card.cs:52
bool IsPCFactionOrMinion
Definition: Card.cs:2342
bool IsDecayed
Definition: Card.cs:2357
virtual bool isThing
Definition: Card.cs:2133
bool isSummon
Definition: Card.cs:713
virtual Chara Chara
Definition: Card.cs:2122
virtual void OnSimulateHour(VirtualDate date)
Definition: Card.cs:7077
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3928
string id
Definition: Card.cs:36
SourceBacker.Row sourceBacker
Definition: Card.cs:955
bool isSubsetCard
Definition: Card.cs:749
bool isRestrained
Definition: Card.cs:569
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6645
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3217
int c_lockLv
Definition: Card.cs:991
Card AddCard(Card c)
Definition: Card.cs:3266
bool isSale
Definition: Card.cs:869
int c_uidMaster
Definition: Card.cs:1489
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3280
int hp
Definition: Card.cs:245
Rarity rarity
Definition: Card.cs:317
ICardParent parent
Definition: Card.cs:56
bool hasSpawned
Definition: Card.cs:905
PlaceState placeState
Definition: Card.cs:86
bool HasTag(CTAG tag)
Definition: Card.cs:2728
Point pos
Definition: Card.cs:60
void DecayNatural(int hour=1)
Definition: Card.cs:7086
int uid
Definition: Card.cs:125
virtual void HealHP(long a, HealSource origin=HealSource.None)
Definition: Card.cs:4188
Trait trait
Definition: Card.cs:54
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2649
void RemoveBacker()
Definition: Card.cs:7537
int c_idBacker
Definition: Card.cs:1477
void PlayAnimeLoot()
Definition: Card.cs:6674
void Destroy()
Definition: Card.cs:5314
ThingContainer things
Definition: Card.cs:39
bool IsInstalled
Definition: Card.cs:2451
virtual bool isChara
Definition: Card.cs:2135
virtual Thing Thing
Definition: Card.cs:2110
int Evalue(int ele)
Definition: Card.cs:2704
bool isOn
Definition: Card.cs:545
bool TryStackTo(Thing to)
Definition: Card.cs:3578
Card Install()
Definition: Card.cs:3922
void ApplyBacker(int bid)
Definition: Card.cs:7501
void SetRandomDir()
Definition: Card.cs:6707
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3257
SourceCategory.Row category
Definition: Card.cs:2101
bool IsContainer
Definition: Card.cs:2141
CardRenderer renderer
Definition: Card.cs:64
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6383
bool isBackerContent
Definition: Card.cs:952
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7324
List< Thing > things
Definition: CellDetail.cs:11
Definition: Cell.cs:7
Room room
Definition: Cell.cs:122
byte decal
Definition: Cell.cs:70
bool IsTopWaterAndNoSnow
Definition: Cell.cs:748
bool IsFarmField
Definition: Cell.cs:766
BiomeProfile biome
Definition: Cell.cs:1115
bool isModified
Definition: Cell.cs:450
byte light
Definition: Cell.cs:80
GrowSystem growth
Definition: Cell.cs:247
CellDetail detail
Definition: Cell.cs:112
bool HasRoof
Definition: Cell.cs:684
SourceObj.Row sourceObj
Definition: Cell.cs:1112
Point GetPoint()
Definition: Cell.cs:1141
bool CanGrowWeed
Definition: Cell.cs:778
int index
Definition: Cell.cs:136
bool hasDoor
Definition: Cell.cs:279
void AddRandom()
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
Definition: CharaGen.cs:22
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Definition: Chara.cs:10
BaseCondition GetCondition(string idCon)
Definition: Chara.cs:10109
new TraitChara trait
Definition: Chara.cs:511
Hostility OriginalHostility
Definition: Chara.cs:477
AIAct ai
Definition: Chara.cs:208
void ValidateWorks()
Definition: Chara.cs:9847
ConSuspend conSuspend
Definition: Chara.cs:106
bool CanRevive()
Definition: Chara.cs:5477
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9881
Faction faction
Definition: Chara.cs:433
override bool IsPC
Definition: Chara.cs:632
Chara host
Definition: Chara.cs:35
override bool IsGlobal
Definition: Chara.cs:630
override bool IsPCParty
Definition: Chara.cs:635
bool HasCondition(string alias)
Definition: Chara.cs:10053
AIAct SetAI(AIAct g)
Definition: Chara.cs:9496
override bool IsMinion
Definition: Chara.cs:647
Point orgPos
Definition: Chara.cs:23
override bool IsPCFaction
Definition: Chara.cs:691
Goal GetGoalWork()
Definition: Chara.cs:9431
override int MaxHP
Definition: Chara.cs:728
Zone currentZone
Definition: Chara.cs:261
Goal GetGoalHobby()
Definition: Chara.cs:9444
SourceChara.Row source
Definition: Chara.cs:164
Stats mana
Definition: Chara.cs:1215
Stats stamina
Definition: Chara.cs:1207
void TryRestock(bool onCreate)
Definition: Chara.cs:4991
GlobalData global
Definition: Chara.cs:78
bool IsHomeMember()
Definition: Chara.cs:7018
Chara master
Definition: Chara.cs:90
void Revive(Point p=null, bool msg=false)
Definition: Chara.cs:5503
Zone homeZone
Definition: Chara.cs:273
bool IsGuest()
Definition: Chara.cs:7043
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:8724
override void SetDir(int d)
Definition: Chara.cs:3789
Religion faith
Definition: Chara.cs:445
Chara enemy
Definition: Chara.cs:88
CharaAbility ability
Definition: Chara.cs:430
bool IsInActiveZone
Definition: Chara.cs:887
Chara SetEnemy(Chara c=null)
Definition: Chara.cs:6718
FactionBranch homeBranch
Definition: Chara.cs:1115
void ChooseNewGoal()
Definition: Chara.cs:9367
Hostility hostility
Definition: Chara.cs:297
bool IsHostile()
Definition: Chara.cs:6952
bool isDead
Definition: Chara.cs:395
void SetFaith(string id)
Definition: Chara.cs:1786
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
Definition: Chara.cs:10158
Chara SetHostility(Hostility h)
Definition: Chara.cs:1507
void MoveZone(string alias)
Definition: Chara.cs:3583
SourceRace.Row race
Definition: Chara.cs:470
void AddSpawn(string id)
Definition: CodexManager.cs:65
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:578
void SetBGMInterval()
Definition: CoreConfig.cs:1039
bool test
Definition: CoreDebug.cs:186
bool enable
Definition: CoreDebug.cs:302
static string ZoneSave
Definition: CorePath.cs:192
BiomeProfile Water
Definition: CoreRef.cs:155
BiomeProfile Sand
Definition: CoreRef.cs:153
Crawler start
Definition: CoreRef.cs:217
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:388
Biomes biomes
Definition: CoreRef.cs:344
Crawlers crawlers
Definition: CoreRef.cs:346
CoreRef refs
Definition: Core.cs:51
bool IsGameStarted
Definition: Core.cs:87
CoreConfig config
Definition: Core.cs:70
static Crawler Create(string id)
Definition: Crawler.cs:193
bool CrawlUntil(Map map, Func< Point > onStart, int tries, Func< Result, bool > canComplete, Action onFail=null)
Definition: Crawler.cs:59
Definition: DNA.cs:9
Type
Definition: DNA.cs:11
int hour
Definition: Date.cs:74
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
int month
Definition: Date.cs:50
int day
Definition: Date.cs:62
bool IsExpired(int time)
Definition: Date.cs:338
bool IsNight
Definition: Date.cs:112
bool IsWinter
Definition: Date.cs:192
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static int curve(long _a, int start, int step, int rate=75)
Definition: EClass.cs:69
static Scene scene
Definition: EClass.cs:31
static GameData gamedata
Definition: EClass.cs:37
static Core core
Definition: EClass.cs:7
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
static SourceManager sources
Definition: EClass.cs:43
static float rndf(float a)
Definition: EClass.cs:102
static FactionBranch Branch
Definition: EClass.cs:23
static int rndHalf(int a)
Definition: EClass.cs:97
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static SoundManager Sound
Definition: EClass.cs:47
static UI ui
Definition: EClass.cs:17
static GameSetting setting
Definition: EClass.cs:35
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:80
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1163
void Initialize(EloMap _elomap)
Definition: EloMapActor.cs:28
EloMap elomap
Definition: EloMapActor.cs:7
string idZoneProfile
Definition: EloMap.cs:68
Definition: EloMap.cs:8
void SetZone(int gx, int gy, Zone z, bool updateMesh=false)
Definition: EloMap.cs:234
TileInfo GetTileInfo(int gx, int gy)
Definition: EloMap.cs:286
void OnAfterSimulate()
int Evalue(int ele)
void OnUnclaimZone()
List< Chara > members
PolicyManager policies
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
void AddMemeber(Chara c)
List< GodStatueData > godStatues
Definition: GameData.cs:9
BalanceSetting balance
Definition: GameSetting.cs:356
bool isLoading
Definition: Game.cs:242
ReligionManager religions
Definition: Game.cs:159
SpatialManager spatials
Definition: Game.cs:153
CardManager cards
Definition: Game.cs:156
Zone activeZone
Definition: Game.cs:252
bool IsSurvival
Definition: Game.cs:276
QuestManager quests
Definition: Game.cs:183
int seed
Definition: Game.cs:201
Zone StartZone
Definition: Game.cs:278
ZoneTransition transition
Definition: GlobalData.cs:6
Definition: Goal.cs:4
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:456
virtual bool IsMature
Definition: GrowSystem.cs:117
Stage stage
Definition: GrowSystem.cs:115
virtual bool NeedSunlight
Definition: GrowSystem.cs:107
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:292
Definition: IO.cs:10
static void CreateTempDirectory(string path=null)
Definition: IO.cs:419
static void DeleteDirectory(string path)
Definition: IO.cs:392
static void Copy(string fromPath, string toPath)
Definition: IO.cs:309
static string TempPath
Definition: IO.cs:63
static void SaveFile(string path, object obj, bool compress=false, JsonSerializerSettings setting=null)
Definition: IO.cs:88
static void DeleteTempDirectory(string path=null)
Definition: IO.cs:424
static void CopyDir(string sourceDirectory, string targetDirectory, Func< string, bool > funcExclude=null)
Definition: IO.cs:276
Definition: Lang.cs:7
static string[] GetList(string id)
Definition: Lang.cs:113
static bool keepBGM
Definition: LayerDrama.cs:10
int idBGM
Definition: Lot.cs:16
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:56
void ForeachCell(Action< Cell > action)
Definition: MapBounds.cs:279
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Definition: MapBounds.cs:182
int x
Definition: MapBounds.cs:8
Point GetRandomSpace(int width, int height, int tries=100)
Definition: MapBounds.cs:246
Point GetCenterPos()
Definition: MapBounds.cs:52
Point GetRandomPoint()
Definition: MapBounds.cs:97
bool shufflePL
Definition: MapConfig.cs:50
bool IsValidVersion()
Definition: MapMetaData.cs:31
Definition: Map.cs:13
bool IsIndoor
Definition: Map.cs:136
void ResetEditorPos()
Definition: Map.cs:362
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
Definition: Map.cs:2376
List< Thing > things
Definition: Map.cs:52
PropsManager props
Definition: Map.cs:94
PlantData AddPlant(Point pos, Thing seed)
Definition: Map.cs:2113
RoomManager rooms
Definition: Map.cs:34
static MapMetaData GetMetaData(string pathZip)
Definition: Map.cs:850
Version version
Definition: Map.cs:31
MapConfig config
Definition: Map.cs:40
List< Chara > charas
Definition: Map.cs:84
void RevealAll(bool reveal=true)
Definition: Map.cs:1018
void RefreshAllTiles()
Definition: Map.cs:2269
MapBounds bounds
Definition: Map.cs:55
Definition: Msg.cs:5
static string SayRaw(string text)
Definition: Msg.cs:118
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: NoGoal.cs:4
static PathManager Instance
Definition: PathManager.cs:16
bool IsPathClear(Point origin, Point dest, IPathfindWalker walker, int radius)
Definition: PathManager.cs:47
int santa
Definition: Player.cs:604
int days
Definition: Player.cs:75
Flags flags
Definition: Player.cs:1173
CodexManager codex
Definition: Player.cs:1194
Stats stats
Definition: Player.cs:1095
bool isAutoFarming
Definition: Player.cs:1263
List< Chara > listCarryoverMap
Definition: Player.cs:1305
HashSet< int > doneBackers
Definition: Player.cs:1152
Zone nextZone
Definition: Player.cs:1309
Point lastZonePos
Definition: Player.cs:1182
int seedShrine
Definition: Player.cs:1017
int fame
Definition: Player.cs:957
bool simulatingZone
Definition: Player.cs:1261
Definition: Point.cs:9
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:930
Point Set(int _x, int _z)
Definition: Point.cs:499
bool IsBlocked
Definition: Point.cs:359
List< Thing > Things
Definition: Point.cs:334
int x
Definition: Point.cs:36
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:620
int z
Definition: Point.cs:39
bool IsSync
Definition: Point.cs:340
void SetFloor(int idMat=0, int idFloor=0)
Definition: Point.cs:925
bool HasThing
Definition: Point.cs:247
bool Equals(int _x, int _z)
Definition: Point.cs:962
bool IsValid
Definition: Point.cs:84
bool HasObj
Definition: Point.cs:133
bool ForeachNearestPoint(Func< Point, bool > endFunc, bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int maxRange=30)
Definition: Point.cs:692
Point Clamp(bool useBounds=false)
Definition: Point.cs:1010
bool HasBlock
Definition: Point.cs:137
bool IsInBounds
Definition: Point.cs:100
Cell cell
Definition: Point.cs:47
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1142
GrowSystem growth
Definition: Point.cs:73
bool HasChara
Definition: Point.cs:234
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:770
bool IsActive(int id, int days=-1)
PropsInstalled installed
Definition: PropsManager.cs:8
TraitManager traits
Definition: Props.cs:18
Thing Find(int uid)
Definition: Props.cs:395
List< Thing > containers
Definition: Props.cs:22
List< Quest > list
Definition: QuestManager.cs:11
Definition: Quest.cs:7
static List< Zone > ListDeliver()
Definition: Quest.cs:259
static Quest Create(string _id, string _idPerson=null, Chara c=null, bool assignQuest=true)
Definition: Quest.cs:241
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:49
static void UseSeed(int seed, Action action)
Definition: Rand.cs:24
static void SetSeed(int a=-1)
Definition: Rand.cs:44
Definition: Recipe.cs:7
Definition: Region.cs:8
EloMap elomap
Definition: Region.cs:9
Dictionary< string, Religion > dictAll
Religion GetRandomReligion(bool onlyJoinable=true, bool includeMinor=false)
int LV
Definition: RenderRow.cs:22
void AssignCharas()
Definition: RoomManager.cs:39
Definition: Room.cs:4
Lot lot
Definition: Room.cs:21
static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect)
static string SaveFilePanel(string title, string directory, string defaultName, string extension)
EloMapActor elomapActor
Definition: Scene.cs:101
void Clear()
Definition: Scene.cs:354
void RemoveActorEx(Card c)
Definition: Scene.cs:1033
EloMap elomap
Definition: Scene.cs:149
List< Row > listFollower
List< Row > listPet
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceCard cards
SourceObj objs
SourceBacker backers
SourceElement elements
SourceQuest quests
string[] tags
Definition: SourceQuest.cs:23
void Remove(Spatial s)
Zone Find(string id)
int mapX
Definition: Spatial.cs:460
int lv
Definition: Spatial.cs:142
bool isRandomSite
Definition: Spatial.cs:334
int uid
Definition: Spatial.cs:70
virtual bool IsRegion
Definition: Spatial.cs:515
virtual string Name
Definition: Spatial.cs:509
int dateQuest
Definition: Spatial.cs:286
virtual void Destroy()
Definition: Spatial.cs:690
SourceZone.Row source
Definition: Spatial.cs:453
bool isConquered
Definition: Spatial.cs:382
int y
Definition: Spatial.cs:106
Zone FindDeepestZone()
Definition: Spatial.cs:715
int mapY
Definition: Spatial.cs:472
int x
Definition: Spatial.cs:94
Zone FindZone(int lv)
Definition: Spatial.cs:728
static SpawnList Get(string id, Func< SourceChara.Row, bool > func)
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
Definition: SpawnList.cs:18
CardRow Select(int lv=-1, int levelRange=-1)
Definition: SpawnList.cs:139
static SpawnSetting Default
Definition: SpawnSetting.cs:33
static SpawnSetting Fish()
static SpawnSetting HomeGuest(int lv)
static SpawnSetting Evolved(int fixedLv=-1)
Definition: SpawnSetting.cs:37
virtual void Mod(int a)
Definition: Stats.cs:135
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
void DestroyAll(Func< Thing, bool > funcExclude=null)
Thing Find(int uid)
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:536
bool IsSharedContainer
Definition: Thing.cs:110
virtual bool CanGiveRandomQuest
Definition: TraitChara.cs:123
virtual bool CanAutoRevive
Definition: TraitChara.cs:21
virtual bool IsFor(Zone z)
static bool CanTagSale(Card t, bool insideContainer=false)
Definition: TraitSalesTag.cs:9
static Thing MakeSeed(string idSource)
Definition: TraitSeed.cs:105
static void LevelSeed(Thing t, SourceObj.Row obj, int num)
Definition: TraitSeed.cs:184
Definition: Trait.cs:7
virtual string IDActorEx
Definition: Trait.cs:187
virtual void TryToggle()
Definition: Trait.cs:1339
Point GetRandomPoint(Func< Point, bool > func=null, Chara accessChara=null)
Definition: Trait.cs:850
virtual ShopType ShopType
Definition: Trait.cs:534
string GetParam(int i, string def=null)
Definition: Trait.cs:591
Point GetPoint()
Definition: Trait.cs:845
virtual int Electricity
Definition: Trait.cs:119
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true, bool allowChara=true)
Definition: Trait.cs:868
virtual int Decay
Definition: Trait.cs:123
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
Definition: UINote.cs:6
static bool IsActive
Definition: VirtualDate.cs:13
bool IsRealTime
Definition: VirtualDate.cs:7
void SimulateHour()
Definition: VirtualDate.cs:66
void BuildSunMap()
Definition: VirtualDate.cs:54
HashSet< int > sunMap
Definition: VirtualDate.cs:9
FilterResult IsFilterPass(string text)
Definition: Window.cs:498
ContainerFlag flag
Definition: Window.cs:267
HashSet< int > cats
Definition: Window.cs:119
bool userFilter
Definition: Window.cs:132
bool noRotten
Definition: Window.cs:439
bool onlyRottable
Definition: Window.cs:451
bool advDistribution
Definition: Window.cs:427
Definition: Window.cs:13
GameDate date
Definition: World.cs:6
static ZoneProfile Load(string id)
Definition: ZoneProfile.cs:73
EnterState state
Definition: Zone.cs:12
virtual bool IsNefia
Definition: Zone.cs:292
Zone GetTopZone()
Definition: Zone.cs:2115
bool IsPCFactionOrTent
Definition: Zone.cs:483
FactionBranch branch
Definition: Zone.cs:34
Card AddThing(string id, int x, int z)
Definition: Zone.cs:2149
void RefreshPlaylist()
Definition: Zone.cs:3304
void SetBGM(List< int > ids, bool refresh=true, float fadeDuration=0f)
Definition: Zone.cs:3262
MapBounds bounds
Definition: Zone.cs:52
bool IsInstance
Definition: Zone.cs:496
void ClearZones(Zone current=null)
Definition: Zone.cs:2084
Chara SpawnMob(string id, Point pos=null)
Definition: Zone.cs:2988
void RemoveCard(Card t)
Definition: Zone.cs:2199
override int DangerLv
Definition: Zone.cs:115
bool IsPCFaction
Definition: Zone.cs:480
ZoneInstance instance
Definition: Zone.cs:58
Card AddCard(Card t, Point point)
Definition: Zone.cs:2159
void RemoveCard(Card c)
NoteMode
Definition: IInspect.cs:7
bool IsBelow(int _major, int _minor, int _batch)
Definition: Version.cs:49
int GetInt()
Definition: Version.cs:39