Elin Modding Docs Doc
Loading...
Searching...
No Matches
ThingContainer.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using Newtonsoft.Json;
5using UnityEngine;
6
7// Token: 0x020004E9 RID: 1257
8public class ThingContainer : List<Thing>
9{
10 // Token: 0x17000AE7 RID: 2791
11 // (get) Token: 0x06002162 RID: 8546 RVA: 0x000B8583 File Offset: 0x000B6783
12 [JsonIgnore]
13 public int GridSize
14 {
15 get
16 {
17 return this.width * this.height;
18 }
19 }
20
21 // Token: 0x17000AE8 RID: 2792
22 // (get) Token: 0x06002163 RID: 8547 RVA: 0x000B8592 File Offset: 0x000B6792
23 [JsonIgnore]
24 public bool HasGrid
25 {
26 get
27 {
28 return this.grid != null;
29 }
30 }
31
32 // Token: 0x17000AE9 RID: 2793
33 // (get) Token: 0x06002164 RID: 8548 RVA: 0x000B859D File Offset: 0x000B679D
34 [JsonIgnore]
35 public bool IsMagicChest
36 {
37 get
38 {
39 return this.owner.trait is TraitMagicChest;
40 }
41 }
42
43 // Token: 0x17000AEA RID: 2794
44 // (get) Token: 0x06002165 RID: 8549 RVA: 0x000B85B2 File Offset: 0x000B67B2
45 [JsonIgnore]
46 public int MaxCapacity
47 {
48 get
49 {
50 if (!this.IsMagicChest)
51 {
52 return this.GridSize;
53 }
54 return 100 + this.owner.c_containerUpgrade.cap;
55 }
56 }
57
58 // Token: 0x06002166 RID: 8550 RVA: 0x000B85D6 File Offset: 0x000B67D6
59 public void SetOwner(Card owner)
60 {
61 this.owner = owner;
62 this.width = owner.c_containerSize / 100;
63 this.height = owner.c_containerSize % 100;
64 if (this.width == 0)
65 {
66 this.width = 8;
67 this.height = 5;
68 }
69 }
70
71 // Token: 0x06002167 RID: 8551 RVA: 0x000B8614 File Offset: 0x000B6814
72 public void ChangeSize(int w, int h)
73 {
74 this.width = w;
75 this.height = h;
76 this.owner.c_containerSize = w * 100 + h;
77 this.RefreshGrid();
78 Debug.Log(string.Concat(new string[]
79 {
80 base.Count.ToString(),
81 "/",
82 this.width.ToString(),
83 "/",
84 this.height.ToString(),
85 "/",
86 this.GridSize.ToString()
87 }));
88 }
89
90 // Token: 0x06002168 RID: 8552 RVA: 0x000B86AC File Offset: 0x000B68AC
91 public void RefreshGridRecursive()
92 {
93 foreach (Thing thing in this)
94 {
95 if (thing.IsContainer)
96 {
97 thing.things.RefreshGridRecursive();
98 }
99 }
100 this.RefreshGrid();
101 }
102
103 // Token: 0x06002169 RID: 8553 RVA: 0x000B870C File Offset: 0x000B690C
104 public void RefreshGrid()
105 {
106 if (this.GridSize == 0)
107 {
108 return;
109 }
110 this.grid = new List<Thing>(new Thing[this.GridSize]);
111 foreach (Thing thing in this)
112 {
113 if (this.ShouldShowOnGrid(thing))
114 {
115 if (thing.invX >= this.GridSize || thing.invX < 0 || this.grid[thing.invX] != null)
116 {
117 ThingContainer.listUnassigned.Add(thing);
118 }
119 else
120 {
121 this.grid[thing.invX] = thing;
122 }
123 }
124 }
125 foreach (Thing thing2 in ThingContainer.listUnassigned)
126 {
127 int freeGridIndex = this.GetFreeGridIndex();
128 if (freeGridIndex == -1)
129 {
130 break;
131 }
132 this.grid[freeGridIndex] = thing2;
133 thing2.invX = freeGridIndex;
134 }
135 ThingContainer.listUnassigned.Clear();
136 }
137
138 // Token: 0x0600216A RID: 8554 RVA: 0x000B882C File Offset: 0x000B6A2C
139 public void RefreshGrid(UIMagicChest magic, Window.SaveData data)
140 {
141 magic.filteredList.Clear();
142 magic.cats.Clear();
143 magic.catCount.Clear();
144 this.grid = new List<Thing>(new Thing[this.GridSize]);
145 string lastSearch = magic.lastSearch;
146 bool flag = !lastSearch.IsEmpty();
147 bool flag2 = !magic.idCat.IsEmpty();
148 Window.SaveData.CategoryType category = data.category;
149 bool flag3 = category != Window.SaveData.CategoryType.None;
150 string text = "";
151 foreach (Thing thing in this)
152 {
153 if (flag3)
154 {
155 switch (category)
156 {
157 case Window.SaveData.CategoryType.Main:
158 text = thing.category.GetRoot().id;
159 break;
160 case Window.SaveData.CategoryType.Sub:
161 text = thing.category.GetSecondRoot().id;
162 break;
163 case Window.SaveData.CategoryType.Exact:
164 text = thing.category.id;
165 break;
166 }
167 magic.cats.Add(text);
168 if (magic.catCount.ContainsKey(text))
169 {
170 Dictionary<string, int> catCount = magic.catCount;
171 string key = text;
172 int num = catCount[key];
173 catCount[key] = num + 1;
174 }
175 else
176 {
177 magic.catCount.Add(text, 1);
178 }
179 }
180 if (flag)
181 {
182 if (thing.tempName == null)
183 {
184 thing.tempName = thing.GetName(NameStyle.Full, 1).ToLower();
185 }
186 if (!thing.tempName.Contains(lastSearch) && !thing.source.GetSearchName(false).Contains(lastSearch) && !thing.source.GetSearchName(true).Contains(lastSearch))
187 {
188 continue;
189 }
190 }
191 if (!flag2 || !(text != magic.idCat))
192 {
193 magic.filteredList.Add(thing);
194 }
195 }
196 if (flag2 && !magic.cats.Contains(magic.idCat))
197 {
198 magic.idCat = "";
199 this.RefreshGrid(magic, data);
200 return;
201 }
202 magic.pageMax = (magic.filteredList.Count - 1) / this.GridSize;
203 if (magic.page > magic.pageMax)
204 {
205 magic.page = magic.pageMax;
206 }
207 for (int i = 0; i < this.GridSize; i++)
208 {
209 int num2 = magic.page * this.GridSize + i;
210 if (num2 >= magic.filteredList.Count)
211 {
212 break;
213 }
214 Thing thing2 = magic.filteredList[num2];
215 this.grid[i] = thing2;
216 thing2.invX = i;
217 }
218 magic.RefreshCats();
219 }
220
221 // Token: 0x0600216B RID: 8555 RVA: 0x000B8AD0 File Offset: 0x000B6CD0
222 public bool IsOccupied(int x, int y)
223 {
224 foreach (Thing thing in this)
225 {
226 if (thing.invY == y && thing.invX == x)
227 {
228 return true;
229 }
230 }
231 return false;
232 }
233
234 // Token: 0x0600216C RID: 8556 RVA: 0x000B8B30 File Offset: 0x000B6D30
235 public bool ShouldShowOnGrid(Thing t)
236 {
237 if (!this.owner.IsPC)
238 {
239 return !(t.trait is TraitChestMerchant);
240 }
241 return !t.isEquipped && !t.IsHotItem;
242 }
243
244 // Token: 0x0600216D RID: 8557 RVA: 0x000B8B64 File Offset: 0x000B6D64
245 public void OnAdd(Thing t)
246 {
247 if (!this.HasGrid)
248 {
249 return;
250 }
251 if (!this.ShouldShowOnGrid(t))
252 {
253 return;
254 }
255 int freeGridIndex = this.GetFreeGridIndex();
256 if (freeGridIndex != -1)
257 {
258 this.grid[freeGridIndex] = t;
259 }
260 t.pos.x = freeGridIndex;
261 }
262
263 // Token: 0x0600216E RID: 8558 RVA: 0x000B8BA8 File Offset: 0x000B6DA8
264 public bool IsFull(int y = 0)
265 {
266 if (this.IsMagicChest)
267 {
268 return base.Count >= this.MaxCapacity || (this.owner.trait.IsFridge && !this.owner.isOn);
269 }
270 if (y != 0)
271 {
272 return false;
273 }
274 if (this.owner.trait.IsSpecialContainer && this.owner.parent != null)
275 {
276 return true;
277 }
278 if (!this.HasGrid)
279 {
280 return base.Count >= this.GridSize;
281 }
282 return this.GetFreeGridIndex() == -1;
283 }
284
285 // Token: 0x0600216F RID: 8559 RVA: 0x000B8C3C File Offset: 0x000B6E3C
286 public bool IsOverflowing()
287 {
288 if (!this.HasGrid || this.IsMagicChest)
289 {
290 return false;
291 }
292 int num = 0;
293 foreach (Thing thing in this)
294 {
295 if (thing.invY != 1 && !thing.isEquipped)
296 {
297 num++;
298 }
299 }
300 return num > this.grid.Count;
301 }
302
303 // Token: 0x06002170 RID: 8560 RVA: 0x000B8CC0 File Offset: 0x000B6EC0
304 public int GetFreeGridIndex()
305 {
306 for (int i = 0; i < this.grid.Count; i++)
307 {
308 if (this.grid[i] == null)
309 {
310 return i;
311 }
312 }
313 return -1;
314 }
315
316 // Token: 0x06002171 RID: 8561 RVA: 0x000B8CF4 File Offset: 0x000B6EF4
317 public void OnRemove(Thing t)
318 {
319 if (!this.HasGrid || t.invY != 0)
320 {
321 return;
322 }
323 int num = this.grid.IndexOf(t);
324 if (num != -1)
325 {
326 this.grid[num] = null;
327 }
328 }
329
330 // Token: 0x06002172 RID: 8562 RVA: 0x000B8D30 File Offset: 0x000B6F30
331 public void SetSize(int w, int h)
332 {
333 this.owner.c_containerSize = w * 100 + h;
334 this.SetOwner(this.owner);
335 }
336
337 // Token: 0x06002173 RID: 8563 RVA: 0x000B8D50 File Offset: 0x000B6F50
338 public Thing TryStack(Thing target, int destInvX = -1, int destInvY = -1)
339 {
340 foreach (Thing thing in this)
341 {
342 if (destInvX == -1 && thing.CanSearchContents)
343 {
344 Thing thing2 = thing.things.TryStack(target, destInvX, destInvY);
345 if (thing2 != target)
346 {
347 return thing2;
348 }
349 }
350 if ((destInvX == -1 || (thing.invX == destInvX && thing.invY == destInvY)) && thing != target && target.TryStackTo(thing))
351 {
352 return thing;
353 }
354 }
355 return target;
356 }
357
358 // Token: 0x06002174 RID: 8564 RVA: 0x000B8DE4 File Offset: 0x000B6FE4
359 public Thing CanStack(Thing target, int destInvX = -1, int destInvY = -1)
360 {
361 foreach (Thing thing in this)
362 {
363 if (thing != target && target.CanStackTo(thing))
364 {
365 return thing;
366 }
367 }
368 return target;
369 }
370
371 // Token: 0x06002175 RID: 8565 RVA: 0x000B8E40 File Offset: 0x000B7040
372 public ThingContainer.DestData GetDest(Thing t, bool tryStack = true)
373 {
374 ThingContainer.<>c__DisplayClass31_0 CS$<>8__locals1;
375 CS$<>8__locals1.t = t;
376 CS$<>8__locals1.tryStack = tryStack;
377 CS$<>8__locals1.<>4__this = this;
378 CS$<>8__locals1.d = default(ThingContainer.DestData);
379 if (!this.owner.IsPC)
380 {
381 this.<GetDest>g__SearchDest|31_0(this, true, true, ref CS$<>8__locals1);
382 return CS$<>8__locals1.d;
383 }
384 CS$<>8__locals1.flag = CS$<>8__locals1.t.category.GetRoot().id.ToEnum(true);
385 if (CS$<>8__locals1.flag == ContainerFlag.none)
386 {
387 CS$<>8__locals1.flag = ContainerFlag.other;
388 }
389 ThingContainer._listContainers.Clear();
390 ThingContainer._listContainers.Add(this);
391 this.<GetDest>g__TrySearchContainer|31_1(this.owner, ref CS$<>8__locals1);
392 ThingContainer._listContainers.Sort(delegate(ThingContainer a, ThingContainer b)
393 {
394 Window.SaveData windowSaveData = b.owner.GetWindowSaveData();
395 int num = ((windowSaveData != null) ? windowSaveData.priority : 0) * 10 + (b.owner.IsPC ? 1 : 0);
396 Window.SaveData windowSaveData2 = a.owner.GetWindowSaveData();
397 return num - (((windowSaveData2 != null) ? windowSaveData2.priority : 0) * 10 + (a.owner.IsPC ? 1 : 0));
398 });
399 foreach (ThingContainer things in ThingContainer._listContainers)
400 {
401 this.<GetDest>g__SearchDest|31_0(things, false, true, ref CS$<>8__locals1);
402 if (CS$<>8__locals1.d.IsValid)
403 {
404 return CS$<>8__locals1.d;
405 }
406 }
407 foreach (ThingContainer things2 in ThingContainer._listContainers)
408 {
409 this.<GetDest>g__SearchDest|31_0(things2, true, false, ref CS$<>8__locals1);
410 if (CS$<>8__locals1.d.IsValid)
411 {
412 return CS$<>8__locals1.d;
413 }
414 }
415 return CS$<>8__locals1.d;
416 }
417
418 // Token: 0x06002176 RID: 8566 RVA: 0x000B8FDC File Offset: 0x000B71DC
419 public bool IsFull(Thing t, bool recursive = true, bool tryStack = true)
420 {
421 return this.IsFull(0) && (!tryStack || this.CanStack(t, -1, -1) == t) && (!recursive || !this.GetDest(t, tryStack).IsValid);
422 }
423
424 // Token: 0x06002177 RID: 8567 RVA: 0x000B901C File Offset: 0x000B721C
425 public void AddCurrency(Card owner, string id, int a, SourceMaterial.Row mat = null)
426 {
427 int num = a;
428 this.ListCurrency(id);
429 foreach (Thing thing in ThingContainer.tempList)
430 {
431 if (!(thing.id != id) && (mat == null || thing.material == mat))
432 {
433 if (num > 0)
434 {
435 thing.ModNum(num, true);
436 return;
437 }
438 if (thing.Num + num >= 0)
439 {
440 thing.ModNum(num, true);
441 return;
442 }
443 num += thing.Num;
444 thing.ModNum(-thing.Num, true);
445 }
446 }
447 if (num == 0)
448 {
449 return;
450 }
451 if (num > 0)
452 {
453 Thing thing2 = ThingGen.Create(id, -1, -1);
454 if (mat != null)
455 {
456 thing2.ChangeMaterial(mat);
457 }
458 owner.AddThing(thing2, true, -1, -1).SetNum(num);
459 return;
460 }
461 }
462
463 // Token: 0x06002178 RID: 8568 RVA: 0x000B90F8 File Offset: 0x000B72F8
464 public void DestroyAll(Func<Thing, bool> funcExclude = null)
465 {
466 this.ForeachReverse(delegate(Thing t)
467 {
468 if (funcExclude != null && funcExclude(t))
469 {
470 return;
471 }
472 t.Destroy();
473 this.Remove(t);
474 });
475 if (this.grid != null)
476 {
477 for (int i = 0; i < this.grid.Count; i++)
478 {
479 this.grid[i] = null;
480 }
481 }
482 }
483
484 // Token: 0x06002179 RID: 8569 RVA: 0x000B9158 File Offset: 0x000B7358
485 public Thing Find(int uid)
486 {
487 foreach (Thing thing in this)
488 {
489 if (thing.CanSearchContents)
490 {
491 Thing thing2 = thing.things.Find(uid);
492 if (thing2 != null)
493 {
494 return thing2;
495 }
496 }
497 if (thing.uid == uid)
498 {
499 return thing;
500 }
501 }
502 return null;
503 }
504
505 // Token: 0x0600217A RID: 8570 RVA: 0x000B91CC File Offset: 0x000B73CC
506 public Thing Find<T>() where T : Trait
507 {
508 foreach (Thing thing in this)
509 {
510 if (thing.CanSearchContents)
511 {
512 Thing thing2 = thing.things.Find<T>();
513 if (thing2 != null)
514 {
515 return thing2;
516 }
517 }
518 if (thing.trait is T)
519 {
520 return thing;
521 }
522 }
523 return null;
524 }
525
526 // Token: 0x0600217B RID: 8571 RVA: 0x000B9244 File Offset: 0x000B7444
527 public Thing Find(Func<Thing, bool> func, bool recursive = true)
528 {
529 foreach (Thing thing in this)
530 {
531 if (recursive && thing.CanSearchContents)
532 {
533 Thing thing2 = thing.things.Find(func, true);
534 if (thing2 != null)
535 {
536 return thing2;
537 }
538 }
539 if (func(thing))
540 {
541 return thing;
542 }
543 }
544 return null;
545 }
546
547 // Token: 0x0600217C RID: 8572 RVA: 0x000B92BC File Offset: 0x000B74BC
548 public Thing Find(string id, string idMat)
549 {
550 return this.Find(id, idMat.IsEmpty() ? -1 : EClass.sources.materials.alias[idMat].id, -1);
551 }
552
553 // Token: 0x0600217D RID: 8573 RVA: 0x000B92EC File Offset: 0x000B74EC
554 public Thing Find(string id, int idMat = -1, int refVal = -1)
555 {
556 foreach (Thing thing in this)
557 {
558 if (thing.CanSearchContents)
559 {
560 Thing thing2 = thing.things.Find(id, idMat, refVal);
561 if (thing2 != null)
562 {
563 return thing2;
564 }
565 }
566 if (thing.id == id && (idMat == -1 || thing.material.id == idMat) && (refVal == -1 || thing.refVal == refVal))
567 {
568 return thing;
569 }
570 }
571 return null;
572 }
573
574 // Token: 0x0600217E RID: 8574 RVA: 0x000B9388 File Offset: 0x000B7588
575 public Thing FindStealable()
576 {
577 List<Thing> list = new List<Thing>();
578 foreach (Thing thing in this)
579 {
580 if (!thing.IsContainer && thing.trait.CanBeStolen)
581 {
582 list.Add(thing);
583 }
584 }
585 if (list.Count == 0)
586 {
587 return null;
588 }
589 list.Sort((Thing a, Thing b) => ThingContainer.<FindStealable>g__Compare|40_0(a) - ThingContainer.<FindStealable>g__Compare|40_0(b));
590 return list[0];
591 }
592
593 // Token: 0x0600217F RID: 8575 RVA: 0x000B9428 File Offset: 0x000B7628
594 public ThingStack GetThingStack(string id, int refVal = -1)
595 {
596 ThingStack s = new ThingStack();
597 bool isOrigin = EClass.sources.cards.map[id].isOrigin;
598 return this.GetThingStack(id, s, isOrigin, refVal);
599 }
600
601 // Token: 0x06002180 RID: 8576 RVA: 0x000B9460 File Offset: 0x000B7660
602 public ThingStack GetThingStack(string id, ThingStack s, bool isOrigin, int refVal = -1)
603 {
604 foreach (Thing thing in this)
605 {
606 if (thing.CanSearchContents)
607 {
608 thing.things.GetThingStack(id, s, isOrigin, refVal);
609 }
610 if ((refVal == -1 || thing.refVal == refVal) && thing.IsIdentified && (thing.id == id || (isOrigin && thing.source._origin == id)))
611 {
612 s.Add(thing);
613 }
614 }
615 return s;
616 }
617
618 // Token: 0x06002181 RID: 8577 RVA: 0x000B9504 File Offset: 0x000B7704
619 public ThingStack GetThingStack(string id)
620 {
621 ThingStack s = new ThingStack();
622 bool isOrigin = EClass.sources.cards.map[id].isOrigin;
623 return this.GetThingStack(id, s, isOrigin);
624 }
625
626 // Token: 0x06002182 RID: 8578 RVA: 0x000B953C File Offset: 0x000B773C
627 public ThingStack GetThingStack(string id, ThingStack s, bool isOrigin)
628 {
629 foreach (Thing thing in this)
630 {
631 if (thing.CanSearchContents)
632 {
633 thing.things.GetThingStack(id, s, isOrigin);
634 }
635 if (thing.id == id || (isOrigin && thing.source._origin == id))
636 {
637 s.Add(thing);
638 }
639 }
640 return s;
641 }
642
643 // Token: 0x06002183 RID: 8579 RVA: 0x000B95C8 File Offset: 0x000B77C8
644 public int GetCurrency(string id, ref int sum, SourceMaterial.Row mat = null)
645 {
646 foreach (Thing thing in this)
647 {
648 if (thing.CanSearchContents)
649 {
650 thing.things.GetCurrency(id, ref sum, mat);
651 }
652 if (thing.id == id && (mat == null || thing.material == mat))
653 {
654 sum += thing.Num;
655 }
656 }
657 return sum;
658 }
659
660 // Token: 0x06002184 RID: 8580 RVA: 0x000B9650 File Offset: 0x000B7850
661 public List<Thing> ListCurrency(string id)
662 {
663 ThingContainer.tempList.Clear();
664 this._ListCurrency(id);
665 return ThingContainer.tempList;
666 }
667
668 // Token: 0x06002185 RID: 8581 RVA: 0x000B9668 File Offset: 0x000B7868
669 private void _ListCurrency(string id)
670 {
671 foreach (Thing thing in this)
672 {
673 if (thing.CanSearchContents)
674 {
675 thing.things._ListCurrency(id);
676 }
677 if (thing.id == id)
678 {
679 ThingContainer.tempList.Add(thing);
680 }
681 }
682 }
683
684 // Token: 0x06002186 RID: 8582 RVA: 0x000B96DC File Offset: 0x000B78DC
685 public List<Thing> List(Func<Thing, bool> func, bool onlyAccessible = false)
686 {
687 ThingContainer.tempList.Clear();
688 this._List(func, onlyAccessible);
689 return ThingContainer.tempList;
690 }
691
692 // Token: 0x06002187 RID: 8583 RVA: 0x000B96F8 File Offset: 0x000B78F8
693 public void _List(Func<Thing, bool> func, bool onlyAccessible = false)
694 {
695 foreach (Thing thing in this)
696 {
697 if (!onlyAccessible || !(thing.parent is Card) || (thing.parent as Card).c_lockLv <= 0)
698 {
699 thing.things._List(func, onlyAccessible);
700 if (func(thing))
701 {
702 ThingContainer.tempList.Add(thing);
703 }
704 }
705 }
706 }
707
708 // Token: 0x06002188 RID: 8584 RVA: 0x000B9784 File Offset: 0x000B7984
709 public void AddFactory(HashSet<string> hash)
710 {
711 foreach (Thing thing in this)
712 {
713 if (thing.CanSearchContents)
714 {
715 thing.things.AddFactory(hash);
716 }
717 if (thing.trait.IsFactory)
718 {
719 hash.Add(thing.id);
720 }
721 if (thing.trait.ToggleType == ToggleType.Fire && thing.isOn)
722 {
723 hash.Add("fire");
724 }
725 }
726 }
727
728 // Token: 0x06002189 RID: 8585 RVA: 0x000B981C File Offset: 0x000B7A1C
729 public void Foreach(Action<Thing> action, bool onlyAccessible = true)
730 {
731 foreach (Thing thing in this)
732 {
733 if (!onlyAccessible || thing.CanSearchContents)
734 {
735 thing.things.Foreach(action, true);
736 }
737 action(thing);
738 }
739 }
740
741 // Token: 0x0600218A RID: 8586 RVA: 0x000B9884 File Offset: 0x000B7A84
742 public void Foreach(Func<Thing, bool> action, bool onlyAccessible = true)
743 {
744 foreach (Thing thing in this)
745 {
746 if (!onlyAccessible || thing.CanSearchContents)
747 {
748 thing.things.Foreach(action, true);
749 }
750 if (action(thing))
751 {
752 break;
753 }
754 }
755 }
756
757 // Token: 0x0600218D RID: 8589 RVA: 0x000B9918 File Offset: 0x000B7B18
758 [CompilerGenerated]
759 private void <GetDest>g__SearchDest|31_0(ThingContainer things, bool searchEmpty, bool searchStack, ref ThingContainer.<>c__DisplayClass31_0 A_4)
760 {
761 if (A_4.t.IsContainer && A_4.t.things.Count > 0 && things.owner.IsContainer && !(things.owner.trait is TraitToolBelt))
762 {
763 return;
764 }
765 if (searchStack && A_4.tryStack)
766 {
767 Thing thing = things.CanStack(A_4.t, -1, -1);
768 if (thing != A_4.t)
769 {
770 A_4.d.stack = thing;
771 return;
772 }
773 }
774 if (searchEmpty && !things.IsFull(0))
775 {
776 if (things.owner.trait is TraitToolBelt)
777 {
778 return;
779 }
780 if (!things.owner.isChara && !(things.owner.parent is Chara))
781 {
782 Thing thing2 = things.owner.parent as Thing;
783 if (!(((thing2 != null) ? thing2.trait : null) is TraitToolBelt))
784 {
785 return;
786 }
787 }
788 A_4.d.container = things.owner;
789 }
790 }
791
792 // Token: 0x0600218E RID: 8590 RVA: 0x000B9A10 File Offset: 0x000B7C10
793 [CompilerGenerated]
794 private void <GetDest>g__TrySearchContainer|31_1(Card c, ref ThingContainer.<>c__DisplayClass31_0 A_2)
795 {
796 foreach (Thing thing in c.things)
797 {
798 if (thing.CanSearchContents)
799 {
800 this.<GetDest>g__TrySearchContainer|31_1(thing, ref A_2);
801 }
802 }
803 if (c.things == this)
804 {
805 return;
806 }
807 Window.SaveData windowSaveData = c.GetWindowSaveData();
808 if (windowSaveData != null)
809 {
810 if (windowSaveData.noRotten && A_2.t.IsDecayed)
811 {
812 return;
813 }
814 if (windowSaveData.onlyRottable && A_2.t.trait.Decay == 0)
815 {
816 return;
817 }
818 if (windowSaveData.advDistribution)
819 {
820 using (HashSet<int>.Enumerator enumerator2 = windowSaveData.cats.GetEnumerator())
821 {
822 while (enumerator2.MoveNext())
823 {
824 int num = enumerator2.Current;
825 if (A_2.t.category.uid == num)
826 {
827 ThingContainer._listContainers.Add(c.things);
828 break;
829 }
830 }
831 return;
832 }
833 }
834 if (!windowSaveData.flag.HasFlag(A_2.flag))
835 {
836 ThingContainer._listContainers.Add(c.things);
837 }
838 }
839 }
840
841 // Token: 0x0600218F RID: 8591 RVA: 0x000B9B4C File Offset: 0x000B7D4C
842 [CompilerGenerated]
843 internal static int <FindStealable>g__Compare|40_0(Thing a)
844 {
845 return a.SelfWeight + (a.isEquipped ? 10000 : 0);
846 }
847
848 // Token: 0x04001128 RID: 4392
849 [JsonIgnore]
850 public static List<Thing> listUnassigned = new List<Thing>();
851
852 // Token: 0x04001129 RID: 4393
853 [JsonIgnore]
854 public const int InvYHotbar = 1;
855
856 // Token: 0x0400112A RID: 4394
857 [JsonIgnore]
858 public int width;
859
860 // Token: 0x0400112B RID: 4395
861 [JsonIgnore]
862 public int height;
863
864 // Token: 0x0400112C RID: 4396
865 [JsonIgnore]
866 public Card owner;
867
868 // Token: 0x0400112D RID: 4397
869 [JsonIgnore]
870 public List<Thing> grid;
871
872 // Token: 0x0400112E RID: 4398
873 private static List<ThingContainer> _listContainers = new List<ThingContainer>();
874
875 // Token: 0x0400112F RID: 4399
876 private static List<Thing> tempList = new List<Thing>();
877
878 // Token: 0x020009E9 RID: 2537
879 public struct DestData
880 {
881 // Token: 0x170011D7 RID: 4567
882 // (get) Token: 0x06003F36 RID: 16182 RVA: 0x0014BBBE File Offset: 0x00149DBE
883 public bool IsValid
884 {
885 get
886 {
887 return this.stack != null || this.container != null;
888 }
889 }
890
891 // Token: 0x0400290F RID: 10511
892 public Card container;
893
894 // Token: 0x04002910 RID: 10512
895 public Thing stack;
896 }
897}
Definition Card.cs:13
Definition Chara.cs:12
Definition Thing.cs:10
Definition Trait.cs:9