Elin Modding Docs Doc
Loading...
Searching...
No Matches
Zone.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using System.Runtime.CompilerServices;
6using Dungen;
7using Ionic.Zip;
8using Newtonsoft.Json;
9using SFB;
10using UnityEngine;
11
12// Token: 0x0200073D RID: 1853
14{
15 // Token: 0x1700102F RID: 4143
16 // (get) Token: 0x060034FB RID: 13563 RVA: 0x0011D678 File Offset: 0x0011B878
17 // (set) Token: 0x060034FC RID: 13564 RVA: 0x0011D68A File Offset: 0x0011B88A
18 public Chara Boss
19 {
20 get
21 {
22 return EClass._map.FindChara(base.uidBoss);
23 }
24 set
25 {
26 base.uidBoss = ((value != null) ? value.uid : 0);
27 }
28 }
29
30 // Token: 0x17001030 RID: 4144
31 // (get) Token: 0x060034FD RID: 13565 RVA: 0x0011D6A0 File Offset: 0x0011B8A0
32 public override int DangerLv
33 {
34 get
35 {
36 if (this.GetTopZone() != this)
37 {
38 return this.GetTopZone().DangerLv + Mathf.Abs(base.lv) - 1;
39 }
40 return (int)Mathf.Max(1f, (float)base._dangerLv + MathF.Abs((float)base.lv) + (float)this.DangerLvFix);
41 }
42 }
43
44 // Token: 0x17001031 RID: 4145
45 // (get) Token: 0x060034FE RID: 13566 RVA: 0x0011D6F7 File Offset: 0x0011B8F7
46 public virtual bool DisableRooms
47 {
48 get
49 {
50 return false;
51 }
52 }
53
54 // Token: 0x17001032 RID: 4146
55 // (get) Token: 0x060034FF RID: 13567 RVA: 0x0011D6FA File Offset: 0x0011B8FA
56 public int HourSinceLastActive
57 {
58 get
59 {
60 return EClass.world.date.GetElapsedHour(base.lastActive);
61 }
62 }
63
64 // Token: 0x17001033 RID: 4147
65 // (get) Token: 0x06003500 RID: 13568 RVA: 0x0011D711 File Offset: 0x0011B911
66 public int MinsSinceLastActive
67 {
68 get
69 {
70 return EClass.world.date.GetElapsedMins(base.lastActive);
71 }
72 }
73
74 // Token: 0x17001034 RID: 4148
75 // (get) Token: 0x06003501 RID: 13569 RVA: 0x0011D728 File Offset: 0x0011B928
76 public virtual string pathExport
77 {
78 get
79 {
80 return CorePath.ZoneSave + this.idExport.IsEmpty("_new") + ".z";
81 }
82 }
83
84 // Token: 0x17001035 RID: 4149
85 // (get) Token: 0x06003502 RID: 13570 RVA: 0x0011D74C File Offset: 0x0011B94C
86 public BiomeProfile biome
87 {
88 get
89 {
90 BiomeProfile result;
91 if ((result = this._biome) == null)
92 {
93 result = (this._biome = EClass.core.refs.biomes.dict[this.IdBiome]);
94 }
95 return result;
96 }
97 }
98
99 // Token: 0x17001036 RID: 4150
100 // (get) Token: 0x06003503 RID: 13571 RVA: 0x0011D78B File Offset: 0x0011B98B
101 public virtual string IdBiome
102 {
103 get
104 {
105 return this.map.config.idBiome.IsEmpty(base.source.idBiome);
106 }
107 }
108
109 // Token: 0x06003504 RID: 13572 RVA: 0x0011D7AD File Offset: 0x0011B9AD
110 public virtual string GetDungenID()
111 {
112 return null;
113 }
114
115 // Token: 0x17001037 RID: 4151
116 // (get) Token: 0x06003505 RID: 13573 RVA: 0x0011D7B0 File Offset: 0x0011B9B0
117 public virtual string IDGenerator
118 {
119 get
120 {
121 return null;
122 }
123 }
124
125 // Token: 0x17001038 RID: 4152
126 // (get) Token: 0x06003506 RID: 13574 RVA: 0x0011D7B3 File Offset: 0x0011B9B3
127 public virtual string TextWidgetDate
128 {
129 get
130 {
131 return "";
132 }
133 }
134
135 // Token: 0x17001039 RID: 4153
136 // (get) Token: 0x06003507 RID: 13575 RVA: 0x0011D7BA File Offset: 0x0011B9BA
137 public MapGenerator Generator
138 {
139 get
140 {
141 return ResourceCache.Load<MapGenerator>("DunGenProfile/Generator_" + this.GetDungenID());
142 }
143 }
144
145 // Token: 0x1700103A RID: 4154
146 // (get) Token: 0x06003508 RID: 13576 RVA: 0x0011D7D1 File Offset: 0x0011B9D1
147 public virtual string IdProfile
148 {
149 get
150 {
151 return this.idProfile.IsEmpty(base.source.idProfile);
152 }
153 }
154
155 // Token: 0x1700103B RID: 4155
156 // (get) Token: 0x06003509 RID: 13577 RVA: 0x0011D7E9 File Offset: 0x0011B9E9
157 public virtual string IDPlayList
158 {
159 get
160 {
161 return base.source.idPlaylist.IsEmpty((base.lv != 0) ? "Underground" : null);
162 }
163 }
164
165 // Token: 0x1700103C RID: 4156
166 // (get) Token: 0x0600350A RID: 13578 RVA: 0x0011D80B File Offset: 0x0011BA0B
167 public virtual string IDPlaylistOverwrite
168 {
169 get
170 {
171 return null;
172 }
173 }
174
175 // Token: 0x1700103D RID: 4157
176 // (get) Token: 0x0600350B RID: 13579 RVA: 0x0011D80E File Offset: 0x0011BA0E
177 public virtual string IDHat
178 {
179 get
180 {
181 return null;
182 }
183 }
184
185 // Token: 0x1700103E RID: 4158
186 // (get) Token: 0x0600350C RID: 13580 RVA: 0x0011D811 File Offset: 0x0011BA11
187 public virtual string IDBaseLandFeat
188 {
189 get
190 {
191 return base.Tile.source.trait[0];
192 }
193 }
194
195 // Token: 0x1700103F RID: 4159
196 // (get) Token: 0x0600350D RID: 13581 RVA: 0x0011D828 File Offset: 0x0011BA28
197 public virtual string idExport
198 {
199 get
200 {
201 if (base.source.idFile.Length != 0)
202 {
203 return base.source.idFile[this.fileVariation] + ((base.lv == 0) ? "" : ("_F" + base.lv.ToString()));
204 }
205 return "";
206 }
207 }
208
209 // Token: 0x17001040 RID: 4160
210 // (get) Token: 0x0600350E RID: 13582 RVA: 0x0011D888 File Offset: 0x0011BA88
211 public string pathTemp
212 {
213 get
214 {
215 return GameIO.pathTemp + base.uid.ToString() + "/";
216 }
217 }
218
219 // Token: 0x17001041 RID: 4161
220 // (get) Token: 0x0600350F RID: 13583 RVA: 0x0011D8B2 File Offset: 0x0011BAB2
221 public Region Region
222 {
223 get
224 {
225 return (this as Region) ?? (this.parent as Region);
226 }
227 }
228
229 // Token: 0x17001042 RID: 4162
230 // (get) Token: 0x06003510 RID: 13584 RVA: 0x0011D8C9 File Offset: 0x0011BAC9
231 public Zone ParentZone
232 {
233 get
234 {
235 return this.parent as Zone;
236 }
237 }
238
239 // Token: 0x17001043 RID: 4163
240 // (get) Token: 0x06003511 RID: 13585 RVA: 0x0011D8D6 File Offset: 0x0011BAD6
241 public virtual ActionMode DefaultActionMode
242 {
243 get
244 {
245 return ActionMode.Adv;
246 }
247 }
248
249 // Token: 0x17001044 RID: 4164
250 // (get) Token: 0x06003512 RID: 13586 RVA: 0x0011D8DD File Offset: 0x0011BADD
251 public virtual bool BlockBorderExit
252 {
253 get
254 {
255 return base.lv != 0;
256 }
257 }
258
259 // Token: 0x17001045 RID: 4165
260 // (get) Token: 0x06003513 RID: 13587 RVA: 0x0011D8E8 File Offset: 0x0011BAE8
261 public virtual int ExpireDays
262 {
263 get
264 {
265 return EClass.setting.balance.dateExpireRandomMap;
266 }
267 }
268
269 // Token: 0x17001046 RID: 4166
270 // (get) Token: 0x06003514 RID: 13588 RVA: 0x0011D8F9 File Offset: 0x0011BAF9
271 public virtual ZoneTransition.EnterState RegionEnterState
272 {
273 get
274 {
275 return ZoneTransition.EnterState.Dir;
276 }
277 }
278
279 // Token: 0x17001047 RID: 4167
280 // (get) Token: 0x06003515 RID: 13589 RVA: 0x0011D8FC File Offset: 0x0011BAFC
281 public virtual ZoneFeatureType FeatureType
282 {
283 get
284 {
285 return ZoneFeatureType.Default;
286 }
287 }
288
289 // Token: 0x17001048 RID: 4168
290 // (get) Token: 0x06003516 RID: 13590 RVA: 0x0011D8FF File Offset: 0x0011BAFF
291 public virtual string IDAmbience
292 {
293 get
294 {
295 if (this.IsRegion || this.map.IsIndoor)
296 {
297 return null;
298 }
299 if (!this.IsTown)
300 {
301 return "forest";
302 }
303 return "town";
304 }
305 }
306
307 // Token: 0x17001049 RID: 4169
308 // (get) Token: 0x06003517 RID: 13591 RVA: 0x0011D92B File Offset: 0x0011BB2B
309 public virtual string IDSceneTemplate
310 {
311 get
312 {
313 if (EClass._map.IsIndoor)
314 {
315 return "Indoor";
316 }
317 if (!this.IsSnowZone)
318 {
319 return "Default";
320 }
321 return "Snow";
322 }
323 }
324
325 // Token: 0x1700104A RID: 4170
326 // (get) Token: 0x06003518 RID: 13592 RVA: 0x0011D952 File Offset: 0x0011BB52
327 public virtual bool IsFestival
328 {
329 get
330 {
331 return false;
332 }
333 }
334
335 // Token: 0x1700104B RID: 4171
336 // (get) Token: 0x06003519 RID: 13593 RVA: 0x0011D955 File Offset: 0x0011BB55
337 public virtual string IDSubset
338 {
339 get
340 {
341 if (!this.IsFestival)
342 {
343 return null;
344 }
345 return "festival";
346 }
347 }
348
349 // Token: 0x1700104C RID: 4172
350 // (get) Token: 0x0600351A RID: 13594 RVA: 0x0011D966 File Offset: 0x0011BB66
351 public virtual bool IsTown
352 {
353 get
354 {
355 return false;
356 }
357 }
358
359 // Token: 0x1700104D RID: 4173
360 // (get) Token: 0x0600351B RID: 13595 RVA: 0x0011D969 File Offset: 0x0011BB69
361 public virtual bool CanBeDeliverDestination
362 {
363 get
364 {
365 return this.IsTown;
366 }
367 }
368
369 // Token: 0x1700104E RID: 4174
370 // (get) Token: 0x0600351C RID: 13596 RVA: 0x0011D971 File Offset: 0x0011BB71
371 public virtual bool CountDeepestLevel
372 {
373 get
374 {
375 return false;
376 }
377 }
378
379 // Token: 0x1700104F RID: 4175
380 // (get) Token: 0x0600351D RID: 13597 RVA: 0x0011D974 File Offset: 0x0011BB74
381 public virtual bool HasLaw
382 {
383 get
384 {
385 return false;
386 }
387 }
388
389 // Token: 0x17001050 RID: 4176
390 // (get) Token: 0x0600351E RID: 13598 RVA: 0x0011D977 File Offset: 0x0011BB77
391 public virtual bool MakeEnemiesNeutral
392 {
393 get
394 {
395 return this.IsTown || this.HasLaw;
396 }
397 }
398
399 // Token: 0x17001051 RID: 4177
400 // (get) Token: 0x0600351F RID: 13599 RVA: 0x0011D989 File Offset: 0x0011BB89
401 public virtual bool MakeTownProperties
402 {
403 get
404 {
405 return this.HasLaw;
406 }
407 }
408
409 // Token: 0x17001052 RID: 4178
410 // (get) Token: 0x06003520 RID: 13600 RVA: 0x0011D991 File Offset: 0x0011BB91
411 public virtual bool AllowCriminal
412 {
413 get
414 {
415 return !this.HasLaw;
416 }
417 }
418
419 // Token: 0x17001053 RID: 4179
420 // (get) Token: 0x06003521 RID: 13601 RVA: 0x0011D99C File Offset: 0x0011BB9C
421 public virtual bool AllowNewZone
422 {
423 get
424 {
425 return true;
426 }
427 }
428
429 // Token: 0x17001054 RID: 4180
430 // (get) Token: 0x06003522 RID: 13602 RVA: 0x0011D99F File Offset: 0x0011BB9F
431 public virtual bool WillAutoSave
432 {
433 get
434 {
435 return true;
436 }
437 }
438
439 // Token: 0x17001055 RID: 4181
440 // (get) Token: 0x06003523 RID: 13603 RVA: 0x0011D9A2 File Offset: 0x0011BBA2
441 public virtual bool RegenerateOnEnter
442 {
443 get
444 {
445 return false;
446 }
447 }
448
449 // Token: 0x17001056 RID: 4182
450 // (get) Token: 0x06003524 RID: 13604 RVA: 0x0011D9A5 File Offset: 0x0011BBA5
451 public virtual bool IsSkyLevel
452 {
453 get
454 {
455 return base.lv > 0;
456 }
457 }
458
459 // Token: 0x17001057 RID: 4183
460 // (get) Token: 0x06003525 RID: 13605 RVA: 0x0011D9B0 File Offset: 0x0011BBB0
461 public virtual bool IsUserZone
462 {
463 get
464 {
465 return false;
466 }
467 }
468
469 // Token: 0x17001058 RID: 4184
470 // (get) Token: 0x06003526 RID: 13606 RVA: 0x0011D9B3 File Offset: 0x0011BBB3
471 public virtual bool CanDigUnderground
472 {
473 get
474 {
475 return false;
476 }
477 }
478
479 // Token: 0x17001059 RID: 4185
480 // (get) Token: 0x06003527 RID: 13607 RVA: 0x0011D9B6 File Offset: 0x0011BBB6
481 public virtual bool LockExit
482 {
483 get
484 {
485 return true;
486 }
487 }
488
489 // Token: 0x1700105A RID: 4186
490 // (get) Token: 0x06003528 RID: 13608 RVA: 0x0011D9B9 File Offset: 0x0011BBB9
491 public virtual bool CanUnlockExit
492 {
493 get
494 {
495 return !this.LockExit;
496 }
497 }
498
499 // Token: 0x1700105B RID: 4187
500 // (get) Token: 0x06003529 RID: 13609 RVA: 0x0011D9C4 File Offset: 0x0011BBC4
501 public virtual int MaxLv
502 {
503 get
504 {
505 return 99999;
506 }
507 }
508
509 // Token: 0x1700105C RID: 4188
510 // (get) Token: 0x0600352A RID: 13610 RVA: 0x0011D9CB File Offset: 0x0011BBCB
511 public virtual int MinLv
512 {
513 get
514 {
515 return -99999;
516 }
517 }
518
519 // Token: 0x1700105D RID: 4189
520 // (get) Token: 0x0600352B RID: 13611 RVA: 0x0011D9D2 File Offset: 0x0011BBD2
521 public virtual bool AddPrefix
522 {
523 get
524 {
525 return false;
526 }
527 }
528
529 // Token: 0x1700105E RID: 4190
530 // (get) Token: 0x0600352C RID: 13612 RVA: 0x0011D9D5 File Offset: 0x0011BBD5
531 public virtual bool IsNefia
532 {
533 get
534 {
535 return false;
536 }
537 }
538
539 // Token: 0x1700105F RID: 4191
540 // (get) Token: 0x0600352D RID: 13613 RVA: 0x0011D9D8 File Offset: 0x0011BBD8
541 public virtual bool PetFollow
542 {
543 get
544 {
545 return true;
546 }
547 }
548
549 // Token: 0x17001060 RID: 4192
550 // (get) Token: 0x0600352E RID: 13614 RVA: 0x0011D9DB File Offset: 0x0011BBDB
551 public virtual bool RestrictBuild
552 {
553 get
554 {
555 return this is Zone_Civilized && !this.IsPCFaction;
556 }
557 }
558
559 // Token: 0x17001061 RID: 4193
560 // (get) Token: 0x0600352F RID: 13615 RVA: 0x0011D9F0 File Offset: 0x0011BBF0
561 public virtual bool KeepAllyDistance
562 {
563 get
564 {
565 return this.HasLaw || this.IsPCFaction;
566 }
567 }
568
569 // Token: 0x17001062 RID: 4194
570 // (get) Token: 0x06003530 RID: 13616 RVA: 0x0011DA02 File Offset: 0x0011BC02
571 public virtual int MaxSpawn
572 {
573 get
574 {
575 return this.map.bounds.Width * this.map.bounds.Height / 175 + 2;
576 }
577 }
578
579 // Token: 0x17001063 RID: 4195
580 // (get) Token: 0x06003531 RID: 13617 RVA: 0x0011DA2D File Offset: 0x0011BC2D
581 public int MaxRespawn
582 {
583 get
584 {
585 return (int)((float)this.MaxSpawn * this.RespawnRate) + 1;
586 }
587 }
588
589 // Token: 0x17001064 RID: 4196
590 // (get) Token: 0x06003532 RID: 13618 RVA: 0x0011DA40 File Offset: 0x0011BC40
591 public virtual float RuinChance
592 {
593 get
594 {
595 return 0.1f;
596 }
597 }
598
599 // Token: 0x17001065 RID: 4197
600 // (get) Token: 0x06003533 RID: 13619 RVA: 0x0011DA47 File Offset: 0x0011BC47
601 public virtual float OreChance
602 {
603 get
604 {
605 return 1f;
606 }
607 }
608
609 // Token: 0x17001066 RID: 4198
610 // (get) Token: 0x06003534 RID: 13620 RVA: 0x0011DA4E File Offset: 0x0011BC4E
611 public virtual float BigDaddyChance
612 {
613 get
614 {
615 return 0f;
616 }
617 }
618
619 // Token: 0x17001067 RID: 4199
620 // (get) Token: 0x06003535 RID: 13621 RVA: 0x0011DA55 File Offset: 0x0011BC55
621 public virtual float EvolvedChance
622 {
623 get
624 {
625 return 0f;
626 }
627 }
628
629 // Token: 0x17001068 RID: 4200
630 // (get) Token: 0x06003536 RID: 13622 RVA: 0x0011DA5C File Offset: 0x0011BC5C
631 public virtual float ShrineChance
632 {
633 get
634 {
635 return 0f;
636 }
637 }
638
639 // Token: 0x17001069 RID: 4201
640 // (get) Token: 0x06003537 RID: 13623 RVA: 0x0011DA63 File Offset: 0x0011BC63
641 public virtual float PrespawnRate
642 {
643 get
644 {
645 return 0f;
646 }
647 }
648
649 // Token: 0x1700106A RID: 4202
650 // (get) Token: 0x06003538 RID: 13624 RVA: 0x0011DA6A File Offset: 0x0011BC6A
651 public virtual float RespawnRate
652 {
653 get
654 {
655 return this.PrespawnRate * 0.5f;
656 }
657 }
658
659 // Token: 0x1700106B RID: 4203
660 // (get) Token: 0x06003539 RID: 13625 RVA: 0x0011DA78 File Offset: 0x0011BC78
661 public virtual int RespawnPerHour
662 {
663 get
664 {
665 return this.MaxSpawn / 5 + 1;
666 }
667 }
668
669 // Token: 0x1700106C RID: 4204
670 // (get) Token: 0x0600353A RID: 13626 RVA: 0x0011DA84 File Offset: 0x0011BC84
671 public virtual float ChanceSpawnNeutral
672 {
673 get
674 {
675 return 0.05f;
676 }
677 }
678
679 // Token: 0x1700106D RID: 4205
680 // (get) Token: 0x0600353B RID: 13627 RVA: 0x0011DA8B File Offset: 0x0011BC8B
681 public virtual bool GrowPlant
682 {
683 get
684 {
685 return base.mainFaction == EClass.pc.faction;
686 }
687 }
688
689 // Token: 0x1700106E RID: 4206
690 // (get) Token: 0x0600353C RID: 13628 RVA: 0x0011DA9F File Offset: 0x0011BC9F
691 public virtual bool GrowWeed
692 {
693 get
694 {
695 return this.GrowPlant;
696 }
697 }
698
699 // Token: 0x1700106F RID: 4207
700 // (get) Token: 0x0600353D RID: 13629 RVA: 0x0011DAA7 File Offset: 0x0011BCA7
701 public virtual bool IsExplorable
702 {
703 get
704 {
705 return !base.isRandomSite;
706 }
707 }
708
709 // Token: 0x17001070 RID: 4208
710 // (get) Token: 0x0600353E RID: 13630 RVA: 0x0011DAB2 File Offset: 0x0011BCB2
711 public virtual bool IsReturnLocation
712 {
713 get
714 {
715 return EClass.pc.homeZone == this || base.source.tag.Contains("return");
716 }
717 }
718
719 // Token: 0x17001071 RID: 4209
720 // (get) Token: 0x0600353F RID: 13631 RVA: 0x0011DAD8 File Offset: 0x0011BCD8
721 public virtual bool ShouldMakeExit
722 {
723 get
724 {
725 return base.lv > this.MinLv && base.lv < this.MaxLv;
726 }
727 }
728
729 // Token: 0x17001072 RID: 4210
730 // (get) Token: 0x06003540 RID: 13632 RVA: 0x0011DAF8 File Offset: 0x0011BCF8
731 public virtual bool ShouldRegenerate
732 {
733 get
734 {
735 return false;
736 }
737 }
738
739 // Token: 0x17001073 RID: 4211
740 // (get) Token: 0x06003541 RID: 13633 RVA: 0x0011DAFB File Offset: 0x0011BCFB
741 public virtual bool ShouldAutoRevive
742 {
743 get
744 {
745 return this.ShouldRegenerate || this.IsPCFaction;
746 }
747 }
748
749 // Token: 0x17001074 RID: 4212
750 // (get) Token: 0x06003542 RID: 13634 RVA: 0x0011DB0D File Offset: 0x0011BD0D
751 public virtual bool UseFog
752 {
753 get
754 {
755 return base.lv < 0;
756 }
757 }
758
759 // Token: 0x17001075 RID: 4213
760 // (get) Token: 0x06003543 RID: 13635 RVA: 0x0011DB18 File Offset: 0x0011BD18
761 public virtual bool RevealRoom
762 {
763 get
764 {
765 return false;
766 }
767 }
768
769 // Token: 0x17001076 RID: 4214
770 // (get) Token: 0x06003544 RID: 13636 RVA: 0x0011DB1B File Offset: 0x0011BD1B
771 public virtual bool AlwaysLowblock
772 {
773 get
774 {
775 return this.map.IsIndoor;
776 }
777 }
778
779 // Token: 0x17001077 RID: 4215
780 // (get) Token: 0x06003545 RID: 13637 RVA: 0x0011DB28 File Offset: 0x0011BD28
781 public virtual bool UseLight
782 {
783 get
784 {
785 return base.mainFaction == EClass.pc.faction || base.source.tag.Contains("light");
786 }
787 }
788
789 // Token: 0x17001078 RID: 4216
790 // (get) Token: 0x06003546 RID: 13638 RVA: 0x0011DB53 File Offset: 0x0011BD53
791 public virtual int StartLV
792 {
793 get
794 {
795 return 0;
796 }
797 }
798
799 // Token: 0x17001079 RID: 4217
800 // (get) Token: 0x06003547 RID: 13639 RVA: 0x0011DB56 File Offset: 0x0011BD56
801 public virtual bool ScaleMonsterLevel
802 {
803 get
804 {
805 return false;
806 }
807 }
808
809 // Token: 0x1700107A RID: 4218
810 // (get) Token: 0x06003548 RID: 13640 RVA: 0x0011DB59 File Offset: 0x0011BD59
811 public virtual bool HiddenInRegionMap
812 {
813 get
814 {
815 return false;
816 }
817 }
818
819 // Token: 0x06003549 RID: 13641 RVA: 0x0011DB5C File Offset: 0x0011BD5C
820 public virtual string GetNewZoneID(int level)
821 {
822 return base.source.id;
823 }
824
825 // Token: 0x1700107B RID: 4219
826 // (get) Token: 0x0600354A RID: 13642 RVA: 0x0011DB69 File Offset: 0x0011BD69
827 public virtual FlockController.SpawnType FlockType
828 {
829 get
830 {
831 return FlockController.SpawnType.Default;
832 }
833 }
834
835 // Token: 0x0600354B RID: 13643 RVA: 0x0011DB6C File Offset: 0x0011BD6C
836 public override string ToString()
837 {
838 string[] array = new string[10];
839 array[0] = this.Name;
840 array[1] = "(";
841 array[2] = base.uid.ToString();
842 array[3] = ")(";
843 int num = 4;
844 Point regionPos = this._regionPos;
845 array[num] = ((regionPos != null) ? regionPos.ToString() : null);
846 array[5] = ") instance?";
847 array[6] = this.IsInstance.ToString();
848 array[7] = "/";
849 array[8] = EClass.world.date.GetRemainingHours(base.dateExpire).ToString();
850 array[9] = "h";
851 return string.Concat(array);
852 }
853
854 // Token: 0x1700107C RID: 4220
855 // (get) Token: 0x0600354C RID: 13644 RVA: 0x0011DC0E File Offset: 0x0011BE0E
856 public override string NameSuffix
857 {
858 get
859 {
860 if (!this.IsNefia || !this.GetTopZone().isConquered)
861 {
862 return "";
863 }
864 return "conquered".lang();
865 }
866 }
867
868 // Token: 0x1700107D RID: 4221
869 // (get) Token: 0x0600354D RID: 13645 RVA: 0x0011DC35 File Offset: 0x0011BE35
870 public string NameWithLevel
871 {
872 get
873 {
874 return this.Name + this.TextLevel(base.lv);
875 }
876 }
877
878 // Token: 0x0600354E RID: 13646 RVA: 0x0011DC50 File Offset: 0x0011BE50
879 public string TextLevel(int _lv)
880 {
881 if (_lv == 0)
882 {
883 return "";
884 }
885 if (base.lv <= 0)
886 {
887 return " " + "zoneLevelB".lang((_lv * -1).ToString() ?? "", null, null, null, null);
888 }
889 return " " + "zoneLevel".lang((_lv + 1).ToString() ?? "", null, null, null, null);
890 }
891
892 // Token: 0x1700107E RID: 4222
893 // (get) Token: 0x0600354F RID: 13647 RVA: 0x0011DCC8 File Offset: 0x0011BEC8
894 public string TextDeepestLv
895 {
896 get
897 {
898 if (this.GetDeepestLv() != 0)
899 {
900 return "zoneLevelMax".lang(this.TextLevel(this.GetDeepestLv()), null, null, null, null);
901 }
902 return "";
903 }
904 }
905
906 // Token: 0x1700107F RID: 4223
907 // (get) Token: 0x06003550 RID: 13648 RVA: 0x0011DCF2 File Offset: 0x0011BEF2
908 public bool CanEnterBuildMode
909 {
910 get
911 {
912 return EClass.debug.godBuild || EClass.debug.ignoreBuildRule || base.mainFaction == EClass.pc.faction;
913 }
914 }
915
916 // Token: 0x17001080 RID: 4224
917 // (get) Token: 0x06003551 RID: 13649 RVA: 0x0011DD20 File Offset: 0x0011BF20
918 public bool CanEnterBuildModeAnywhere
919 {
920 get
921 {
922 return EClass.debug.godBuild || EClass.debug.ignoreBuildRule || (base.mainFaction == EClass.pc.faction && EClass.Branch.elements.Has(4003));
923 }
924 }
925
926 // Token: 0x17001081 RID: 4225
927 // (get) Token: 0x06003552 RID: 13650 RVA: 0x0011DD6F File Offset: 0x0011BF6F
928 public bool IsPCFaction
929 {
930 get
931 {
932 return base.mainFaction == EClass.pc.faction;
933 }
934 }
935
936 // Token: 0x17001082 RID: 4226
937 // (get) Token: 0x06003553 RID: 13651 RVA: 0x0011DD83 File Offset: 0x0011BF83
938 public bool IsStartZone
939 {
940 get
941 {
942 return this == EClass.game.StartZone;
943 }
944 }
945
946 // Token: 0x17001083 RID: 4227
947 // (get) Token: 0x06003554 RID: 13652 RVA: 0x0011DD92 File Offset: 0x0011BF92
948 public bool IsInstance
949 {
950 get
951 {
952 return this.instance != null;
953 }
954 }
955
956 // Token: 0x17001084 RID: 4228
957 // (get) Token: 0x06003555 RID: 13653 RVA: 0x0011DD9D File Offset: 0x0011BF9D
958 public bool IsLoaded
959 {
960 get
961 {
962 return this.map != null;
963 }
964 }
965
966 // Token: 0x17001085 RID: 4229
967 // (get) Token: 0x06003556 RID: 13654 RVA: 0x0011DDA8 File Offset: 0x0011BFA8
968 public virtual int BaseElectricity
969 {
970 get
971 {
972 return 0;
973 }
974 }
975
976 // Token: 0x17001086 RID: 4230
977 // (get) Token: 0x06003557 RID: 13655 RVA: 0x0011DDAB File Offset: 0x0011BFAB
978 public bool IsActiveZone
979 {
980 get
981 {
982 return EClass.game.activeZone == this;
983 }
984 }
985
986 // Token: 0x17001087 RID: 4231
987 // (get) Token: 0x06003558 RID: 13656 RVA: 0x0011DDBA File Offset: 0x0011BFBA
988 public bool CanInspect
989 {
990 get
991 {
992 return !this.IsInstance && !this.HiddenInRegionMap;
993 }
994 }
995
996 // Token: 0x17001088 RID: 4232
997 // (get) Token: 0x06003559 RID: 13657 RVA: 0x0011DDD0 File Offset: 0x0011BFD0
998 public string InspectName
999 {
1000 get
1001 {
1002 return this.Name + ((this.IsTown || this.IsPCFaction || this is Zone_Civilized) ? "" : "dangerLv".lang(this.DangerLv.ToString() ?? "", null, null, null, null));
1003 }
1004 }
1005
1006 // Token: 0x17001089 RID: 4233
1007 // (get) Token: 0x0600355A RID: 13658 RVA: 0x0011DE2C File Offset: 0x0011C02C
1008 public Point InspectPoint
1009 {
1010 get
1011 {
1012 return null;
1013 }
1014 }
1015
1016 // Token: 0x1700108A RID: 4234
1017 // (get) Token: 0x0600355B RID: 13659 RVA: 0x0011DE30 File Offset: 0x0011C030
1018 public Vector3 InspectPosition
1019 {
1020 get
1021 {
1022 return default(Vector3);
1023 }
1024 }
1025
1026 // Token: 0x0600355C RID: 13660 RVA: 0x0011DE46 File Offset: 0x0011C046
1027 public override void OnCreate()
1028 {
1029 this.events.zone = this;
1030 base.lv = this.StartLV;
1031 }
1032
1033 // Token: 0x0600355D RID: 13661 RVA: 0x0011DE60 File Offset: 0x0011C060
1034 public override void OnAfterCreate()
1035 {
1036 if (this.AddPrefix)
1037 {
1038 if (this.GetTopZone() == this)
1039 {
1040 base.idPrefix = EClass.sources.zoneAffixes.rows.RandomItem<SourceZoneAffix.Row>().id;
1041 return;
1042 }
1043 base.idPrefix = this.GetTopZone().idPrefix;
1044 }
1045 }
1046
1047 // Token: 0x0600355E RID: 13662 RVA: 0x0011DEB0 File Offset: 0x0011C0B0
1048 public void Activate()
1049 {
1050 if (this.IsRegion)
1051 {
1052 EClass.scene.elomapActor.Initialize(this.Region.elomap);
1053 }
1054 this.isStarted = (this.isSimulating = false);
1055 base.isKnown = true;
1056 EClass.game.config.reverseSnow = false;
1057 if (this.RegenerateOnEnter && EClass.game.activeZone != null && EClass.game.activeZone.GetTopZone() != this.GetTopZone() && EClass.world.date.IsExpired(base.dateExpire))
1058 {
1059 Msg.Say("regenerateZone", this.Name, null, null, null);
1060 this.ClearZones(null);
1061 if (EClass.pc.global.transition != null)
1062 {
1063 EClass.pc.global.transition.uidLastZone = 0;
1064 }
1065 }
1066 Zone activeZone = EClass.game.activeZone;
1067 if (EClass.game.activeZone != null)
1068 {
1069 EClass.game.activeZone.Deactivate();
1070 }
1071 EClass.game.activeZone = this;
1072 ZoneExportData zoneExportData = null;
1073 Debug.Log(string.Concat(new string[]
1074 {
1075 this.NameWithLevel,
1076 "/",
1077 this.id,
1078 "/",
1079 base.uid.ToString(),
1080 "/",
1081 base.isGenerated.ToString(),
1082 "/",
1083 this.IsLoaded.ToString(),
1084 "/",
1085 File.Exists(base.pathSave + "map").ToString()
1086 }));
1087 if (base.isGenerated && !this.IsLoaded && !File.Exists(base.pathSave + "map"))
1088 {
1089 Debug.Log("(Bug) File does not exist:" + this.destryoed.ToString() + "/" + base.pathSave);
1090 base.isGenerated = false;
1091 }
1092 bool flag = false;
1093 Debug.Log(this.idCurrentSubset + "/" + this.IDSubset);
1094 bool flag2 = this.idCurrentSubset != this.IDSubset || Zone.forceSubset != null;
1095 if (flag2 && this.map != null)
1096 {
1097 this.UnloadMap();
1098 }
1099 Debug.Log(string.Concat(new string[]
1100 {
1101 this.idExport,
1102 "/",
1103 File.Exists(this.pathExport).ToString(),
1104 "/",
1105 this.pathExport
1106 }));
1107 if (!base.isGenerated && (this.idExport.IsEmpty() || !File.Exists(this.pathExport)))
1108 {
1109 Debug.Log("generating random map");
1110 flag = true;
1111 base.dateExpire = EClass.world.date.GetRaw(0) + 1440 * this.ExpireDays;
1112 this.Generate();
1113 this.OnGenerateMap();
1114 if (this.instance != null)
1115 {
1116 this.instance.OnGenerateMap();
1117 }
1118 if (!this.UseFog)
1119 {
1120 this.map.ForeachCell(delegate(global::Cell c)
1121 {
1122 c.isSeen = true;
1123 });
1124 }
1125 if (!(this.bp is GameBlueprint))
1126 {
1127 this.AddGlobalCharasOnActivate();
1128 }
1129 }
1130 else if (this.IsLoaded)
1131 {
1132 Debug.Log("zone is already loaded");
1133 this.map.SetZone(this);
1134 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : this.pathTemp);
1135 this.AddGlobalCharasOnActivate();
1136 }
1137 else
1138 {
1139 this.subset = null;
1140 bool flag3 = (base.isGenerated && flag2) || (base.isGenerated && !this.IsInstance && !this.IsPCFaction && this.ShouldRegenerate && EClass.world.date.IsExpired(base.dateRegenerate)) || Zone.forceRegenerate;
1141 if (this.pathExport.IsEmpty() || !File.Exists(this.pathExport))
1142 {
1143 flag3 = false;
1144 }
1145 Debug.Log(string.Concat(new string[]
1146 {
1147 base.isGenerated.ToString(),
1148 "/",
1149 flag3.ToString(),
1150 "/",
1151 flag2.ToString(),
1152 "/",
1153 this.IDSubset
1154 }));
1155 if (!base.isGenerated || flag3 || flag2)
1156 {
1157 Debug.Log("importing map:" + this.pathExport);
1158 flag = true;
1159 base.dateRegenerate = EClass.world.date.GetRaw(0) + 1440 * EClass.setting.balance.dateRegenerateZone;
1160 if (!flag3)
1161 {
1162 IO.DeleteDirectory(this.pathTemp + "Texture Replace");
1163 Debug.Log(this.pathTemp);
1164 }
1165 zoneExportData = this.Import(this.pathExport);
1166 base.isGenerated = true;
1167 this.isImported = true;
1168 if (flag3)
1169 {
1170 zoneExportData.orgMap = GameIO.LoadFile<Map>(base.pathSave + "map");
1171 }
1172 }
1173 EClass.game.countLoadedMaps++;
1174 Debug.Log("loading map: imported? " + this.isImported.ToString() + " regenerate? " + flag3.ToString());
1175 this.map = GameIO.LoadFile<Map>((this.isImported ? this.pathTemp : base.pathSave) + "map");
1176 if (this.map == null)
1177 {
1178 EClass.ui.Say(string.Concat(new string[]
1179 {
1180 "System.IO.EndOfStreamException: Unexpected end of stream:",
1181 Environment.NewLine,
1182 "File may be corrupted. Try replacing the following file if you have a backup:",
1183 Environment.NewLine,
1184 this.isImported ? this.pathTemp : base.pathSave,
1185 "map"
1186 }), null);
1187 return;
1188 }
1189 this.map.SetZone(this);
1190 this.map.Load(this.isImported ? this.pathTemp : base.pathSave, this.isImported, null);
1191 this.map.SetReference();
1192 EClass.core.textures.ApplyLocalReplace(base.isMapSaved ? base.pathSave : this.pathTemp);
1193 if (this.isImported)
1194 {
1195 this.map.deadCharas.Clear();
1196 this.map.OnImport(zoneExportData);
1197 if (this.UseFog && !flag3)
1198 {
1199 this.map.ForeachCell(delegate(global::Cell c)
1200 {
1201 c.isSeen = false;
1202 });
1203 }
1204 if (zoneExportData.orgMap != null)
1205 {
1206 Map orgMap = zoneExportData.orgMap;
1207 List<Chara> serializedCharas = this.map.serializedCharas;
1208 this.map.charas = orgMap.charas;
1209 this.map.serializedCharas = orgMap.serializedCharas;
1210 this.map.deadCharas = orgMap.deadCharas;
1211 foreach (Chara chara in serializedCharas)
1212 {
1213 string[] array = new string[6];
1214 array[0] = "Importing New Chara:";
1215 array[1] = chara.id;
1216 array[2] = "/";
1217 array[3] = chara.Name;
1218 array[4] = "/";
1219 int num = 5;
1220 Point orgPos = chara.orgPos;
1221 array[num] = ((orgPos != null) ? orgPos.ToString() : null);
1222 Debug.Log(string.Concat(array));
1223 this.map.serializedCharas.Add(chara);
1224 }
1225 this.map.things.ForeachReverse(delegate(Thing t)
1226 {
1227 if (t.trait is TraitNewZone)
1228 {
1229 foreach (Thing thing4 in orgMap.things)
1230 {
1231 if (t.id == thing4.id && t.pos.Equals(thing4.pos))
1232 {
1233 this.RemoveCard(t);
1234 this.map.things.Insert(0, thing4);
1235 thing4.stackOrder = 0;
1236 return;
1237 }
1238 }
1239 return;
1240 }
1241 if (t.trait is TraitStairsLocked)
1242 {
1243 foreach (Thing thing5 in orgMap.things)
1244 {
1245 if (thing5.trait is TraitNewZone && t.pos.Equals(thing5.pos))
1246 {
1247 this.RemoveCard(t);
1248 this.map.things.Add(thing5);
1249 return;
1250 }
1251 }
1252 return;
1253 }
1254 if (t.id == "medal" || t.id == "856")
1255 {
1256 foreach (Thing thing6 in orgMap.things)
1257 {
1258 if (t.id == thing6.id && t.pos.Equals(thing6.pos))
1259 {
1260 return;
1261 }
1262 }
1263 this.RemoveCard(t);
1264 }
1265 });
1266 foreach (KeyValuePair<int, int> keyValuePair in EClass._map.backerObjs.ToList<KeyValuePair<int, int>>())
1267 {
1268 EClass._map.GetCell(keyValuePair.Key);
1269 SourceBacker.Row row = EClass.sources.backers.map[keyValuePair.Value];
1270 if (EClass.player.doneBackers.Contains(row.id) && !EClass.core.config.test.ignoreBackerDestoryFlag)
1271 {
1272 this.map.backerObjs.Remove(keyValuePair.Key);
1273 }
1274 }
1275 foreach (Chara chara2 in this.map.serializedCharas)
1276 {
1277 if (chara2.orgPos != null && chara2.orgPos.IsValid)
1278 {
1279 chara2.pos.Set(chara2.orgPos);
1280 }
1281 }
1282 foreach (Thing thing in orgMap.things)
1283 {
1284 if (thing.trait is TraitTent && !thing.isNPCProperty)
1285 {
1286 thing.AddEditorTag(EditorTag.NoNpcProperty);
1287 thing.isSubsetCard = false;
1288 this.map.things.Add(thing);
1289 Debug.Log(thing);
1290 }
1291 }
1292 }
1293 }
1294 foreach (Thing c2 in this.map.things)
1295 {
1296 this.map.AddCardOnActivate(c2);
1297 }
1298 foreach (Chara chara3 in this.map.serializedCharas)
1299 {
1300 this.map.charas.Add(chara3);
1301 this.map.AddCardOnActivate(chara3);
1302 }
1303 this.map.serializedCharas.Clear();
1304 if (this.isImported && this.IsTown)
1305 {
1306 this.RefreshListCitizen();
1307 }
1308 this.map.RefreshAllTiles();
1309 this.AddGlobalCharasOnActivate();
1310 this.map.OnLoad();
1311 if (flag3)
1312 {
1313 foreach (Card card in this.map.Cards.ToList<Card>())
1314 {
1315 if (card.isSubsetCard)
1316 {
1317 card.Destroy();
1318 }
1319 }
1320 }
1321 if (this.isImported)
1322 {
1323 this.idCurrentSubset = (Zone.forceSubset ?? this.IDSubset);
1324 if (this.idCurrentSubset != null)
1325 {
1326 this.subset = MapSubset.Load(this.idCurrentSubset);
1327 this.subset.Apply();
1328 }
1329 }
1330 if (this.isImported)
1331 {
1332 if (this.MakeTownProperties)
1333 {
1334 using (List<Thing>.Enumerator enumerator3 = this.map.things.GetEnumerator())
1335 {
1336 while (enumerator3.MoveNext())
1337 {
1338 Thing thing2 = enumerator3.Current;
1339 thing2.isNPCProperty = (!thing2.isHidden && !thing2.HasEditorTag(EditorTag.NoNpcProperty));
1340 }
1341 goto IL_B55;
1342 }
1343 }
1344 foreach (Thing thing3 in this.map.things)
1345 {
1346 thing3.isNPCProperty = false;
1347 }
1348 IL_B55:
1349 this.OnGenerateMap();
1350 if (this.instance != null)
1351 {
1352 this.instance.OnGenerateMap();
1353 }
1354 }
1355 if (this.isImported && !flag3 && !this.RevealRoom)
1356 {
1357 foreach (global::Room room in this.map.rooms.listRoom)
1358 {
1359 if (room.HasRoof && !room.data.atrium)
1360 {
1361 foreach (Point point in room.points)
1362 {
1363 point.cell.isSeen = false;
1364 }
1365 }
1366 }
1367 }
1368 if (flag3)
1369 {
1370 this.OnRegenerate();
1371 }
1372 }
1373 PathManager.Instance._pathfinder.PunishChangeDirection = false;
1374 this.isImported = false;
1375 if (flag && this.IsTown && base.lv == 0)
1376 {
1377 this.SpawnLostItems();
1378 }
1379 if (base.visitCount == 0)
1380 {
1381 base.dateRevive = EClass.world.date.GetRaw(0) + 1440 * EClass.setting.balance.dateRevive;
1382 }
1383 this.map.ForeachCell(delegate(global::Cell c)
1384 {
1385 if (c.HasFire)
1386 {
1387 this.map.effectManager.GetOrCreate(c.GetSharedPoint());
1388 }
1389 if (this.IsRegion)
1390 {
1391 c.decal = 0;
1392 }
1393 });
1394 if (EClass.world.weather.IsRaining)
1395 {
1396 this.RainWater();
1397 }
1398 if (EClass.debug.revealMap)
1399 {
1400 this.map.ForeachCell(delegate(global::Cell c)
1401 {
1402 c.isSeen = true;
1403 });
1404 }
1405 this.isStarted = true;
1406 this.map.RefreshAllTiles();
1407 if (this.events.listPreEnter.Count > 0)
1408 {
1409 foreach (ZonePreEnterEvent zonePreEnterEvent in this.events.listPreEnter)
1410 {
1411 zonePreEnterEvent.Execute();
1412 }
1413 this.events.listPreEnter.Clear();
1414 }
1415 foreach (Card card2 in this.map.Cards)
1416 {
1417 card2.CalculateFOV();
1418 if (card2.isChara)
1419 {
1420 Chara chara4 = card2.Chara;
1421 if (card2.IsUnique && !card2.IsPCFaction && !card2.IsPCParty)
1422 {
1423 Point point2 = chara4.orgPos ?? card2.pos;
1424 card2.c_uniqueData = new UniqueData
1425 {
1426 x = point2.x,
1427 y = point2.z,
1428 uidZone = base.uid
1429 };
1430 }
1431 int @int = card2.GetInt(55, null);
1432 if (@int != 0)
1433 {
1434 foreach (Chara chara5 in this.map.charas)
1435 {
1436 if (chara5.uid == @int)
1437 {
1438 if (!chara4.IsHostile(chara5))
1439 {
1440 break;
1441 }
1442 chara4.enemy = chara5;
1443 chara4.SetAI(new GoalCombat());
1444 chara4.calmCheckTurn = 20 + EClass.rnd(30);
1445 break;
1446 }
1447 }
1448 card2.SetInt(55, 0);
1449 }
1450 if (card2.pos.cell.IsBlocked && !card2.isRestrained && !card2.HasCondition<ConSuspend>())
1451 {
1452 card2.MoveImmediate(card2.pos.GetNearestPoint(false, true, true, false) ?? card2.pos, true, true);
1453 }
1454 chara4.SyncRide();
1455 if (card2.c_uidMaster != 0 && chara4.master == null)
1456 {
1457 chara4.FindMaster();
1458 }
1459 if (!EClass.game.isLoading)
1460 {
1461 chara4.enemy = null;
1462 if (chara4.IsInCombat)
1463 {
1464 chara4.SetNoGoal();
1465 }
1466 }
1467 }
1468 else if (card2.IsInstalled)
1469 {
1470 TraitDoor traitDoor = card2.trait as TraitDoor;
1471 if (traitDoor != null && card2.pos.HasChara && !traitDoor.IsOpen())
1472 {
1473 traitDoor.ToggleDoor(false, false);
1474 }
1475 }
1476 }
1477 this.RefreshHat();
1478 Zone.forceRegenerate = false;
1479 Zone.forceSubset = null;
1480 EClass.ui.OnActivateZone();
1481 EClass.scene.RebuildActorEx();
1482 EClass.Sound.LoadAmbience(this.IDAmbience);
1483 if (EClass.Branch != null)
1484 {
1485 EClass.Branch.OnActivateZone();
1486 }
1487 this.OnVisit();
1488 if (flag)
1489 {
1490 this.OnVisitNewMapOrRegenerate();
1491 }
1492 Guild currentGuild = Guild.GetCurrentGuild();
1493 if (currentGuild != null)
1494 {
1495 currentGuild.RefreshDevelopment();
1496 }
1497 if (this.IsPCFaction)
1498 {
1499 EClass.player.uidLastTown = 0;
1500 }
1501 else if (this.IsTown && base.lv == 0)
1502 {
1503 EClass.player.uidLastTown = base.uid;
1504 }
1505 this.RefreshBGM();
1506 Rand.InitBytes(this.map.seed + 1);
1507 this.RefreshElectricity();
1508 Zone.okaerinko = 0;
1509 if (EClass.debug.enable)
1510 {
1511 this.ModInfluence(2000);
1512 }
1513 if (this is Zone_TinkerCamp)
1514 {
1515 Tutorial.Reserve("tinker", null);
1516 return;
1517 }
1518 if (this is Zone_Town && !(this is Zone_SubTown))
1519 {
1520 Tutorial.Reserve("town", null);
1521 }
1522 }
1523
1524 // Token: 0x0600355F RID: 13663 RVA: 0x0011F090 File Offset: 0x0011D290
1525 public void RefreshHat()
1526 {
1527 if (this.idHat != null && EClass.world.date.IsExpired(base.dateHat))
1528 {
1529 this.idHat = null;
1530 base.dateHat = 0;
1531 }
1532 Zone.sourceHat = ((this.idHat != null) ? EClass.sources.cards.map[this.idHat] : ((this.IDHat != null) ? EClass.sources.cards.map[this.IDHat] : null));
1533 }
1534
1535 // Token: 0x06003560 RID: 13664 RVA: 0x0011F118 File Offset: 0x0011D318
1536 public void OnVisit()
1537 {
1538 if (this.CountDeepestLevel && this.DangerLv > EClass.player.stats.deepest)
1539 {
1540 EClass.player.stats.deepest = this.DangerLv;
1541 }
1542 if (EClass.world.date.IsExpired(base.dateRevive))
1543 {
1544 this.ResetHostility();
1545 this.Revive();
1546 foreach (Chara chara in EClass._map.charas)
1547 {
1548 chara.TryRestock(false);
1549 if (!chara.IsPCFaction)
1550 {
1551 chara.c_fur = 0;
1552 }
1553 }
1554 }
1555 this.RefreshCriminal();
1556 EClass._map.rooms.AssignCharas();
1557 this.events.OnVisit();
1558 this.OnActivate();
1559 this.UpdateQuests(false);
1560 this.OnBeforeSimulate();
1561 this.isSimulating = true;
1562 this.Simulate();
1563 this.isSimulating = false;
1564 this.OnAfterSimulate();
1565 if (EClass.Branch != null)
1566 {
1567 EClass.Branch.OnAfterSimulate();
1568 }
1569 base.lastActive = EClass.world.date.GetRaw(0);
1570 if (!EClass.game.isLoading)
1571 {
1572 int visitCount = base.visitCount;
1573 base.visitCount = visitCount + 1;
1574 }
1575 base.version = EClass.core.version.GetInt();
1576 }
1577
1578 // Token: 0x06003561 RID: 13665 RVA: 0x0011F27C File Offset: 0x0011D47C
1579 public void Revive()
1580 {
1581 base.dateRevive = EClass.world.date.GetRaw(0) + 1440 * EClass.setting.balance.dateRevive;
1582 if (this.ShouldAutoRevive)
1583 {
1584 foreach (Chara chara in this.map.deadCharas)
1585 {
1586 if (chara.trait.CanAutoRevive)
1587 {
1588 chara.Revive(null, false);
1589 if (chara.isBackerContent && EClass.player.doneBackers.Contains(chara.c_idBacker) && !EClass.core.config.test.ignoreBackerDestoryFlag)
1590 {
1591 chara.RemoveBacker();
1592 }
1593 EClass._zone.AddCard(chara, (chara.orgPos != null && chara.orgPos.IsInBounds) ? chara.orgPos : chara.pos);
1594 }
1595 }
1596 }
1597 foreach (Chara chara2 in EClass.game.cards.globalCharas.Values)
1598 {
1599 if (chara2.isDead && chara2.homeZone == this)
1600 {
1601 chara2.Revive(null, false);
1602 Point point = this.GetSpawnPos(chara2, ZoneTransition.EnterState.Auto);
1603 if (chara2.orgPos != null && chara2.orgPos.IsInBounds)
1604 {
1605 point = (chara2.orgPos.GetNearestPoint(false, true, true, false) ?? point);
1606 }
1607 EClass._zone.AddCard(chara2, point);
1608 }
1609 }
1610 this.map.deadCharas.Clear();
1611 }
1612
1613 // Token: 0x06003562 RID: 13666 RVA: 0x0011F440 File Offset: 0x0011D640
1614 public virtual void OnRegenerate()
1615 {
1616 }
1617
1618 // Token: 0x06003563 RID: 13667 RVA: 0x0011F442 File Offset: 0x0011D642
1619 public virtual void OnActivate()
1620 {
1621 }
1622
1623 // Token: 0x06003564 RID: 13668 RVA: 0x0011F444 File Offset: 0x0011D644
1624 public virtual void OnBeforeDeactivate()
1625 {
1626 }
1627
1628 // Token: 0x06003565 RID: 13669 RVA: 0x0011F446 File Offset: 0x0011D646
1629 public virtual void OnDeactivate()
1630 {
1631 }
1632
1633 // Token: 0x06003566 RID: 13670 RVA: 0x0011F448 File Offset: 0x0011D648
1634 public virtual void OnBeforeSimulate()
1635 {
1636 }
1637
1638 // Token: 0x06003567 RID: 13671 RVA: 0x0011F44A File Offset: 0x0011D64A
1639 public virtual void OnVisitNewMapOrRegenerate()
1640 {
1641 }
1642
1643 // Token: 0x06003568 RID: 13672 RVA: 0x0011F44C File Offset: 0x0011D64C
1644 public virtual void OnAfterSimulate()
1645 {
1646 }
1647
1648 // Token: 0x06003569 RID: 13673 RVA: 0x0011F450 File Offset: 0x0011D650
1649 public void Simulate()
1650 {
1651 if (!EClass.game.isLoading && base.visitCount > 0)
1652 {
1653 if (this.Boss != null && this.IsNefia)
1654 {
1655 Msg.Say("bossLeave", this.Boss.Name.ToTitleCase(false), EClass._zone.Name, null, null);
1656 EClass._zone.RemoveCard(this.Boss);
1657 EClass._zone.GetTopZone().isConquered = true;
1658 }
1659 int num = Mathf.Clamp(this.MinsSinceLastActive, 1, 10000);
1660 foreach (Chara chara in EClass._map.charas)
1661 {
1662 if (chara.hp < 0)
1663 {
1664 chara.hp = 0;
1665 }
1666 if (!chara.IsPCParty)
1667 {
1668 if (chara.mana.value < 0)
1669 {
1670 chara.mana.value = 0;
1671 }
1672 if (chara.stamina.value < 0)
1673 {
1674 chara.stamina.value = 0;
1675 }
1676 }
1677 if (num > 60)
1678 {
1679 chara.resistCon = null;
1680 }
1681 if (chara.rarity >= Rarity.Legendary && !chara.IsPCFaction && num > 0)
1682 {
1683 Msg.ignoreAll = true;
1684 chara.Cure(CureType.Boss, 20 + num * 10, BlessedState.Normal);
1685 chara.HealHP(Mathf.Max(1, chara.MaxHP) * num / 20, HealSource.None);
1686 chara.mana.Mod(Mathf.Max(1, chara.mana.max) * num / 20);
1687 chara.stamina.Mod(Mathf.Max(1, chara.stamina.max) * num / 20);
1688 Msg.ignoreAll = false;
1689 }
1690 }
1691 }
1692 if (this.HourSinceLastActive <= 1)
1693 {
1694 return;
1695 }
1696 Debug.Log(this.Name + " Simulate:" + this.HourSinceLastActive.ToString() + " hours");
1697 VirtualDate virtualDate = new VirtualDate(this.HourSinceLastActive);
1698 List<Chara> list = EClass._map.charas.ToList<Chara>();
1699 int num2 = this.HourSinceLastActive / 24;
1700 if (num2 > 0)
1701 {
1702 foreach (Chara chara2 in list)
1703 {
1704 if (!chara2.IsPCParty)
1705 {
1706 chara2.OnSleep(200, num2);
1707 if (chara2.conSleep != null)
1708 {
1709 chara2.conSleep.Kill(false);
1710 }
1711 if (EClass.rnd(EClass.world.date.IsNight ? 20 : 200) == 0 && !chara2.IsPCFaction)
1712 {
1713 chara2.AddCondition<ConSleep>(1000 + EClass.rnd(1000), true);
1714 }
1715 if (chara2.things.Count > 20)
1716 {
1717 chara2.ClearInventory(ClearInventoryType.Silent);
1718 }
1719 }
1720 }
1721 }
1722 EClass._map.things.ForeachReverse(delegate(Thing t)
1723 {
1724 t.DecayNatural(this.HourSinceLastActive);
1725 });
1726 VirtualDate.current = virtualDate;
1727 for (int i = 0; i < this.HourSinceLastActive; i++)
1728 {
1729 virtualDate.SimulateHour();
1730 }
1731 VirtualDate.current = null;
1732 if (!this.IsPCFaction)
1733 {
1734 return;
1735 }
1736 int num3 = 0;
1737 foreach (Chara chara3 in list)
1738 {
1739 if (!chara3.IsPCParty)
1740 {
1741 if (!chara3.IsHomeMember())
1742 {
1743 if (chara3.id == "bee")
1744 {
1745 num3++;
1746 }
1747 if (num2 > 0 && chara3.IsGuest())
1748 {
1749 chara3.ChooseNewGoal();
1750 chara3.ai.SimulateZone(num2);
1751 }
1752 }
1753 else
1754 {
1755 if (num2 > 0)
1756 {
1757 Goal goal = chara3.GetGoalWork();
1758 chara3.SetAI(goal);
1759 if (goal is GoalWork)
1760 {
1761 (goal as GoalWork).FindWork(chara3, true);
1762 }
1763 chara3.ai.SimulateZone(num2);
1764 goal = chara3.GetGoalHobby();
1765 chara3.SetAI(goal);
1766 if (goal is GoalWork)
1767 {
1768 (goal as GoalWork).FindWork(chara3, true);
1769 }
1770 chara3.ai.SimulateZone(num2);
1771 }
1772 chara3.ChooseNewGoal();
1773 if (chara3.conSuspend == null)
1774 {
1775 chara3.ai.OnSimulatePosition();
1776 }
1777 }
1778 }
1779 }
1780 List<Thing> list2 = new List<Thing>();
1781 foreach (Thing thing in this.map.things)
1782 {
1783 if (thing.IsInstalled && thing.trait is TraitBeekeep)
1784 {
1785 list2.Add(thing);
1786 }
1787 }
1788 if (num3 < list2.Count)
1789 {
1790 for (int j = num3; j < list2.Count; j++)
1791 {
1792 if (EClass.rnd(200) <= this.HourSinceLastActive)
1793 {
1794 Chara chara4 = CharaGen.Create("bee", -1);
1795 this.AddCard(chara4, list2.RandomItem<Thing>().pos);
1796 chara4.c_originalHostility = (chara4.hostility = Hostility.Neutral);
1797 }
1798 }
1799 }
1800 }
1801
1802 // Token: 0x0600356A RID: 13674 RVA: 0x0011F9CC File Offset: 0x0011DBCC
1803 public Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState = ZoneTransition.EnterState.Auto)
1804 {
1805 GlobalData global = c.global;
1806 ZoneTransition zoneTransition = (global != null) ? global.transition : null;
1807 Zone zone = (zoneTransition != null) ? zoneTransition.lastZone : null;
1808 ZoneTransition.EnterState enterState = (zoneTransition != null) ? zoneTransition.state : destState;
1809 bool flag = zone == null || zone.lv > base.lv;
1810 if (this.IsRegion)
1811 {
1812 if (zone != null && !EClass.player.simulatingZone)
1813 {
1814 Zone topZone = zone.GetTopZone();
1815 if (this.GetZoneAt(topZone.x, topZone.y) != null)
1816 {
1817 return new Point(topZone.mapX, topZone.mapY);
1818 }
1819 }
1820 }
1821 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))
1822 {
1823 return EClass.player.lastZonePos;
1824 }
1825 if (enterState == ZoneTransition.EnterState.Region)
1826 {
1827 enterState = this.RegionEnterState;
1828 }
1829 if (this is Zone_Kapul && enterState == ZoneTransition.EnterState.Left)
1830 {
1831 enterState = ZoneTransition.EnterState.Right;
1832 }
1833 float rate = (zoneTransition == null) ? -1f : zoneTransition.ratePos;
1834 if (this.IsPCFaction)
1835 {
1836 if (enterState - ZoneTransition.EnterState.Dir <= 4 || enterState == ZoneTransition.EnterState.Return)
1837 {
1838 Thing spot = EClass._map.props.installed.Find<TraitSpotGuidePC>();
1839 if (spot != null)
1840 {
1841 Point nearestPoint = (spot.trait as TraitSpotGuidePC).GetRandomPoint((Point p) => !p.IsBlocked && !p.Equals(spot.pos)).GetNearestPoint(false, true, true, false);
1842 if (nearestPoint != null && nearestPoint.IsValid)
1843 {
1844 return nearestPoint;
1845 }
1846 }
1847 }
1848 }
1849 Thing randomThing;
1850 Thing randomThing2;
1851 Thing randomThing3;
1852 for (;;)
1853 {
1854 switch (enterState)
1855 {
1856 case ZoneTransition.EnterState.Center:
1857 case ZoneTransition.EnterState.Encounter:
1858 goto IL_4B6;
1859 case ZoneTransition.EnterState.Top:
1860 goto IL_503;
1861 case ZoneTransition.EnterState.Right:
1862 goto IL_51F;
1863 case ZoneTransition.EnterState.Bottom:
1864 goto IL_53B;
1865 case ZoneTransition.EnterState.Left:
1866 goto IL_557;
1867 case ZoneTransition.EnterState.Dead:
1868 case ZoneTransition.EnterState.Exact:
1869 case ZoneTransition.EnterState.PortalReturn:
1870 case ZoneTransition.EnterState.Fall:
1871 goto IL_573;
1872 case ZoneTransition.EnterState.RandomVisit:
1873 goto IL_5C4;
1874 case ZoneTransition.EnterState.Down:
1875 goto IL_5CC;
1876 case ZoneTransition.EnterState.Up:
1877 goto IL_5D0;
1878 case ZoneTransition.EnterState.Return:
1879 case ZoneTransition.EnterState.Teleport:
1880 case ZoneTransition.EnterState.Elevator:
1881 case ZoneTransition.EnterState.Moongate:
1882 if (enterState == ZoneTransition.EnterState.Teleport)
1883 {
1884 foreach (Thing thing in this.map.things)
1885 {
1886 if (thing.IsInstalled)
1887 {
1888 TraitTeleporter traitTeleporter = thing.trait as TraitTeleporter;
1889 if (traitTeleporter != null)
1890 {
1891 Debug.Log(string.Concat(new string[]
1892 {
1893 zoneTransition.idTele,
1894 "/",
1895 traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3, null)),
1896 "/",
1897 traitTeleporter.GetParam(3, null)
1898 }));
1899 }
1900 if (traitTeleporter != null && !zoneTransition.idTele.IsEmpty() && zoneTransition.idTele == traitTeleporter.id.IsEmpty(traitTeleporter.GetParam(3, null)))
1901 {
1902 return thing.pos.GetNearestPoint(false, true, true, false);
1903 }
1904 }
1905 }
1906 foreach (Thing thing2 in this.map.things)
1907 {
1908 if (thing2.IsInstalled)
1909 {
1910 TraitTeleporter traitTeleporter2 = thing2.trait as TraitTeleporter;
1911 if (traitTeleporter2 != null && traitTeleporter2.IsFor(zoneTransition.lastZone))
1912 {
1913 return thing2.pos.GetNearestPoint(false, true, true, false);
1914 }
1915 }
1916 }
1917 randomThing = EClass._map.props.installed.traits.GetRandomThing<TraitTeleporter>();
1918 if (randomThing != null)
1919 {
1920 goto Block_29;
1921 }
1922 }
1923 if (enterState == ZoneTransition.EnterState.Elevator)
1924 {
1925 foreach (Thing thing3 in this.map.things)
1926 {
1927 if (thing3.IsInstalled)
1928 {
1929 TraitElevator traitElevator = thing3.trait as TraitElevator;
1930 if (traitElevator != null && traitElevator.IsFor(zoneTransition.lastZone))
1931 {
1932 return thing3.pos.GetNearestPoint(false, true, true, false);
1933 }
1934 }
1935 }
1936 randomThing2 = EClass._map.props.installed.traits.GetRandomThing<TraitElevator>();
1937 if (randomThing2 != null)
1938 {
1939 goto Block_32;
1940 }
1941 }
1942 randomThing3 = this.map.props.installed.traits.GetRandomThing<TraitWaystone>();
1943 if (randomThing3 != null)
1944 {
1945 goto Block_33;
1946 }
1947 randomThing3 = this.map.props.installed.traits.GetRandomThing<TraitCoreZone>();
1948 if (randomThing3 != null)
1949 {
1950 goto Block_34;
1951 }
1952 if (base.lv == 0)
1953 {
1954 enterState = ZoneTransition.EnterState.Center;
1955 continue;
1956 }
1957 goto IL_49F;
1958 case ZoneTransition.EnterState.UndergroundOrSky:
1959 goto IL_1CA;
1960 }
1961 break;
1962 }
1963 goto IL_5D2;
1964 IL_1CA:
1965 return new Point(zoneTransition.x, zoneTransition.z);
1966 Block_29:
1967 return randomThing.pos.GetNearestPoint(false, true, true, false);
1968 Block_32:
1969 return randomThing2.pos.GetNearestPoint(false, true, true, false);
1970 Block_33:
1971 return randomThing3.pos.GetNearestPoint(false, true, true, false);
1972 Block_34:
1973 return randomThing3.pos.GetNearestPoint(false, true, true, false);
1974 IL_49F:
1975 flag = (base.lv <= 0);
1976 goto IL_5D2;
1977 IL_4B6:
1978 if (this.map.config.embarkX != 0)
1979 {
1980 return new Point(this.map.config.embarkX, this.map.config.embarkY);
1981 }
1982 return this.map.GetCenterPos().GetNearestPoint(false, false, true, false);
1983 IL_503:
1984 return this.map.bounds.GetTopPos(rate).GetNearestPoint(false, false, true, false);
1985 IL_51F:
1986 return this.map.bounds.GetRightPos(rate).GetNearestPoint(false, false, true, false);
1987 IL_53B:
1988 return this.map.bounds.GetBottomPos(rate).GetNearestPoint(false, false, true, false);
1989 IL_557:
1990 return this.map.bounds.GetLeftPos(rate).GetNearestPoint(false, false, true, false);
1991 IL_573:
1992 if (zoneTransition.x == 0 && EClass._map.bounds.x != 0)
1993 {
1994 return new Point(this.map.config.embarkX, this.map.config.embarkY);
1995 }
1996 return new Point(zoneTransition.x, zoneTransition.z);
1997 IL_5C4:
1998 return this.GetRandomVisitPos(c);
1999 IL_5CC:
2000 flag = true;
2001 goto IL_5D2;
2002 IL_5D0:
2003 flag = false;
2004 IL_5D2:
2005 foreach (Thing thing4 in this.map.things)
2006 {
2007 TraitNewZone traitNewZone = thing4.trait as TraitNewZone;
2008 if (traitNewZone != null && traitNewZone.zone != null && zone != null && traitNewZone.zone.uid == zone.uid)
2009 {
2010 if (c != null && enterState != ZoneTransition.EnterState.Auto)
2011 {
2012 c.SetDir(traitNewZone.owner.dir);
2013 }
2014 return traitNewZone.GetExitPos();
2015 }
2016 }
2017 foreach (Thing thing5 in this.map.things)
2018 {
2019 TraitNewZone traitNewZone2 = thing5.trait as TraitNewZone;
2020 if (traitNewZone2 != null && ((flag && traitNewZone2.IsUpstairs) || (!flag && traitNewZone2.IsDownstairs)))
2021 {
2022 if (c != null && enterState != ZoneTransition.EnterState.Auto)
2023 {
2024 c.SetDir(traitNewZone2.owner.dir);
2025 }
2026 return traitNewZone2.GetExitPos();
2027 }
2028 }
2029 return this.GetRandomVisitPos(c);
2030 }
2031
2032 // Token: 0x0600356B RID: 13675 RVA: 0x00120100 File Offset: 0x0011E300
2033 public Point GetRandomVisitPos(Chara c)
2034 {
2035 Point point = null;
2036 if (EClass.rnd(3) == 0 && this.map.rooms.listRoom.Count > 0)
2037 {
2038 point = this.map.rooms.listRoom.RandomItem<global::Room>().points.RandomItem<Point>();
2039 }
2040 if (point == null && EClass.rnd(4) != 0)
2041 {
2042 IEnumerable<Chara> enumerable = from t in this.map.charas
2043 where t.trait.ShopType != ShopType.None && t.pos != null && t.pos.IsValid
2044 select t;
2045 if (enumerable.Count<Chara>() > 0)
2046 {
2047 point = enumerable.RandomItem<Chara>().pos.GetRandomPoint(3, true, true, false, 100);
2048 }
2049 }
2050 if (point == null)
2051 {
2052 point = (this.map.bounds.GetRandomSurface(false, true, !this.IsPCFaction && !(this is Zone_Civilized)) ?? this.map.bounds.GetRandomPoint());
2053 }
2054 return point.GetNearestPoint(false, false, false, false) ?? EClass._map.GetCenterPos();
2055 }
2056
2057 // Token: 0x0600356C RID: 13676 RVA: 0x00120204 File Offset: 0x0011E404
2058 public void AddGlobalCharasOnActivate()
2059 {
2060 Point spawnPosPC = null;
2061 if (EClass.pc.currentZone == this)
2062 {
2063 spawnPosPC = this.GetSpawnPos(EClass.pc, ZoneTransition.EnterState.Auto);
2064 }
2065 if (spawnPosPC == null)
2066 {
2067 spawnPosPC = this.map.GetCenterPos();
2068 }
2069 if (spawnPosPC.IsValid && EClass.pc.global.transition != null && spawnPosPC.HasBlock)
2070 {
2071 spawnPosPC = spawnPosPC.GetNearestPoint(false, true, true, false);
2072 }
2073 spawnPosPC = spawnPosPC.Clamp(true).GetNearestPoint(false, false, true, false);
2074 using (Dictionary<int, Chara>.ValueCollection.Enumerator enumerator = EClass.game.cards.globalCharas.Values.GetEnumerator())
2075 {
2076 while (enumerator.MoveNext())
2077 {
2078 Chara c = enumerator.Current;
2079 if (c.currentZone == this)
2080 {
2081 if (c.parent is Chara)
2082 {
2083 Chara chara = c.parent as Chara;
2084 c.currentZone = chara.currentZone;
2085 }
2086 else if (!c.isDead)
2087 {
2088 if (c.global.transition != null)
2089 {
2090 Point pos = c.IsPC ? spawnPosPC : (c.IsPCParty ? spawnPosPC.GetNearestPoint(false, false, true, true) : this.GetSpawnPos(c, ZoneTransition.EnterState.Auto));
2091 if (c.IsPCParty && !c.IsPC)
2092 {
2093 if (c.host == EClass.pc)
2094 {
2095 pos.Set(spawnPosPC);
2096 }
2097 else if (pos.Equals(spawnPosPC) || !PathManager.Instance.IsPathClear(spawnPosPC, pos, c, 5))
2098 {
2099 c.pos.Set(spawnPosPC);
2100 if (!spawnPosPC.ForeachNearestPoint(delegate(Point p)
2101 {
2102 if (PathManager.Instance.IsPathClear(spawnPosPC, p, c, 5) && !p.Equals(spawnPosPC))
2103 {
2104 pos.Set(p);
2105 return true;
2106 }
2107 return false;
2108 }, false, false, true, true))
2109 {
2110 pos.Set(spawnPosPC);
2111 }
2112 }
2113 }
2114 c.pos.Set(pos);
2115 c.global.transition = null;
2116 }
2117 this.map.charas.Add(c);
2118 this.map.AddCardOnActivate(c);
2119 }
2120 }
2121 }
2122 }
2123 foreach (Chara chara2 in EClass.player.listSummon)
2124 {
2125 Point nearestPoint = spawnPosPC.GetNearestPoint(false, false, true, true);
2126 chara2.enemy = null;
2127 chara2.pos.Set(nearestPoint);
2128 this.map.charas.Add(chara2);
2129 this.map.AddCardOnActivate(chara2);
2130 }
2131 EClass.player.listSummon.Clear();
2132 }
2133
2134 // Token: 0x0600356D RID: 13677 RVA: 0x001205B4 File Offset: 0x0011E7B4
2135 public void Deactivate()
2136 {
2137 base.isPeace = false;
2138 this.OnBeforeDeactivate();
2139 if (this.IsPCFaction)
2140 {
2141 foreach (Chara chara in this.branch.members)
2142 {
2143 chara.ValidateWorks();
2144 }
2145 }
2146 EClass.game.lastActiveZone = EClass.game.activeZone;
2147 base.lastActive = EClass.world.date.GetRaw(0);
2148 this.map.OnDeactivate();
2149 EClass.scene.Clear();
2150 EClass.game.activeZone = null;
2151 if (this.IsInstance)
2152 {
2153 this.UnloadMap();
2154 base.isGenerated = false;
2155 }
2156 if (Zone.forceRegenerate)
2157 {
2158 this.UnloadMap();
2159 }
2160 this.OnDeactivate();
2161 }
2162
2163 // Token: 0x0600356E RID: 13678 RVA: 0x00120690 File Offset: 0x0011E890
2164 public void OnKillGame()
2165 {
2166 foreach (Thing thing in this.map.things)
2167 {
2168 if (thing.renderer.hasActor)
2169 {
2170 thing.renderer.KillActor();
2171 }
2172 }
2173 }
2174
2175 // Token: 0x0600356F RID: 13679 RVA: 0x001206FC File Offset: 0x0011E8FC
2176 public void UnloadMap()
2177 {
2178 this.map = null;
2179 if (this.bp != null)
2180 {
2181 this.bp.map = null;
2182 }
2183 if (this.branch != null)
2184 {
2185 this.branch.OnUnloadMap();
2186 }
2187 Debug.Log("Unloaded Map:" + ((this != null) ? this.ToString() : null));
2188 }
2189
2190 // Token: 0x06003570 RID: 13680 RVA: 0x00120754 File Offset: 0x0011E954
2191 public void ClaimZone(bool debug = false)
2192 {
2193 EClass._map.RevealAll(true);
2194 this.SetMainFaction(EClass.pc.faction);
2195 this.branch = new FactionBranch();
2196 this.branch.OnCreate(this);
2197 if (base.icon == 0)
2198 {
2199 base.icon = 332;
2200 }
2201 this.instance = null;
2202 base.dateExpire = 0;
2203 base.SetInt(2, EClass.world.date.GetRaw(0));
2204 base.Register();
2205 foreach (Thing thing in this.map.things)
2206 {
2207 thing.isNPCProperty = false;
2208 }
2209 EClass.Branch.OnClaimZone();
2210 EClass.scene.elomap.SetZone(EClass._zone.x, EClass._zone.y, EClass._zone, true);
2211 if (debug)
2212 {
2213 for (int i = 0; i < 7; i++)
2214 {
2215 Chara chara = CharaGen.CreateFromFilter("c_neutral", -1, -1);
2216 EClass._zone.AddCard(chara, EClass._map.bounds.GetRandomPoint().GetNearestPoint(false, false, false, false));
2217 this.branch.AddMemeber(chara);
2218 }
2219 }
2220 else
2221 {
2222 Msg.Say("claimedZone");
2223 EClass.Branch.Log("claimedZone", null, null, null, null);
2224 EClass.Sound.Play("jingle_embark");
2225 EClass.pc.PlaySound("build", 1f, true);
2226 Effect.Get("aura_heaven").Play(EClass.pc.pos, 0f, null, null);
2227 Point nearestPoint = EClass.pc.pos.GetNearestPoint(false, true, false, false);
2228 EClass._zone.AddCard(ThingGen.Create("core_zone", -1, -1), nearestPoint).SetPlaceState(PlaceState.installed, false);
2229 }
2230 base.idPrefix = 0;
2231 EClass.player.spawnZone = EClass._zone;
2232 }
2233
2234 // Token: 0x06003571 RID: 13681 RVA: 0x0012094C File Offset: 0x0011EB4C
2235 public void AbandonZone()
2236 {
2237 FactionBranch destBranch = (EClass.pc.homeBranch == this.branch) ? EClass.game.StartZone.branch : EClass.pc.homeBranch;
2238 this.branch.members.ForeachReverse(delegate(Chara m)
2239 {
2240 destBranch.AddMemeber(m);
2241 if (!m.IsPCParty)
2242 {
2243 m.MoveZone(destBranch.owner, ZoneTransition.EnterState.Auto);
2244 }
2245 });
2246 EClass.Branch.OnUnclaimZone();
2247 this.SetMainFaction(null);
2248 base.dateExpire = EClass.world.date.GetRaw(0) + 10080;
2249 }
2250
2251 // Token: 0x06003572 RID: 13682 RVA: 0x001209DC File Offset: 0x0011EBDC
2252 public bool CanDestroy()
2253 {
2254 if (this.IsActiveZone || this.IsPCFaction || EClass.player.simulatingZone)
2255 {
2256 return false;
2257 }
2258 if (this.IsInstance)
2259 {
2260 return true;
2261 }
2262 if (base.dateExpire == 0 || !EClass.world.date.IsExpired(base.dateExpire))
2263 {
2264 return false;
2265 }
2266 Zone topZone = this.GetTopZone();
2267 return (base.isRandomSite || this is Zone_Field || (topZone != null && topZone != this && topZone.FindDeepestZone() != this)) && EClass.pc.currentZone != null && !(EClass.pc.currentZone is Zone_Tent) && topZone != EClass.pc.currentZone.GetTopZone() && (EClass.player.nextZone == null || topZone != EClass.player.nextZone.GetTopZone());
2268 }
2269
2270 // Token: 0x06003573 RID: 13683 RVA: 0x00120AAC File Offset: 0x0011ECAC
2271 public override void _OnBeforeSave()
2272 {
2273 if (this.CanDestroy())
2274 {
2275 Debug.Log("Deleting Zone:" + ((this != null) ? this.ToString() : null));
2276 if (!this.destryoed)
2277 {
2278 this.Destroy();
2279 }
2280 return;
2281 }
2282 if (this.map != null)
2283 {
2284 Debug.Log("Saving Zone:" + ((this != null) ? this.ToString() : null));
2285 this.map.Save(base.pathSave, null, null);
2286 if (!base.isMapSaved)
2287 {
2288 base.isMapSaved = true;
2289 IO.DeleteDirectory(base.pathSave + "Texture Replace");
2290 IO.CopyDir(this.pathTemp + "Texture Replace", base.pathSave + "/Texture Replace", null);
2291 }
2292 if (!this.IsActiveZone)
2293 {
2294 this.UnloadMap();
2295 }
2296 }
2297 }
2298
2299 // Token: 0x06003574 RID: 13684 RVA: 0x00120B7E File Offset: 0x0011ED7E
2300 public override void OnLoad()
2301 {
2302 if (this.branch != null)
2303 {
2304 this.branch.SetOwner(this);
2305 }
2306 this.events.OnLoad(this);
2307 }
2308
2309 // Token: 0x06003575 RID: 13685 RVA: 0x00120BA0 File Offset: 0x0011EDA0
2310 public override void Destroy()
2311 {
2312 this.children.ForeachReverse(delegate(Spatial z)
2313 {
2314 z.Destroy();
2315 });
2316 if (this.map != null)
2317 {
2318 this.UnloadMap();
2319 }
2320 if (this.parent != null && this.parent.IsRegion && this.instance == null)
2321 {
2322 EClass.scene.elomap.SetZone(base.x, base.y, null, true);
2323 }
2324 EClass.game.spatials.Remove(this);
2325 this.destryoed = true;
2326 base.isGenerated = false;
2327 }
2328
2329 // Token: 0x06003576 RID: 13686 RVA: 0x00120C40 File Offset: 0x0011EE40
2330 public void ClearZones(Zone current = null)
2331 {
2332 if (this.map != null)
2333 {
2334 this.UnloadMap();
2335 }
2336 base.isGenerated = false;
2337 Zone topZone = this.GetTopZone();
2338 if (topZone != this)
2339 {
2340 topZone.ClearZones(this);
2341 return;
2342 }
2343 this.children.ForeachReverse(delegate(Spatial c)
2344 {
2345 if (c != current)
2346 {
2347 c.Destroy();
2348 }
2349 });
2350 }
2351
2352 // Token: 0x06003577 RID: 13687 RVA: 0x00120C99 File Offset: 0x0011EE99
2353 public void OnChildNumChange(Card c)
2354 {
2355 }
2356
2357 // Token: 0x06003578 RID: 13688 RVA: 0x00120C9B File Offset: 0x0011EE9B
2358 public ICardParent GetRoot()
2359 {
2360 return this;
2361 }
2362
2363 // Token: 0x06003579 RID: 13689 RVA: 0x00120C9E File Offset: 0x0011EE9E
2364 public Zone GetTopZone()
2365 {
2366 if (this.parent == null || this.parent.IsRegion)
2367 {
2368 return this;
2369 }
2370 return this.parent as Zone;
2371 }
2372
2373 // Token: 0x0600357A RID: 13690 RVA: 0x00120CC4 File Offset: 0x0011EEC4
2374 public Card AddCardSplinkle(Card t, Point center, int radius = 4)
2375 {
2376 Point point = new Point(center);
2377 for (int i = 0; i < 1000; i++)
2378 {
2379 point.x = center.x + EClass.rnd(radius) - EClass.rnd(radius);
2380 point.z = center.z + EClass.rnd(radius) - EClass.rnd(radius);
2381 if (point.IsValid && !point.IsBlocked && !point.HasChara)
2382 {
2383 return this.AddCard(t, point);
2384 }
2385 }
2386 return this.AddCard(t, center);
2387 }
2388
2389 // Token: 0x0600357B RID: 13691 RVA: 0x00120D45 File Offset: 0x0011EF45
2390 public Card AddChara(string id, int x, int z)
2391 {
2392 return this.AddCard(CharaGen.Create(id, -1), x, z);
2393 }
2394
2395 // Token: 0x0600357C RID: 13692 RVA: 0x00120D56 File Offset: 0x0011EF56
2396 public Card AddThing(string id, int x, int z)
2397 {
2398 return this.AddCard(ThingGen.Create(id, -1, -1), x, z);
2399 }
2400
2401 // Token: 0x0600357D RID: 13693 RVA: 0x00120D68 File Offset: 0x0011EF68
2402 public Card AddThing(string id, Point p)
2403 {
2404 return this.AddThing(id, p.x, p.z);
2405 }
2406
2407 // Token: 0x0600357E RID: 13694 RVA: 0x00120D7D File Offset: 0x0011EF7D
2408 public Card AddCard(Card t, Point point)
2409 {
2410 return this.AddCard(t, point.x, point.z);
2411 }
2412
2413 // Token: 0x0600357F RID: 13695 RVA: 0x00120D92 File Offset: 0x0011EF92
2414 public Card AddCard(Card t)
2415 {
2416 return this.AddCard(t, 0, 0);
2417 }
2418
2419 // Token: 0x06003580 RID: 13696 RVA: 0x00120DA0 File Offset: 0x0011EFA0
2420 public Card AddCard(Card t, int x, int z)
2421 {
2422 if (t.parent != null)
2423 {
2424 t.parent.RemoveCard(t);
2425 }
2426 t.parent = this;
2427 Chara chara = t.Chara;
2428 if (chara != null)
2429 {
2430 chara.currentZone = this;
2431 chara.SetAI(new NoGoal());
2432 }
2433 if (this.IsActiveZone)
2434 {
2435 this.map.OnCardAddedToZone(t, x, z);
2436 if (this.isStarted && t.isThing && t.placeState == PlaceState.roaming && !Zone.ignoreSpawnAnime)
2437 {
2438 t.PlayAnimeLoot();
2439 }
2440 Zone.ignoreSpawnAnime = false;
2441 }
2442 return t;
2443 }
2444
2445 // Token: 0x06003581 RID: 13697 RVA: 0x00120E28 File Offset: 0x0011F028
2446 public void RemoveCard(Card t)
2447 {
2448 if (this.IsActiveZone)
2449 {
2450 this.map.OnCardRemovedFromZone(t);
2451 }
2452 t.parent = null;
2453 if (t.isChara)
2454 {
2455 t.Chara.currentZone = null;
2456 }
2457 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
2458 {
2459 EClass.scene.RemoveActorEx(t);
2460 }
2461 if (t.renderer.hasActor)
2462 {
2463 t.renderer.OnLeaveScreen();
2464 }
2465 }
2466
2467 // Token: 0x06003582 RID: 13698 RVA: 0x00120EA1 File Offset: 0x0011F0A1
2468 public T GetRandomSpot<T>() where T : Trait
2469 {
2470 return EClass._map.props.installed.traits.GetRandomThing<T>() as T;
2471 }
2472
2473 // Token: 0x06003583 RID: 13699 RVA: 0x00120EC8 File Offset: 0x0011F0C8
2474 public bool TryAddThingInSpot<T>(Thing t, bool useContainer = true, bool putRandomPosIfNoSpot = true) where T : Trait
2475 {
2476 Thing randomThing = EClass._map.props.installed.traits.GetRandomThing<T>();
2477 if (randomThing != null)
2478 {
2479 if (useContainer && (!t.IsContainer || t.things.Count == 0))
2480 {
2481 List<Thing> list = new List<Thing>();
2482 foreach (Point point in randomThing.trait.ListPoints(null, false))
2483 {
2484 foreach (Card card in point.ListCards(false))
2485 {
2486 if (card.IsContainer)
2487 {
2488 list.Add(card.Thing);
2489 }
2490 }
2491 }
2492 if (this.TryAddThingInSharedContainer(t, list, true, false, null, false))
2493 {
2494 return true;
2495 }
2496 }
2497 this.AddCard(t, randomThing.trait.GetRandomPoint(null));
2498 return true;
2499 }
2500 if (putRandomPosIfNoSpot)
2501 {
2502 this.AddCard(t, EClass._map.bounds.GetRandomSurface(false, true, false));
2503 return true;
2504 }
2505 return false;
2506 }
2507
2508 // Token: 0x06003584 RID: 13700 RVA: 0x00120FF4 File Offset: 0x0011F1F4
2509 public List<Thing> TryListThingsInSpot<T>(Func<Thing, bool> func = null) where T : TraitSpot
2510 {
2511 Zone.<>c__DisplayClass252_0<T> CS$<>8__locals1 = new Zone.<>c__DisplayClass252_0<T>();
2512 CS$<>8__locals1.func = func;
2513 List<T> list = new List<T>();
2514 List<Thing> list2 = new List<Thing>();
2515 foreach (Thing thing in EClass._map.things)
2516 {
2517 if (thing.IsInstalled && thing.trait is T)
2518 {
2519 list.Add(thing.trait as T);
2520 }
2521 }
2522 foreach (T t in list)
2523 {
2524 foreach (Point point in t.ListPoints(null, false))
2525 {
2526 foreach (Thing thing2 in point.Things)
2527 {
2528 if (thing2.IsInstalled)
2529 {
2530 if (thing2.things.Count == 0)
2531 {
2532 if (CS$<>8__locals1.<TryListThingsInSpot>g__IsValid|0(thing2))
2533 {
2534 list2.Add(thing2);
2535 }
2536 }
2537 else
2538 {
2539 ThingContainer things = thing2.things;
2540 Func<Thing, bool> func2;
2541 if ((func2 = CS$<>8__locals1.<>9__1) == null)
2542 {
2543 func2 = (CS$<>8__locals1.<>9__1 = ((Thing _t) => base.<TryListThingsInSpot>g__IsValid|0(_t)));
2544 }
2545 foreach (Thing item in things.List(func2, false))
2546 {
2547 list2.Add(item);
2548 }
2549 }
2550 }
2551 }
2552 }
2553 }
2554 return list2;
2555 }
2556
2557 // Token: 0x06003585 RID: 13701 RVA: 0x00121228 File Offset: 0x0011F428
2558 public bool TryAddThingInSharedContainer(Thing t, List<Thing> containers = null, bool add = true, bool msg = false, Chara chara = null, bool sharedOnly = true)
2559 {
2560 Zone.<>c__DisplayClass253_0 CS$<>8__locals1;
2561 CS$<>8__locals1.containers = containers;
2562 CS$<>8__locals1.sharedOnly = sharedOnly;
2563 CS$<>8__locals1.add = add;
2564 CS$<>8__locals1.t = t;
2565 CS$<>8__locals1.msg = msg;
2566 CS$<>8__locals1.chara = chara;
2567 CS$<>8__locals1.dest = null;
2568 CS$<>8__locals1.priority = -1;
2569 CS$<>8__locals1.flag = CS$<>8__locals1.t.category.GetRoot().id.ToEnum(true);
2570 if (CS$<>8__locals1.flag == ContainerFlag.none)
2571 {
2572 CS$<>8__locals1.flag = ContainerFlag.other;
2573 }
2574 if (CS$<>8__locals1.containers == null)
2575 {
2576 CS$<>8__locals1.containers = EClass._map.props.installed.containers;
2577 }
2578 if (Zone.<TryAddThingInSharedContainer>g__SearchDest|253_0(ref CS$<>8__locals1) != null)
2579 {
2580 return true;
2581 }
2582 if (CS$<>8__locals1.dest == null)
2583 {
2584 return false;
2585 }
2586 if (CS$<>8__locals1.add)
2587 {
2588 if (CS$<>8__locals1.msg)
2589 {
2590 CS$<>8__locals1.chara.Say("putSharedItem", CS$<>8__locals1.chara, CS$<>8__locals1.t, CS$<>8__locals1.dest.GetName(NameStyle.Full, -1), null);
2591 }
2592 CS$<>8__locals1.dest.AddThing(CS$<>8__locals1.t, true, -1, -1);
2593 }
2594 return true;
2595 }
2596
2597 // Token: 0x06003586 RID: 13702 RVA: 0x00121338 File Offset: 0x0011F538
2598 public bool TryAddThing(Thing target, Point p, bool destroyIfFail = false)
2599 {
2600 int num = 0;
2601 if (p.cell.detail != null)
2602 {
2603 foreach (Thing thing in p.cell.detail.things)
2604 {
2605 if (thing.placeState == PlaceState.roaming)
2606 {
2607 if (target.TryStackTo(thing))
2608 {
2609 return true;
2610 }
2611 num++;
2612 }
2613 }
2614 }
2615 if (num == 0 || !destroyIfFail)
2616 {
2617 EClass._zone.AddCard(target, p);
2618 return true;
2619 }
2620 target.Destroy();
2621 return false;
2622 }
2623
2624 // Token: 0x06003587 RID: 13703 RVA: 0x001213D4 File Offset: 0x0011F5D4
2625 public Thing TryGetThingFromSharedContainer(Func<Thing, bool> func)
2626 {
2627 foreach (Thing thing in EClass._map.props.installed.containers)
2628 {
2629 if (thing.IsSharedContainer)
2630 {
2631 Thing thing2 = thing.things.Find(func, true);
2632 if (thing2 != null)
2633 {
2634 return thing2;
2635 }
2636 }
2637 }
2638 return null;
2639 }
2640
2641 // Token: 0x06003588 RID: 13704 RVA: 0x00121450 File Offset: 0x0011F650
2642 public Thing TryGetRestock<T>(string idCat) where T : TraitSpot
2643 {
2644 Zone.<>c__DisplayClass256_0<T> CS$<>8__locals1 = new Zone.<>c__DisplayClass256_0<T>();
2645 CS$<>8__locals1.idCat = idCat;
2646 List<T> list = new List<T>();
2647 foreach (Thing thing in EClass._map.things)
2648 {
2649 if (thing.IsInstalled && thing.trait is T)
2650 {
2651 list.Add(thing.trait as T);
2652 }
2653 }
2654 foreach (T t in list)
2655 {
2656 foreach (Point point in t.ListPoints(null, false))
2657 {
2658 foreach (Thing thing2 in point.Things)
2659 {
2660 if (thing2.IsInstalled && !thing2.isSale)
2661 {
2662 if (thing2.things.Count == 0)
2663 {
2664 if (CS$<>8__locals1.<TryGetRestock>g__IsValid|0(thing2, false))
2665 {
2666 return thing2;
2667 }
2668 }
2669 else
2670 {
2671 ThingContainer things = thing2.things;
2672 Func<Thing, bool> func;
2673 if ((func = CS$<>8__locals1.<>9__1) == null)
2674 {
2675 func = (CS$<>8__locals1.<>9__1 = ((Thing _t) => base.<TryGetRestock>g__IsValid|0(_t, true)));
2676 }
2677 Thing thing3 = things.Find(func, true);
2678 if (thing3 != null)
2679 {
2680 return thing3;
2681 }
2682 }
2683 }
2684 }
2685 }
2686 }
2687 return null;
2688 }
2689
2690 // Token: 0x06003589 RID: 13705 RVA: 0x00121610 File Offset: 0x0011F810
2691 public ZoneProfile GetProfile()
2692 {
2693 string text = this.IdProfile;
2694 if (text.IsEmpty())
2695 {
2696 Region region = this.parent as Region;
2697 if (base.lv != 0)
2698 {
2699 text = ((base.lv < 0) ? "Underground" : "Sky");
2700 }
2701 else if (region != null)
2702 {
2703 EClass.scene.elomapActor.Initialize(region.elomap);
2704 text = EClass.scene.elomapActor.elomap.GetTileInfo(base.x, base.y).idZoneProfile;
2705 if (this.bp != null)
2706 {
2707 this.name = Lang.GetList("zone_" + text.Split('/', StringSplitOptions.None)[1]).RandomItem<string>();
2708 this.bp.surrounding = new EloMap.TileInfo[3, 3];
2709 for (int i = 0; i < 3; i++)
2710 {
2711 for (int j = 0; j < 3; j++)
2712 {
2713 this.bp.surrounding[j, i] = EClass.scene.elomapActor.elomap.GetTileInfo(base.x - 1 + j, base.y - 1 + i);
2714 }
2715 }
2716 if (text == "Random/R_Shore")
2717 {
2718 base.isBeach = true;
2719 }
2720 }
2721 }
2722 else
2723 {
2724 text = "Random";
2725 }
2726 this.idProfile = text;
2727 }
2728 return ZoneProfile.Load(text);
2729 }
2730
2731 // Token: 0x0600358A RID: 13706 RVA: 0x0012175C File Offset: 0x0011F95C
2732 public void CreateBP()
2733 {
2734 this.bp = new ZoneBlueprint();
2735 this.bp.Create();
2736 this.bp.genSetting.seed = base.Seed;
2737 this.OnCreateBP();
2738 }
2739
2740 // Token: 0x0600358B RID: 13707 RVA: 0x00121790 File Offset: 0x0011F990
2741 public virtual void OnCreateBP()
2742 {
2743 }
2744
2745 // Token: 0x0600358C RID: 13708 RVA: 0x00121794 File Offset: 0x0011F994
2746 public void Generate()
2747 {
2748 base.isGenerated = true;
2749 if (this.bp == null)
2750 {
2751 this.CreateBP();
2752 }
2753 if (this.bp.map == null)
2754 {
2755 this.bp.GenerateMap(this);
2756 }
2757 this.map.SetZone(this);
2758 if (this is Zone_Field)
2759 {
2760 if (EClass.rnd(3) == 0)
2761 {
2762 int num = EClass.rnd(2);
2763 for (int i = 0; i < num; i++)
2764 {
2765 Point randomSurface = EClass._map.bounds.GetRandomSurface(false, true, false);
2766 if (!randomSurface.HasObj)
2767 {
2768 Card t = ThingGen.Create("chest3", -1, -1).ChangeMaterial(this.biome.style.matDoor);
2769 EClass._zone.AddCard(t, randomSurface).Install();
2770 }
2771 }
2772 }
2773 if (EClass.rnd(8) == 0)
2774 {
2775 this.SpawnAltar();
2776 }
2777 if (EClass.debug.enable || EClass.rnd(20) == 0)
2778 {
2779 this.SpawnFollower();
2780 }
2781 }
2782 this.map.plDay = this.CreatePlaylist(ref this.map._plDay, EClass.Sound.GetPlaylist(this.IDPlayList) ?? EClass.Sound.GetPlaylist("Day"));
2783 }
2784
2785 // Token: 0x0600358D RID: 13709 RVA: 0x001218B8 File Offset: 0x0011FAB8
2786 public void SpawnFollower()
2787 {
2788 Point randomSurface = EClass._map.bounds.GetRandomSurface(false, true, false);
2789 if (!randomSurface.IsValid)
2790 {
2791 return;
2792 }
2793 Chara c = CharaGen.Create("follower", -1);
2794 EClass._zone.AddCard(c, randomSurface);
2795 (EClass._zone.AddThing("gallows", randomSurface).Install().trait as TraitShackle).Restrain(c, false);
2796 c.c_rescueState = RescueState.WaitingForRescue;
2797 if (EClass.rnd(2) == 0)
2798 {
2799 SourceBacker.Row row = EClass.sources.backers.listFollower.NextItem(ref BackerContent.indexFollower);
2800 if (row != null)
2801 {
2802 c.ApplyBacker(row.id);
2803 }
2804 }
2805 Religion faith = (from a in EClass.game.religions.dictAll.Values
2806 where a != c.faith
2807 select a).RandomItem<Religion>();
2808 for (int i = 0; i < 3 + EClass.rnd(4); i++)
2809 {
2810 Chara chara = CharaGen.Create("fanatic", -1);
2811 chara.SetFaith(faith);
2812 Point point = randomSurface.GetRandomPoint(4, true, true, false, 100) ?? randomSurface.GetNearestPoint(false, true, true, false);
2813 EClass._zone.AddCard(chara, point);
2814 }
2815 }
2816
2817 // Token: 0x0600358E RID: 13710 RVA: 0x001219F9 File Offset: 0x0011FBF9
2818 public void SpawnAltar()
2819 {
2820 EClass.core.refs.crawlers.start.CrawlUntil(this.map, () => this.map.poiMap.GetCenterCell(1).GetCenter(), 1, delegate(Crawler.Result r)
2821 {
2822 if (r.points.Count <= 4)
2823 {
2824 return false;
2825 }
2826 this.map.poiMap.OccyupyPOI(r.points[0], 0);
2827 List<Point> points = r.points;
2828 Religion randomReligion = EClass.game.religions.GetRandomReligion(true, false);
2829 "altarPoint".lang(randomReligion.NameDomain.lang(), null, null, null, null);
2830 Thing thing = ThingGen.Create("altar", -1, -1);
2831 (thing.trait as TraitAltar).SetDeity(randomReligion.id);
2832 Chara t = CharaGen.Create("twintail", -1);
2833 EClass._zone.AddCard(t, points.RandomItem<Point>());
2834 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2835 {
2836 Chara t2 = CharaGen.Create("twintail", -1);
2837 EClass._zone.AddCard(t2, points.RandomItem<Point>());
2838 }
2839 if (points[0].Installed == null)
2840 {
2841 EClass._zone.AddCard(thing, points[0]).Install();
2842 }
2843 foreach (Point point in points)
2844 {
2845 if (point.x % 3 == 0 && point.z % 2 == 0 && point != points[0] && !point.Equals(points[0].Front) && point.Installed == null)
2846 {
2847 thing = ThingGen.Create("pillar1", -1, -1);
2848 EClass._zone.AddCard(thing, point).Install();
2849 }
2850 point.SetObj(0, 1, 0);
2851 point.SetFloor(3, 6);
2852 }
2853 return true;
2854 }, null);
2855 }
2856
2857 // Token: 0x0600358F RID: 13711 RVA: 0x00121A38 File Offset: 0x0011FC38
2858 public virtual void OnGenerateMap()
2859 {
2860 if (this.MakeEnemiesNeutral)
2861 {
2862 foreach (Chara chara in EClass._map.charas)
2863 {
2864 if (!chara.IsGlobal && chara.hostility < Hostility.Neutral)
2865 {
2866 chara.hostility = (chara.c_originalHostility = Hostility.Neutral);
2867 }
2868 }
2869 }
2870 if (this.PrespawnRate != 0f && !this.IsSkyLevel)
2871 {
2872 for (int i = 0; i < (int)((float)this.MaxSpawn * this.PrespawnRate); i++)
2873 {
2874 this.SpawnMob(null, null);
2875 }
2876 }
2877 this.TryGenerateOre();
2878 this.TryGenerateBigDaddy();
2879 this.TryGenerateEvolved(false);
2880 this.TryGenerateShrine();
2881 }
2882
2883 // Token: 0x06003590 RID: 13712 RVA: 0x00121B04 File Offset: 0x0011FD04
2884 public void TryGenerateOre()
2885 {
2886 if (this.OreChance <= 0f)
2887 {
2888 return;
2889 }
2890 Crawler crawler = Crawler.Create("ore");
2891 int tries = EClass.rnd((int)((float)(this.map.bounds.Width * this.map.bounds.Height / 200 + 1) * this.OreChance + 2f));
2892 crawler.CrawlUntil(EClass._map, () => EClass._map.bounds.GetRandomPoint(), tries, delegate(Crawler.Result r)
2893 {
2894 byte b = 18;
2895 string group = "ore";
2896 if (EClass.rnd(5) == 0)
2897 {
2898 b += 1;
2899 group = "gem";
2900 }
2901 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(this.DangerLv, group, false);
2902 foreach (Point point in r.points)
2903 {
2904 if (point.sourceBlock.ContainsTag("ore"))
2905 {
2906 this.map.SetObj(point.x, point.z, randomMaterial.id, (int)b, 1, 0);
2907 }
2908 }
2909 return false;
2910 }, null);
2911 }
2912
2913 // Token: 0x06003591 RID: 13713 RVA: 0x00121BA0 File Offset: 0x0011FDA0
2914 public void TryGenerateEvolved(bool force = false)
2915 {
2916 if (!force && this.EvolvedChance <= EClass.rndf(1f))
2917 {
2918 return;
2919 }
2920 Chara chara = this.SpawnMob(null, SpawnSetting.Evolved());
2921 for (int i = 0; i < 2 + EClass.rnd(2); i++)
2922 {
2923 chara.ability.AddRandom();
2924 }
2925 chara.AddThing(chara.MakeGene(new DNA.Type?(DNA.Type.Default)), true, -1, -1);
2926 if (EClass.rnd(2) == 0)
2927 {
2928 chara.AddThing(chara.MakeGene(new DNA.Type?(DNA.Type.Superior)), true, -1, -1);
2929 }
2930 }
2931
2932 // Token: 0x06003592 RID: 13714 RVA: 0x00121C24 File Offset: 0x0011FE24
2933 public void TryGenerateBigDaddy()
2934 {
2935 if (this.BigDaddyChance <= EClass.rndf(1f))
2936 {
2937 return;
2938 }
2939 int num = this.DangerLv * 125 / 100;
2940 if (num >= 30)
2941 {
2943 {
2944 lv = num
2945 });
2946 }
2947 Chara t = CharaGen.Create("big_daddy", -1);
2948 EClass._zone.AddCard(t, this.GetSpawnPos(SpawnPosition.Random, 10000));
2949 Msg.Say("sign_bigdaddy");
2950 }
2951
2952 // Token: 0x06003593 RID: 13715 RVA: 0x00121C98 File Offset: 0x0011FE98
2953 public void TryGenerateShrine()
2954 {
2955 for (int i = 0; i < 3; i++)
2956 {
2957 Rand.SetSeed(base.uid + i);
2958 if (this.ShrineChance > EClass.rndf(1f))
2959 {
2960 Point randomSpace = EClass._map.GetRandomSpace(3, 3, 100);
2961 if (randomSpace != null)
2962 {
2963 randomSpace.x++;
2964 randomSpace.z++;
2965 if (!randomSpace.HasThing && !randomSpace.HasChara)
2966 {
2967 randomSpace.SetObj(0, 1, 0);
2968 Rand.SetSeed(EClass.player.seedShrine);
2969 EClass.player.seedShrine++;
2970 if (EClass.rnd(EClass.debug.test ? 2 : 15) == 0)
2971 {
2972 EClass._zone.AddCard(ThingGen.Create("pedestal_power", -1, -1), randomSpace).Install();
2973 EClass._zone.AddCard(ThingGen.Create(EClass.gamedata.godStatues.RandomItemWeighted((GodStatueData a) => a.chance).idThing, -1, this.DangerLv), randomSpace).Install();
2974 }
2975 else
2976 {
2977 EClass._zone.AddCard(ThingGen.Create("statue_power", -1, this.DangerLv), randomSpace).Install().SetRandomDir();
2978 }
2979 }
2980 }
2981 }
2982 }
2983 Rand.SetSeed(-1);
2984 }
2985
2986 // Token: 0x06003594 RID: 13716 RVA: 0x00121E00 File Offset: 0x00120000
2987 public void ResetHostility()
2988 {
2989 foreach (Chara chara in EClass._map.charas)
2990 {
2991 chara.hostility = chara.OriginalHostility;
2992 if (chara.enemy != null && (chara.enemy.IsPCFaction || chara.IsPCFaction))
2993 {
2994 chara.SetEnemy(null);
2995 }
2996 }
2997 }
2998
2999 // Token: 0x06003595 RID: 13717 RVA: 0x00121E84 File Offset: 0x00120084
3000 public virtual void OnGenerateRooms(BaseMapGen gen)
3001 {
3002 }
3003
3004 // Token: 0x06003596 RID: 13718 RVA: 0x00121E88 File Offset: 0x00120088
3005 public Point GetSpawnPos(SpawnPosition type, int tries = 100)
3006 {
3007 Point point = new Point();
3008 for (int i = 0; i < tries; i++)
3009 {
3010 point = EClass._map.bounds.GetRandomSurface(false, true, true);
3011 if (point.IsValid && !point.cell.hasDoor && !point.IsSync && (type != SpawnPosition.Outside || (!point.cell.HasRoof && point.cell.light <= 0)))
3012 {
3013 return point;
3014 }
3015 }
3016 return null;
3017 }
3018
3019 // Token: 0x06003597 RID: 13719 RVA: 0x00121EFC File Offset: 0x001200FC
3020 public Chara SpawnMob(Point pos = null, SpawnSetting setting = null)
3021 {
3022 if (setting == null)
3023 {
3024 setting = SpawnSetting.Default;
3025 }
3026 if (pos == null)
3027 {
3028 pos = this.GetSpawnPos(setting.position, setting.tries);
3029 if (pos == null)
3030 {
3031 pos = this.GetSpawnPos(SpawnPosition.Random, setting.tries);
3032 if (pos == null)
3033 {
3034 return null;
3035 }
3036 }
3037 }
3038 BiomeProfile biome = pos.cell.biome;
3039 SpawnList spawnList;
3040 if (setting.idSpawnList != null)
3041 {
3042 spawnList = SpawnList.Get(setting.idSpawnList, null, null);
3043 }
3044 else if (setting.hostility == SpawnHostility.Neutral || (setting.hostility != SpawnHostility.Enemy && Rand.Range(0f, 1f) < this.ChanceSpawnNeutral))
3045 {
3046 spawnList = SpawnList.Get("c_neutral", null, null);
3047 }
3048 else if (biome.spawn.chara.Count > 0)
3049 {
3050 spawnList = SpawnList.Get(biome.spawn.GetRandomCharaId(), null, null);
3051 }
3052 else
3053 {
3054 spawnList = SpawnList.Get(biome.name, "chara", new CharaFilter
3055 {
3056 ShouldPass = ((SourceChara.Row s) => !(s.hostility != "") && (s.biome == biome.name || s.biome.IsEmpty()))
3057 });
3058 }
3059 int dangerLv = this.DangerLv;
3060 CardBlueprint cardBlueprint = new CardBlueprint
3061 {
3062 rarity = Rarity.Normal
3063 };
3064 int lv = (setting.filterLv == -1) ? dangerLv : setting.filterLv;
3065 if (this.ScaleMonsterLevel)
3066 {
3067 lv = ((dangerLv - 1) % 50 + 5) * 150 / 100;
3068 }
3069 CardRow cardRow = setting.id.IsEmpty() ? spawnList.Select(lv, setting.levelRange) : EClass.sources.cards.map[setting.id];
3070 int num = (setting.fixedLv == -1) ? cardRow.LV : setting.fixedLv;
3071 if (this.ScaleMonsterLevel)
3072 {
3073 num = (50 + cardRow.LV) * Mathf.Max(1, (dangerLv - 1) / 50);
3074 }
3075 if (setting.rarity == Rarity.Random)
3076 {
3077 if (EClass.rnd(100) == 0)
3078 {
3079 cardBlueprint.rarity = Rarity.Legendary;
3080 num = num * 125 / 100;
3081 }
3082 }
3083 else
3084 {
3085 cardBlueprint.rarity = setting.rarity;
3086 }
3087 if (setting.isBoss)
3088 {
3089 num = num * 150 / 100;
3090 }
3091 if (setting.isEvolved)
3092 {
3093 num = num * 2 + 20;
3094 }
3095 if (num != cardRow.LV)
3096 {
3097 cardBlueprint.lv = num;
3098 }
3099 CardBlueprint.Set(cardBlueprint);
3100 Chara chara = CharaGen.Create(cardRow.id, lv);
3101 this.AddCard(chara, pos);
3102 if (setting.forcedHostility != null)
3103 {
3104 chara.c_originalHostility = (chara.hostility = setting.forcedHostility.Value);
3105 }
3106 if (setting.isBoss)
3107 {
3108 chara.c_bossType = BossType.Boss;
3109 }
3110 if (setting.isEvolved)
3111 {
3112 chara.c_bossType = BossType.Evolved;
3113 }
3114 return chara;
3115 }
3116
3117 // Token: 0x06003598 RID: 13720 RVA: 0x001221A0 File Offset: 0x001203A0
3118 public void RefreshElectricity()
3119 {
3120 this.dirtyElectricity = false;
3121 base.electricity = this.elements.Value(2201) * 10 + this.BaseElectricity;
3122 foreach (Thing thing in EClass._map.things)
3123 {
3124 if (thing.IsInstalled && thing.trait.Electricity != 0 && (thing.isOn || thing.trait.Electricity > 0))
3125 {
3126 base.electricity += thing.trait.Electricity;
3127 }
3128 }
3129 foreach (Thing thing2 in EClass._map.things)
3130 {
3131 if (thing2.IsInstalled)
3132 {
3133 thing2.trait.TryToggle();
3134 }
3135 }
3136 }
3137
3138 // Token: 0x06003599 RID: 13721 RVA: 0x001222AC File Offset: 0x001204AC
3139 public int GetElectricity(bool cost = false)
3140 {
3141 int num = 0;
3142 foreach (Thing thing in EClass._map.things)
3143 {
3144 if (thing.IsInstalled && thing.trait.Electricity != 0)
3145 {
3146 if (cost)
3147 {
3148 if (thing.trait.Electricity < 0)
3149 {
3150 num += -thing.trait.Electricity;
3151 }
3152 }
3153 else if (thing.trait.Electricity > 0)
3154 {
3155 num += thing.trait.Electricity;
3156 }
3157 }
3158 }
3159 if (!cost)
3160 {
3161 num += this.elements.Value(2201) * 10;
3162 }
3163 return num;
3164 }
3165
3166 // Token: 0x0600359A RID: 13722 RVA: 0x0012236C File Offset: 0x0012056C
3167 public void SetBGM(List<int> ids, bool refresh = true)
3168 {
3169 this.map._plDay.Clear();
3170 if (ids.Count > 0)
3171 {
3172 foreach (int num in ids)
3173 {
3174 if (num != -1)
3175 {
3176 this.map._plDay.Add(num);
3177 }
3178 }
3179 }
3180 UnityEngine.Object.DestroyImmediate(this.map.plDay);
3181 this.map.plDay = null;
3182 this.RefreshPlaylist();
3183 if (refresh)
3184 {
3185 EClass.Sound.StopBGM(0f, false);
3186 this.RefreshBGM();
3187 }
3188 }
3189
3190 // Token: 0x0600359B RID: 13723 RVA: 0x0012241C File Offset: 0x0012061C
3191 public void SetBGM(int id = -1, bool refresh = true)
3192 {
3193 this.SetBGM(new List<int>
3194 {
3195 id
3196 }, refresh);
3197 }
3198
3199 // Token: 0x0600359C RID: 13724 RVA: 0x00122434 File Offset: 0x00120634
3200 public void RefreshPlaylist()
3201 {
3202 if (this.map.plDay == null)
3203 {
3204 this.map.plDay = this.CreatePlaylist(ref this.map._plDay, EClass.Sound.GetPlaylist(this.IDPlayList));
3205 }
3206 }
3207
3208 // Token: 0x0600359D RID: 13725 RVA: 0x00122480 File Offset: 0x00120680
3209 public void RefreshBGM()
3210 {
3211 if (!EClass.pc.IsInActiveZone || EClass.player.simulatingZone)
3212 {
3213 return;
3214 }
3215 this.RefreshPlaylist();
3216 Playlist playlist = this.map.plDay;
3217 foreach (ZoneEvent zoneEvent in this.events.list)
3218 {
3219 if (zoneEvent.playlist != null)
3220 {
3221 playlist = zoneEvent.playlist;
3222 }
3223 }
3224 if (this.IDPlaylistOverwrite != null)
3225 {
3226 playlist = EClass.Sound.GetPlaylist(this.IDPlaylistOverwrite);
3227 }
3228 if (EClass.pc.IsInActiveZone)
3229 {
3230 global::Room room = EClass.pc.pos.cell.room;
3231 if (room != null && room.lot != null && room.lot.idBGM != 0)
3232 {
3233 playlist = EClass.Sound.plLot;
3234 BGMData data = playlist.list[0].data;
3235 int? num = (data != null) ? new int?(data.id) : null;
3236 int idBGM = room.lot.idBGM;
3237 if (!(num.GetValueOrDefault() == idBGM & num != null))
3238 {
3239 playlist.list[0].data = EClass.core.refs.dictBGM.TryGetValue(room.lot.idBGM, null);
3240 playlist.Reset();
3241 if (!LayerDrama.keepBGM)
3242 {
3243 EClass.Sound.StopBGM(1f, false);
3244 }
3245 }
3246 }
3247 }
3248 EClass.core.config.SetBGMInterval();
3249 EClass.Sound.SwitchPlaylist(playlist, !LayerDrama.keepBGM);
3250 }
3251
3252 // Token: 0x0600359E RID: 13726 RVA: 0x0012263C File Offset: 0x0012083C
3253 public Playlist CreatePlaylist(ref List<int> list, Playlist mold = null)
3254 {
3255 Playlist playlist = EClass.Sound.plBlank.Instantiate<Playlist>();
3256 if (list.Count == 0 && mold)
3257 {
3258 list = mold.ToInts();
3259 playlist.shuffle = mold.shuffle;
3260 playlist.minSwitchTime = mold.minSwitchTime;
3261 playlist.nextBGMOnSwitch = mold.nextBGMOnSwitch;
3262 playlist.ignoreLoop = mold.ignoreLoop;
3263 }
3264 foreach (int key in list)
3265 {
3266 playlist.list.Add(new Playlist.Item
3267 {
3268 data = EClass.core.refs.dictBGM[key]
3269 });
3270 }
3271 return playlist;
3272 }
3273
3274 // Token: 0x0600359F RID: 13727 RVA: 0x0012270C File Offset: 0x0012090C
3275 public Chara FindChara(string id)
3276 {
3277 return this.map.charas.Find((Chara c) => c.id == id);
3278 }
3279
3280 // Token: 0x060035A0 RID: 13728 RVA: 0x00122744 File Offset: 0x00120944
3281 public Chara FindChara(int uid)
3282 {
3283 return this.map.charas.Find((Chara c) => c.uid == uid);
3284 }
3285
3286 // Token: 0x060035A1 RID: 13729 RVA: 0x0012277C File Offset: 0x0012097C
3287 public int GetDeepestLv()
3288 {
3289 int lv = base.lv;
3290 return this.GetDeepestLv(ref lv);
3291 }
3292
3293 // Token: 0x060035A2 RID: 13730 RVA: 0x00122798 File Offset: 0x00120998
3294 public int GetDeepestLv(ref int max)
3295 {
3296 if (Mathf.Abs(base.lv) > Mathf.Abs(max))
3297 {
3298 max = base.lv;
3299 }
3300 foreach (Spatial spatial in this.children)
3301 {
3302 (spatial as Zone).GetDeepestLv(ref max);
3303 }
3304 return max;
3305 }
3306
3307 // Token: 0x060035A3 RID: 13731 RVA: 0x00122810 File Offset: 0x00120A10
3308 public List<Element> ListLandFeats()
3309 {
3310 if (this.landFeats == null)
3311 {
3312 this.landFeats = new List<int>();
3313 Rand.SetSeed(EClass._zone.uid);
3314 string[] listBase = this.IDBaseLandFeat.Split(',', StringSplitOptions.None);
3315 foreach (string text in listBase)
3316 {
3317 if (!text.IsEmpty())
3318 {
3319 this.landFeats.Add(EClass.sources.elements.alias[text].id);
3320 }
3321 }
3322 if (listBase.Length == 1)
3323 {
3324 List<SourceElement.Row> list = EClass.sources.elements.rows.Where(delegate(SourceElement.Row e)
3325 {
3326 if (e.category != "landfeat" || e.chance == 0)
3327 {
3328 return false;
3329 }
3330 bool result = true;
3331 foreach (string text2 in e.tag)
3332 {
3333 if (text2.StartsWith("bf"))
3334 {
3335 result = false;
3336 if (listBase[0] == text2)
3337 {
3338 result = true;
3339 break;
3340 }
3341 }
3342 }
3343 return result;
3344 }).ToList<SourceElement.Row>();
3345 SourceElement.Row row = list.RandomItemWeighted((SourceElement.Row e) => (float)e.chance);
3346 this.landFeats.Add(row.id);
3347 list.Remove(row);
3348 row = list.RandomItemWeighted((SourceElement.Row e) => (float)e.chance);
3349 this.landFeats.Add(row.id);
3350 }
3351 Rand.SetSeed(-1);
3352 }
3353 List<Element> list2 = new List<Element>();
3354 foreach (int id in this.landFeats)
3355 {
3356 list2.Add(Element.Create(id, 0));
3357 }
3358 return list2;
3359 }
3360
3361 // Token: 0x060035A4 RID: 13732 RVA: 0x001229B0 File Offset: 0x00120BB0
3362 public ZoneExportData Import(string path)
3363 {
3364 ZipFile zipFile = ZipFile.Read(path);
3365 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3366 zipFile.ExtractAll(this.pathTemp);
3367 zipFile.Dispose();
3368 return IO.LoadFile<ZoneExportData>(this.pathTemp + "export", false, null) ?? new ZoneExportData();
3369 }
3370
3371 // Token: 0x060035A5 RID: 13733 RVA: 0x001229F0 File Offset: 0x00120BF0
3372 public void Export(string path, PartialMap partial = null, bool usermap = false)
3373 {
3374 if (this.subset != null)
3375 {
3376 SE.Beep();
3377 return;
3378 }
3379 try
3380 {
3381 ZoneExportData zoneExportData = new ZoneExportData
3382 {
3383 name = this.name,
3384 usermap = usermap
3385 };
3386 IO.CreateTempDirectory(null);
3387 if (!this.map.config.retainDecal)
3388 {
3389 this.map.ClearRainAndDecal();
3390 }
3391 this.map.Save(IO.TempPath + "/", zoneExportData, partial);
3392 this.map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(path), partial);
3393 if (partial == null)
3394 {
3395 IO.CopyDir(base.pathSave + "Texture Replace", IO.TempPath + "/Texture Replace", null);
3396 }
3397 IO.SaveFile(IO.TempPath + "/export", zoneExportData, true, null);
3398 using (ZipFile zipFile = new ZipFile())
3399 {
3400 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
3401 zipFile.AddDirectory(IO.TempPath);
3402 zipFile.Save(path);
3403 zipFile.Dispose();
3404 }
3405 IO.DeleteTempDirectory(null);
3406 }
3407 catch (Exception ex)
3408 {
3409 EClass.ui.Say(ex.Message + ":" + path, null);
3410 }
3411 }
3412
3413 // Token: 0x060035A6 RID: 13734 RVA: 0x00122B3C File Offset: 0x00120D3C
3414 public void ExportDialog(string dir = null)
3415 {
3416 EClass.core.WaitForEndOfFrame(delegate
3417 {
3418 string text = StandaloneFileBrowser.SaveFilePanel("Export Zone", dir ?? CorePath.ZoneSave, "new zone", "z");
3419 if (!string.IsNullOrEmpty(text))
3420 {
3421 this.Export(text, null, false);
3422 Msg.SayRaw("Exported Zone");
3423 }
3424 });
3425 }
3426
3427 // Token: 0x060035A7 RID: 13735 RVA: 0x00122B74 File Offset: 0x00120D74
3428 public void ImportDialog(string dir = null)
3429 {
3430 EClass.core.WaitForEndOfFrame(delegate
3431 {
3432 string[] array = StandaloneFileBrowser.OpenFilePanel("Import Zone", dir ?? CorePath.ZoneSave, "z", false);
3433 if (array.Length != 0)
3434 {
3435 Zone_User zone_User = SpatialGen.Create("user", EClass.world.region, true, -99999, -99999, 0) as Zone_User;
3436 zone_User.path = array[0];
3437 Thing thing = ThingGen.Create("teleporter", -1, -1);
3438 thing.c_uidZone = zone_User.uid;
3439 EClass._zone.AddCard(thing, EClass.pc.pos);
3440 return;
3441 }
3442 });
3443 }
3444
3445 // Token: 0x060035A8 RID: 13736 RVA: 0x00122BAC File Offset: 0x00120DAC
3446 public static bool IsImportValid(string path)
3447 {
3448 bool result;
3449 try
3450 {
3451 MapMetaData metaData = Map.GetMetaData(path);
3452 result = (metaData != null && metaData.IsValidVersion());
3453 }
3454 catch (Exception ex)
3455 {
3456 EClass.ui.Say(ex.Message, null);
3457 result = false;
3458 }
3459 return result;
3460 }
3461
3462 // Token: 0x060035A9 RID: 13737 RVA: 0x00122BF8 File Offset: 0x00120DF8
3463 public void Export()
3464 {
3465 EClass._map.ResetEditorPos();
3466 string pathExport = this.pathExport;
3467 IO.Copy(pathExport, CorePath.ZoneSave + "Backup/");
3468 this.Export(pathExport, null, false);
3469 Msg.Say("Exported Map:" + pathExport);
3470 }
3471
3472 // Token: 0x060035AA RID: 13738 RVA: 0x00122C45 File Offset: 0x00120E45
3473 public void WriteNote(UINote n, Action<UINote> onWriteNote = null, IInspect.NoteMode mode = IInspect.NoteMode.Default, Recipe recipe = null)
3474 {
3475 }
3476
3477 // Token: 0x060035AB RID: 13739 RVA: 0x00122C47 File Offset: 0x00120E47
3478 public void OnInspect()
3479 {
3480 }
3481
3482 // Token: 0x060035AC RID: 13740 RVA: 0x00122C4C File Offset: 0x00120E4C
3483 public Chara AddRandomVisitor(bool guest = false)
3484 {
3485 Trait random = this.map.Installed.traits.GetTraitSet<TraitSpotExit>().GetRandom();
3486 if (random == null)
3487 {
3488 return null;
3489 }
3490 Point point = random.GetPoint();
3491 Chara chara;
3492 if (guest)
3493 {
3494 Zone z = EClass.world.FindZone("wilds");
3495 chara = EClass.game.cards.ListGlobalChara(z).RandomItem<Chara>();
3496 if (chara != null)
3497 {
3498 this.AddCard(chara, point);
3499 Msg.Say("guestArrive", chara, null, null, null);
3500 chara.visitorState = VisitorState.Arrived;
3501 }
3502 }
3503 else
3504 {
3505 chara = CharaGen.CreateFromFilter("c_wilds", -1, -1);
3506 this.AddCard(chara, point);
3507 chara.goalListType = GoalListType.Enemy;
3508 }
3509 return chara;
3510 }
3511
3512 // Token: 0x060035AD RID: 13741 RVA: 0x00122CF0 File Offset: 0x00120EF0
3513 public void OnSimulateHour(VirtualDate date)
3514 {
3515 if (base.IsPlayerFaction)
3516 {
3517 this.branch.OnSimulateHour(date);
3518 }
3519 this.events.OnSimulateHour();
3520 if (date.IsRealTime)
3521 {
3522 foreach (Thing thing in EClass._map.things)
3523 {
3524 if (thing.IsInstalled)
3525 {
3526 thing.trait.TryToggle();
3527 }
3528 }
3529 EClass.pc.DecayNatural(1);
3530 }
3531 EClass._map.things.ForeachReverse(delegate(Thing t)
3532 {
3533 t.OnSimulateHour(date);
3534 });
3535 foreach (Thing thing2 in Zone.Suckers)
3536 {
3537 thing2.Destroy();
3538 }
3539 Zone.Suckers.Clear();
3540 if (this.RespawnRate != 0f)
3541 {
3542 int num = 0;
3543 using (List<Chara>.Enumerator enumerator2 = this.map.charas.GetEnumerator())
3544 {
3545 while (enumerator2.MoveNext())
3546 {
3547 if (!enumerator2.Current.IsGlobal)
3548 {
3549 num++;
3550 }
3551 }
3552 }
3553 if (num < this.MaxRespawn)
3554 {
3555 for (int i = 0; i < this.RespawnPerHour; i++)
3556 {
3557 this.SpawnMob(null, null);
3558 }
3559 }
3560 }
3561 if (!date.IsRealTime && EClass.rnd(24) == 0)
3562 {
3563 this.RainWater();
3564 }
3565 if (date.hour == 6)
3566 {
3567 this.GrowPlants(date);
3568 }
3569 }
3570
3571 // Token: 0x060035AE RID: 13742 RVA: 0x00122EB8 File Offset: 0x001210B8
3572 public void OnSimulateDay(VirtualDate date)
3573 {
3574 if (base.IsPlayerFaction)
3575 {
3576 this.branch.OnSimulateDay(date);
3577 }
3578 }
3579
3580 // Token: 0x060035AF RID: 13743 RVA: 0x00122ECE File Offset: 0x001210CE
3581 public void OnSimulateMonth(VirtualDate date)
3582 {
3583 if (base.IsPlayerFaction)
3584 {
3585 this.branch.OnSimulateMonth(date);
3586 }
3587 if (date.IsRealTime)
3588 {
3589 EClass._map.RefreshAllTiles();
3590 }
3591 }
3592
3593 // Token: 0x060035B0 RID: 13744 RVA: 0x00122EF8 File Offset: 0x001210F8
3594 public void RainWater()
3595 {
3596 if (EClass._map.IsIndoor || !this.IsPCFaction)
3597 {
3598 return;
3599 }
3600 EClass._map.bounds.ForeachCell(delegate(global::Cell c)
3601 {
3602 if (c.IsFarmField && !c.HasRoof)
3603 {
3604 c.isWatered = true;
3605 }
3606 });
3607 }
3608
3609 // Token: 0x060035B1 RID: 13745 RVA: 0x00122F48 File Offset: 0x00121148
3610 public void GrowPlants(VirtualDate date)
3611 {
3612 Zone.<>c__DisplayClass298_0 CS$<>8__locals1 = new Zone.<>c__DisplayClass298_0();
3613 CS$<>8__locals1.date = date;
3614 CS$<>8__locals1.<>4__this = this;
3615 bool flag = EClass.player.isAutoFarming = (this.IsPCFaction && EClass.Branch.policies.IsActive(2707, -1));
3616 CS$<>8__locals1.weedChance = 1;
3617 if (this.IsPCFaction && EClass.Branch.policies.IsActive(2703, -1))
3618 {
3619 CS$<>8__locals1.weedChance += (EClass.debug.enable ? 100000 : 20) + EClass.Branch.Evalue(2703) * 10;
3620 }
3621 if (CS$<>8__locals1.date.sunMap == null)
3622 {
3623 CS$<>8__locals1.date.BuildSunMap();
3624 }
3625 if (flag)
3626 {
3627 HashSet<int> hashSet = new HashSet<int>();
3628 foreach (Thing thing in EClass._map.things)
3629 {
3630 if (thing.IsInstalled)
3631 {
3632 TraitSpotFarm traitSpotFarm = thing.trait as TraitSpotFarm;
3633 if (traitSpotFarm != null)
3634 {
3635 foreach (Point point in traitSpotFarm.ListPoints(null, false))
3636 {
3637 hashSet.Add(point.index);
3638 }
3639 }
3640 }
3641 }
3642 CS$<>8__locals1.<GrowPlants>g__Perform|0(hashSet);
3643 EClass.player.isAutoFarming = false;
3644 CS$<>8__locals1.<GrowPlants>g__Perform|0(hashSet);
3645 return;
3646 }
3647 CS$<>8__locals1.<GrowPlants>g__Perform|0(null);
3648 }
3649
3650 // Token: 0x060035B2 RID: 13746 RVA: 0x001230E4 File Offset: 0x001212E4
3651 public Zone GetZoneAt(int _x, int _y)
3652 {
3653 if (this.IsRegion)
3654 {
3655 foreach (Spatial spatial in this.children)
3656 {
3657 if (!(spatial is Zone_Field) && _x == spatial.x && _y == spatial.y)
3658 {
3659 return spatial as Zone;
3660 }
3661 }
3662 }
3663 foreach (Spatial spatial2 in this.children)
3664 {
3665 if (_x == spatial2.x && _y == spatial2.y)
3666 {
3667 return spatial2 as Zone;
3668 }
3669 }
3670 return null;
3671 }
3672
3673 // Token: 0x060035B3 RID: 13747 RVA: 0x001231B4 File Offset: 0x001213B4
3674 public bool IsCrime(Chara c, Act act)
3675 {
3676 return act.IsHostileAct && this.HasLaw && !this.IsPCFaction && c.IsPC;
3677 }
3678
3679 // Token: 0x060035B4 RID: 13748 RVA: 0x001231DC File Offset: 0x001213DC
3680 public void RefreshCriminal()
3681 {
3682 bool flag = EClass.player.IsCriminal && (this.HasLaw && !this.AllowCriminal) && !this.IsPCFaction;
3683 Hostility hostility = flag ? Hostility.Neutral : Hostility.Friend;
3684 foreach (Chara chara in EClass._map.charas)
3685 {
3686 if (chara.trait is TraitGuard)
3687 {
3688 chara.hostility = hostility;
3689 if (!flag && chara.enemy != null && chara.enemy.IsPCParty)
3690 {
3691 chara.SetEnemy(null);
3692 }
3693 }
3694 }
3695 }
3696
3697 // Token: 0x060035B5 RID: 13749 RVA: 0x00123294 File Offset: 0x00121494
3698 public void RefreshListCitizen()
3699 {
3700 if (base.lv != 0)
3701 {
3702 return;
3703 }
3704 this.dictCitizen.Clear();
3705 foreach (Chara chara in this.map.charas.Concat(this.map.deadCharas))
3706 {
3707 if (chara.trait.IsCitizen && !chara.IsGlobal && !chara.isSubsetCard)
3708 {
3709 this.dictCitizen.Add(chara.uid, chara.Name);
3710 }
3711 }
3712 }
3713
3714 // Token: 0x060035B6 RID: 13750 RVA: 0x00123338 File Offset: 0x00121538
3715 public void ModInfluence(int a)
3716 {
3717 base.influence += a;
3718 if (a > 0)
3719 {
3720 Msg.Say("gainInfluence", this.Name, a.ToString() ?? "", null, null);
3721 }
3722 Tutorial.Reserve("influence", null);
3723 }
3724
3725 // Token: 0x060035B7 RID: 13751 RVA: 0x00123385 File Offset: 0x00121585
3726 public void ModDevelopment(int a)
3727 {
3728 base.development += a;
3729 if (a > 0)
3730 {
3731 Msg.Say("gainDevelopment", this.Name, a.ToString() ?? "", null, null);
3732 }
3733 }
3734
3735 // Token: 0x060035B8 RID: 13752 RVA: 0x001233BC File Offset: 0x001215BC
3736 public void UpdateQuests(bool force = false)
3737 {
3738 if (!this.IsPCFaction && (!(this is Zone_Town) || base.lv != 0))
3739 {
3740 return;
3741 }
3742 Debug.Log("Updating Quest:" + force.ToString());
3743 List<SourceQuest.Row> list = (from a in EClass.sources.quests.rows
3744 where a.@group == "random"
3745 select a).ToList<SourceQuest.Row>();
3746 int num = 0;
3747 foreach (Chara chara in this.map.charas.Concat(this.map.deadCharas))
3748 {
3749 if (chara.quest != null && !EClass.game.quests.list.Contains(chara.quest))
3750 {
3751 if (chara.quest.IsExpired || this.completedQuests.Contains(chara.quest.uid) || force)
3752 {
3753 chara.quest = null;
3754 }
3755 else
3756 {
3757 num++;
3758 }
3759 }
3760 }
3761 if (EClass._zone.dateQuest > EClass.world.date.GetRaw(0) && !force)
3762 {
3763 return;
3764 }
3765 EClass._zone.dateQuest = EClass.world.date.GetRaw(0) + 1440;
3766 int maxQuest = 3;
3767 Rand.UseSeed(base.uid + EClass.player.stats.days / 7 % 100, delegate
3768 {
3769 maxQuest = 4 + EClass.rnd(4);
3770 });
3771 this.completedQuests.Clear();
3772 List<Zone> list2 = Quest.ListDeliver();
3773 List<Tuple<string, int>> listTag = new List<Tuple<string, int>>();
3774 string[] array = EClass._zone.source.questTag;
3775 if (EClass._zone.IsPCFaction)
3776 {
3777 array = new string[]
3778 {
3779 "supply/8",
3780 "deliver/7",
3781 "food/8",
3782 "escort/4",
3783 "deliver/4",
3784 "monster/0",
3785 "war/0",
3786 "farm/0",
3787 "music/0"
3788 };
3789 }
3790 string[] array2 = array;
3791 for (int i = 0; i < array2.Length; i++)
3792 {
3793 string[] array3 = array2[i].Split('/', StringSplitOptions.None);
3794 listTag.Add(new Tuple<string, int>(array3[0], array3[1].ToInt()));
3795 }
3796 int num2 = 0;
3797 Func<SourceQuest.Row, float> <>9__2;
3798 while (num2 < this.map.charas.Count * 2 && num <= maxQuest && num <= 15)
3799 {
3800 Chara chara2 = this.map.charas.RandomItem<Chara>();
3801 if (chara2.trait.CanGiveRandomQuest && !chara2.isSubsetCard && chara2.homeZone == EClass._zone && !chara2.IsGuest() && chara2.memberType != FactionMemberType.Livestock && (chara2.quest == null || force))
3802 {
3803 IList<SourceQuest.Row> source = list;
3804 Func<SourceQuest.Row, float> getWeight;
3805 if ((getWeight = <>9__2) == null)
3806 {
3807 getWeight = (<>9__2 = delegate(SourceQuest.Row a)
3808 {
3809 int num3 = 1;
3810 foreach (Tuple<string, int> tuple in listTag)
3811 {
3812 if (a.tags.Contains(tuple.Item1))
3813 {
3814 num3 = tuple.Item2;
3815 break;
3816 }
3817 }
3818 if (!EClass._zone.IsPCFaction && a.tags.Contains("bulk"))
3819 {
3820 num3 = 0;
3821 }
3822 return (float)(a.chance * num3);
3823 });
3824 }
3825 SourceQuest.Row row = source.RandomItemWeighted(getWeight);
3826 if ((!row.tags.Contains("needDestZone") || list2.Count >= 2) && (row.minFame <= 0 || row.minFame < EClass.player.fame || EClass.debug.enable))
3827 {
3828 Quest.Create(row.id, null, chara2);
3829 num++;
3830 }
3831 }
3832 num2++;
3833 }
3834 }
3835
3836 // Token: 0x060035B9 RID: 13753 RVA: 0x00123754 File Offset: 0x00121954
3837 public int CountMinions(Chara c)
3838 {
3839 int num = 0;
3840 foreach (Chara chara in EClass._map.charas)
3841 {
3842 if (chara.c_uidMaster == c.uid && chara.c_minionType == MinionType.Default)
3843 {
3844 num++;
3845 }
3846 }
3847 return num;
3848 }
3849
3850 // Token: 0x060035BA RID: 13754 RVA: 0x001237C4 File Offset: 0x001219C4
3851 public int GetSoilCost()
3852 {
3853 int n = 0;
3854 EClass._map.bounds.ForeachCell(delegate(global::Cell c)
3855 {
3856 n += c.sourceObj.costSoil;
3857 });
3858 return n / 10;
3859 }
3860
3861 // Token: 0x060035BB RID: 13755 RVA: 0x00123804 File Offset: 0x00121A04
3862 public void SpawnLostItems()
3863 {
3864 for (int i = 0; i < 2 + EClass.rnd(4); i++)
3865 {
3866 Point point = Zone.<SpawnLostItems>g__GetPos|308_0();
3867 if (point != null)
3868 {
3869 if (EClass.rnd(30) == 0)
3870 {
3871 Thing thing = ThingGen.Create("purse", -1, -1);
3872 thing.isLostProperty = true;
3873 thing.things.DestroyAll(null);
3874 int num = EClass.rndHalf(Mathf.Min(base.development / 10 + 10, 50));
3875 thing.c_lockLv = num;
3876 thing.Add("money", EClass.rndHalf(num * 60 + 1000), 1);
3877 if (EClass.rnd(2) == 0)
3878 {
3879 thing.Add("plat", EClass.rnd(4), 1);
3880 }
3881 else
3882 {
3883 thing.Add("medal", EClass.rnd(2), 1);
3884 }
3885 EClass._zone.AddCard(thing, point);
3886 }
3887 else
3888 {
3889 EClass._zone.AddCard(ThingGen.CreateFromCategory("junk", -1), point);
3890 }
3891 }
3892 }
3893 }
3894
3895 // Token: 0x060035BC RID: 13756 RVA: 0x001238F4 File Offset: 0x00121AF4
3896 public void ApplyBackerPet()
3897 {
3898 bool flag = this is Zone_Yowyn && base.lv == -1;
3899 IList<SourceBacker.Row> list = EClass.sources.backers.listPet.Copy<SourceBacker.Row>();
3900 list.Shuffle<SourceBacker.Row>();
3901 if (!EClass.core.config.test.ignoreBackerDestoryFlag)
3902 {
3903 list.ForeachReverse(delegate(SourceBacker.Row a)
3904 {
3905 if (EClass.player.doneBackers.Contains(a.id))
3906 {
3907 list.Remove(a);
3908 }
3909 });
3910 }
3911 foreach (Chara chara in EClass._map.charas)
3912 {
3913 if (!chara.IsGlobal && !chara.IsMinion)
3914 {
3915 if (chara.isBackerContent)
3916 {
3917 if (chara.sourceBacker.isStatic != 0)
3918 {
3919 continue;
3920 }
3921 chara.RemoveBacker();
3922 }
3923 if ((!flag || !(chara.race.id != "cat")) && EClass.rnd(flag ? 2 : 10) == 0)
3924 {
3925 foreach (SourceBacker.Row row in list)
3926 {
3927 if (row.chara == chara.id)
3928 {
3929 chara.ApplyBacker(row.id);
3930 list.Remove(row);
3931 break;
3932 }
3933 }
3934 }
3935 }
3936 }
3937 }
3938
3939 // Token: 0x060035C1 RID: 13761 RVA: 0x00123B08 File Offset: 0x00121D08
3940 [CompilerGenerated]
3941 internal static Thing <TryAddThingInSharedContainer>g__SearchDest|253_0(ref Zone.<>c__DisplayClass253_0 A_0)
3942 {
3943 foreach (Thing thing in A_0.containers)
3944 {
3945 if (thing.trait is TraitShippingChest)
3946 {
3947 thing = EClass.game.cards.container_shipping;
3948 }
3949 if (!A_0.sharedOnly || thing.IsSharedContainer)
3950 {
3951 if (A_0.add)
3952 {
3953 Thing thing2 = thing.things.TryStack(A_0.t.Thing, -1, -1);
3954 if (thing2 != A_0.t)
3955 {
3956 if (A_0.msg)
3957 {
3958 A_0.chara.Say("putSharedItem", A_0.chara, thing, thing2.GetName(NameStyle.Full, -1), null);
3959 }
3960 return thing2;
3961 }
3962 }
3963 else if (thing.things.CanStack(A_0.t, -1, -1) != A_0.t)
3964 {
3965 return thing;
3966 }
3967 if (thing.things.Count < thing.things.MaxCapacity)
3968 {
3969 Window.SaveData windowSaveData = thing.GetWindowSaveData();
3970 if (windowSaveData != null)
3971 {
3972 if (windowSaveData.priority <= A_0.priority || (windowSaveData.noRotten && A_0.t.IsDecayed) || (windowSaveData.onlyRottable && A_0.t.trait.Decay == 0))
3973 {
3974 continue;
3975 }
3976 if (windowSaveData.advDistribution)
3977 {
3978 bool flag = false;
3979 foreach (int num in windowSaveData.cats)
3980 {
3981 if (A_0.t.category.uid == num)
3982 {
3983 flag = true;
3984 break;
3985 }
3986 }
3987 if (!flag)
3988 {
3989 continue;
3990 }
3991 }
3992 else if (windowSaveData.flag.HasFlag(A_0.flag))
3993 {
3994 continue;
3995 }
3996 A_0.priority = windowSaveData.priority;
3997 }
3998 else
3999 {
4000 if (A_0.priority != -1)
4001 {
4002 continue;
4003 }
4004 A_0.priority = 0;
4005 }
4006 A_0.dest = thing;
4007 }
4008 }
4009 }
4010 return null;
4011 }
4012
4013 // Token: 0x060035C5 RID: 13765 RVA: 0x00123FC4 File Offset: 0x001221C4
4014 [CompilerGenerated]
4015 internal static Point <SpawnLostItems>g__GetPos|308_0()
4016 {
4017 for (int i = 0; i < 10; i++)
4018 {
4019 Point randomPoint = EClass._zone.bounds.GetRandomPoint();
4020 if (!randomPoint.IsBlocked && !randomPoint.HasThing && !randomPoint.HasObj && !randomPoint.HasBlock)
4021 {
4022 return randomPoint;
4023 }
4024 }
4025 return null;
4026 }
4027
4028 // Token: 0x04001C62 RID: 7266
4029 public static bool forceRegenerate;
4030
4031 // Token: 0x04001C63 RID: 7267
4032 public static string forceSubset;
4033
4034 // Token: 0x04001C64 RID: 7268
4035 public static CardRow sourceHat;
4036
4037 // Token: 0x04001C65 RID: 7269
4038 public static int okaerinko = 0;
4039
4040 // Token: 0x04001C66 RID: 7270
4041 [JsonProperty]
4042 public FactionBranch branch;
4043
4044 // Token: 0x04001C67 RID: 7271
4045 [JsonProperty]
4046 public HashSet<int> completedQuests = new HashSet<int>();
4047
4048 // Token: 0x04001C68 RID: 7272
4049 [JsonProperty]
4050 public ZoneEventManager events = new ZoneEventManager();
4051
4052 // Token: 0x04001C69 RID: 7273
4053 [JsonProperty]
4054 public ElementContainerZone elements = new ElementContainerZone();
4055
4056 // Token: 0x04001C6A RID: 7274
4057 [JsonProperty]
4058 public MapBounds bounds;
4059
4060 // Token: 0x04001C6B RID: 7275
4061 [JsonProperty]
4062 public Dictionary<int, string> dictCitizen = new Dictionary<int, string>();
4063
4064 // Token: 0x04001C6C RID: 7276
4065 [JsonProperty]
4066 public ZoneInstance instance;
4067
4068 // Token: 0x04001C6D RID: 7277
4069 [JsonProperty]
4070 public List<int> landFeats;
4071
4072 // Token: 0x04001C6E RID: 7278
4073 public Map map;
4074
4075 // Token: 0x04001C6F RID: 7279
4076 public MapSubset subset;
4077
4078 // Token: 0x04001C70 RID: 7280
4079 public ZoneBlueprint bp;
4080
4081 // Token: 0x04001C71 RID: 7281
4082 public int fileVariation;
4083
4084 // Token: 0x04001C72 RID: 7282
4085 public bool dirtyElectricity;
4086
4087 // Token: 0x04001C73 RID: 7283
4088 public bool isStarted;
4089
4090 // Token: 0x04001C74 RID: 7284
4091 public bool isSimulating;
4092
4093 // Token: 0x04001C75 RID: 7285
4094 public int tempDist;
4095
4096 // Token: 0x04001C76 RID: 7286
4097 public BiomeProfile _biome;
4098
4099 // Token: 0x04001C77 RID: 7287
4100 public static bool ignoreSpawnAnime;
4101
4102 // Token: 0x04001C78 RID: 7288
4103 public static List<Thing> Suckers = new List<Thing>();
4104
4105 // Token: 0x02000C20 RID: 3104
4106 public class PortalReturnData
4107 {
4108 // Token: 0x04003035 RID: 12341
4109 [JsonProperty]
4110 public int uidZone;
4111
4112 // Token: 0x04003036 RID: 12342
4113 [JsonProperty]
4114 public int x;
4115
4116 // Token: 0x04003037 RID: 12343
4117 [JsonProperty]
4118 public int z;
4119 }
4120}
Definition Act.2.cs:7
Definition Card.cs:13
Definition Chara.cs:12
Definition DNA.cs:9
Definition Goal.cs:5
Definition Guild.cs:5
Definition Map.cs:15
Definition Msg.cs:7
Definition Point.cs:11
Definition Quest.cs:8
Definition Thing.cs:10
Definition Trait.cs:9
Definition Zone.cs:14